Base solution for your next web application

Activities of "northgale"

Question

How to synchronize SignalR boilerplate notification to windows form? this is my code on the desktop side. I've tried that notification working fine on the web side. Here is my code, can someone help me? I installed the signalR on windows form using NuGet package

public async void createConnection()
        {
            string link = ConfigurationManager.AppSettings["linkWeb"];
            var hubConnection = new HubConnection(link);
            hubConnection.TraceLevel = TraceLevels.All;
            hubConnection.TraceWriter = Console.Out;
            IHubProxy stockTickerHubProxy = hubConnection.CreateHubProxy("abpCommonHub");
            stockTickerHubProxy.On("getNotification", stock => show("UserId:" + stock));
            await hubConnection.Start();
            await stockTickerHubProxy.Invoke("register");
        }
        public void show(string temp)
        {
            MessageBox.Show(temp);
        }
Question

Hi, I came across to this topic today [http://forum.aspnetboilerplate.com/viewtopic.php?f=2&t=2273])

I also came across the same problem, I need to make a windows form application that could access my previously downloaded module zero template, but it seems I can't find the way to create a login from my windows form. Also I've checked [https://github.com/aspnetboilerplate/as%20...%20AbpWpfDemo]) , but there are no sample on using Identity for login.

Is there any sample code for this?

Sure, Here it is

protected virtual void CheckErrors(IdentityResult identityResult)
{
        identityResult.CheckErrors(LocalizationManager);
}

Hi ismcagdas,

Thankyou, i've checked the webconfig and found out that my custom error is off, i turned it on but the error message still not behave as I want it to.

Now it shows "Identity.DuplicateName" as an error message to user and not "Name {0} is already taken.", still struggling to make this works.

Hi all, I have this line of validation registered on my localization xml

<text name="Identity.DuplicateName" value="Name {0} is already taken." />

and this is my code for creating a new user

public async Task CreateAsync(CreateGuestInput input)
        {
            var guest = input.MapTo<Guest>();
            CheckErrors(await _GuestManager.CreateAsync(guest));
            Logger.Info("Create a Guest with id: " + guest.Id);
        }

When creating, it will await The GuestManager

public async Task<IdentityResult> CreateAsync(Guest input)
        {
            IdentityResult _return= new IdentityResult();
            try
            {
                
                var temp = _guestRepository.GetAll().Where(i => i.IdentityNumber == input.IdentityNumber).FirstOrDefault();
                if (temp == null)
                {
                    
                    await _guestRepository.InsertAsync(input);
                    _return = IdentityResult.Success;
                }
                else
                {
                     _return = IdentityResult.Failed("Identity.DuplicateName");
                }
            }
            catch(Exception ex)
            {
                _return = new IdentityResult(ex.Message);
            }
            return _return;
        }

But I didn't get the Error Message "Name {0} is already taken" but instead i got "An unknown failure has occured.". Can anyone help me with this error handling?

Thank you for your reply. I'm afraid that it's not the answer I seek, but the main problem is already resolved. I guest i just have to post a new one instead. Thanks

Thanks a lot, The code is working fine now. Of Course, I'll be gladly send you the Indonesian XML once it finished. I hope it could helps.

Also after reading the documentation, I still don't get how to use CheckErrors() method. how can I use this line as validation? <text name="Identity.DuplicateName" value="Name {0} is already taken." />

also here is my code public async Task<IdentityResult> CreateAsync(GuestCategory input) { IdentityResult _return = new IdentityResult(); try { if (_guestCategoryRepository.Count(i => i.Name == input.Name) == 0) { await _guestCategoryRepository.InsertAsync(input); _return = IdentityResult.Success; } else { _return = IdentityResult.Failed("Identity.DuplicateName"); } } catch (Exception ex) { _return = IdentityResult.Failed(ex.Message); } return _return; }

I think I'm using IdentityResult wrong here, pls help Thanks

Hi, i'm a newbie with boilerplate, and i need some help. I download the template with module zero and i want to change the default language to Indonesian (id-ID). I added the language source to the database (AbpLanguage) and then I also registered my dictionary to the database (AbpLanguageTexts) and XML file (Core.Localization.Source). Then, I change the default setting on the database from "en" to "id-ID". It works on some browser, some of them still show the default "en" language. In desperation, i remove all others language on the database and finally the localization works on all browser.

In the middle of development, when i have to handle exception using "CheckErrors" method in handling IdentityResult, i found that the localization not working on my exceptionHandling. Instead it returns exception message "[Can not delete admin user]". I also tried to adding "[Can not delete admin user]" as a Key for my Localization dictionary but not working.

While debugging, I experimented a little by re-adding the "en" dictionary to the database. I tried to reproduce the bug, but instead it showing exception message "Can not delete user admin since this is the default admin user" without brackets. Which means, the localization works fine with "en" without we have to describe the key on the database.

My point is how can we configure dictionary for localization for exception handling? Pardon me for the bad English and some technical terms

Showing 1 to 8 of 8 entries