Esempio n. 1
0
        public async void GetOrganizationProfile()
        {
            try
            {
                if (!HttpRequest.CheckConnection())
                {
                    OrgProfileDBModel objUser = App.Database.GetOrganizationDetails();
                    if (objUser != null)
                    {
                        ImageBase64 = objUser.src;
                        ImageType   = orgDetails.type;

                        return;
                    }
                    else
                    {
                        Device.BeginInvokeOnMainThread(async() =>
                        {
                            await DependencyService.Get <IXSnack>().ShowMessageAsync("Please login atleast first in net connectivity to get logo.");
                        });
                        return;
                    }
                }
                else
                {
                    DependencyService.Get <IProgressBar>().Show(Resx.AppResources.pleaseWait);
                    var menuItem = await CommonMethods.GetOrganizationProfile();

                    if (menuItem != null)
                    {
                        ImageBase64 = menuItem.logo.src;
                        ImageType   = menuItem.logo.type;
                        LangType    = JsonConvert.DeserializeObject <Language>(menuItem.name);


                        OrgProfileDBModel orgData = new OrgProfileDBModel();
                        orgData.src  = menuItem.logo.src;
                        orgData.type = menuItem.logo.type;
                        orgData.name = menuItem.name;


                        var status = App.Database.SaveOrganizationUser(orgData);
                    }
                    else
                    {
                        await DependencyService.Get <IXSnack>().ShowMessageAsync(Resx.AppResources.ErrorLoadingData);
                    }
                }
            }
            catch (Exception ex)
            {
                DependencyService.Get <IProgressBar>().Hide();
                await DependencyService.Get <IXSnack>().ShowMessageAsync(ex.Message);
            }
            finally
            {
                DependencyService.Get <IProgressBar>().Hide();
            }
        }
        public async void GetOrganizationProfile()
        {
            try
            {
                if (!HttpRequest.CheckConnection())
                {
                    OrgProfileDBModel objUser = App.Database.GetOrganizationDetails();
                    ImageBase64 = objUser.src;

                    //await CommonMethods.ShowPopup(Resx.AppResources.pleaseCheckYourNetworkConnection);

                    //return;
                }
                else
                {
                    DependencyService.Get <IProgressBar>().Show(Resx.AppResources.pleaseWait);
                    var menuItem = await CommonMethods.GetOrganizationProfile();

                    if (menuItem != null)
                    {
                        // DependencyService.Get<ILodingPageService>().HideLoadingPage();
                        ImageBase64 = menuItem.logo.src;
                        ImageType   = menuItem.logo.type;
                        LangType    = JsonConvert.DeserializeObject <Language>(menuItem.name);

                        OrgProfileDBModel orgData = new OrgProfileDBModel();
                        orgData.src  = menuItem.logo.src;
                        orgData.type = menuItem.logo.type;
                        orgData.name = menuItem.name;
                        var status = App.Database.SaveOrganizationUser(orgData);
                    }
                    else
                    {
                        await DependencyService.Get <IXSnack>().ShowMessageAsync(Resx.AppResources.ErrorLoadingData);
                    }
                }
            }
            catch (Exception ex)
            {
                DependencyService.Get <IProgressBar>().Hide();
                await DependencyService.Get <IXSnack>().ShowMessageAsync(ex.Message);
            }
            finally
            {
                DependencyService.Get <IProgressBar>().Hide();
            }
        }
Esempio n. 3
0
        public LoginViewModel()
        {
            GetOrganizationProfile();
            objUser    = App.Database.GetLoggedInUser();
            orgDetails = App.Database.GetOrganizationDetails();
            if (objUser != null)
            {
                UserName = objUser.UserName;
                Password = objUser.Password;
            }
            var sqlLiteResult = App.Database.GetLanguage();

            if (sqlLiteResult != null)
            {
                if (sqlLiteResult.LangKey == "ar-AE")
                {
                    LngToggled = true;
                    LanText    = "Arabic";
                }
                else
                {
                    LngToggled = false;
                    LanText    = "English";
                }
            }
            else
            {
                LngToggled = false;
                LanText    = "English";
                string      lang    = "en-US";
                AppLanguage objUser = new AppLanguage();
                objUser.LangKey = lang;
                App.lang        = lang;
                App.Database.SaveLanguage(objUser);
            }
        }