Exemplo n.º 1
0
        private async Task AutoLogin(string username, string password)
        {
            try
            {
                LogintModel _User = new LogintModel
                {
                    UserName = Convert.ToInt64(username),
                    Password = password
                };

                IsBusy = true;

                var UserDetail = await new loginPageService().GetLogin(_User, GlobalConstant.GetUserLoginDetail);
                if (UserDetail.Status == 1)
                {
                    var wrShiipinglist = JsonConvert.DeserializeObject <LogInModel>(UserDetail.Response.ToString());
                    GlobalConstant.iPanelUserID = wrShiipinglist.iPanelUserID;
                    GlobalConstant.sUserName    = wrShiipinglist.sUserName;
                    GlobalConstant.UserPassword = wrShiipinglist.sPassword;
                    GlobalConstant.CustomerName = wrShiipinglist.sFirstName + " " + wrShiipinglist.sLastName;
                    GlobalConstant.BalanceAmt   = wrShiipinglist.decBalance;
                    GlobalConstant.LocationId   = wrShiipinglist.iLocationID;
                    IsBusy = false;
                    await Navigation.PushModalAsync(new MainPage());
                }
                else
                {
                    Application.Current.MainPage.DisplayAlert("Message", "UserName Or Password Is Incorrect.", "Ok");
                    IsBusy = false;
                }
            }
            catch (Exception ex)
            {
            }
        }
Exemplo n.º 2
0
        public async Task <ResultModel> GetLogin(LogintModel model, string Url)
        {
            ResultModel _User = new ResultModel();

            try
            {
                _User = await _helper.Post <LogintModel>(model, Url);

                return(_User);
            }
            catch (Exception ex)
            {
                // Crashes.TrackError(ex);
                return(_User);
            }
        }
Exemplo n.º 3
0
        private async Task LogInAsync()
        {
            LogintModel _User = new LogintModel
            {
                UserName = Convert.ToInt64(UserName),
                Password = PassWord
            };

            if (UserName == "" || UserName == null)
            {
                Application.Current.MainPage.DisplayAlert("Message", "Enter UserName.", "Ok");
            }
            else if (PassWord == null || PassWord == "")
            {
                Application.Current.MainPage.DisplayAlert("Message", "Enter Password.", "Ok");
            }
            else
            {
                IsBusy = true;
                var UserDetail = await new loginPageService().GetLogin(_User, GlobalConstant.GetUserLoginDetail);
                if (UserDetail.Status == 1)
                {
                    var wrShiipinglist = JsonConvert.DeserializeObject <LogInModel>(UserDetail.Response.ToString());
                    GlobalConstant.iPanelUserID = wrShiipinglist.iPanelUserID;
                    GlobalConstant.sUserName    = wrShiipinglist.sUserName;
                    GlobalConstant.UserPassword = wrShiipinglist.sPassword;
                    GlobalConstant.CustomerName = wrShiipinglist.sFirstName + " " + wrShiipinglist.sLastName;
                    GlobalConstant.BalanceAmt   = wrShiipinglist.decBalance;
                    GlobalConstant.LocationId   = wrShiipinglist.iLocationID;
                    _objShared.SaveApplicationProperty("AccessToken", GlobalConstant.AccessToken);
                    _objShared.SaveApplicationProperty("UserName", GlobalConstant.iPanelUserID);
                    _objShared.SaveApplicationProperty("CustomerName", GlobalConstant.CustomerName);
                    _objShared.SaveApplicationProperty("UserPassword", GlobalConstant.UserPassword);
                    IsBusy = false;
                    await Navigation.PushModalAsync(new MainPage());
                }
                else
                {
                    Application.Current.MainPage.DisplayAlert("Message", "UserName Or Password Is Incorrect.", "Ok");
                    IsBusy = false;
                }
            }
        }