예제 #1
0
        public async void Preinfo(string CardNumber)
        {
            AndHUD.Shared.Show(this, "Please Wait", Convert.ToInt32(MaskType.Clear));
            try
            {
                BtnLogin.Visibility  = ViewStates.Invisible;
                BtnResend.Visibility = ViewStates.Invisible;
                AuthServ             = await svc.AuthencateUser("test", CardNumber, CurrentUser.GetDeviceID());

                LoggingClass.LogInfo("User Tried to login with " + CardNumber, screenid);
                if (CardNumber != null)
                {
                    CurrentUser.SaveCardNumber(CardNumber);
                }
                if (AuthServ != null)
                {
                    if (AuthServ.customer.Email != "" && AuthServ.customer.Email != null)
                    {
                        TxtScanresult.Text = AuthServ.ErrorDescription;//" Hi " + authen.customer.FirstName + authen.customer.LastName + ",\n We have sent an email at  " + authen.customer.Email + ".\n Please verify email to continue login. \n If you have not received email Click Resend Email.\n To get Email Id changed, contact store.";
                        TxtScanresult.SetTextColor(Android.Graphics.Color.Black);
                        BtnContinue.Visibility    = ViewStates.Visible;
                        BtnUpdateEmail.Visibility = ViewStates.Visible;
                        BtnContinue.Click        += async delegate
                        {
                            AndHUD.Shared.Show(this, " Please Wait", Convert.ToInt32(MaskType.Clear));
                            AuthServ = await svc.ContinueService(AuthServ);

                            ShowInfo(AuthServ);
                            AndHUD.Shared.Dismiss();
                        };
                        BtnUpdateEmail.Click += delegate
                        {
                            BtnUpdateEmail_Click("please enter your new e-mail id");
                        };
                    }
                }
                else
                {
                    TxtScanresult.Text   = "Sorry. Your Card number is not matching our records.\n Please re-scan Or Try app as Guest Log In.";
                    BtnResend.Visibility = ViewStates.Invisible;
                    BtnLogin.Visibility  = ViewStates.Invisible;
                    TxtScanresult.SetTextColor(Android.Graphics.Color.Red);
                    AndHUD.Shared.Dismiss();
                }
                AndHUD.Shared.Dismiss();
            }
            catch (Exception exe)
            {
            }
        }
        public async void Preinfo(string CardNumber)
        {
            AndHUD.Shared.Show(this, "Please Wait...", Convert.ToInt32(MaskType.Clear));
            try
            {
                BtnLogin.Visibility  = ViewStates.Gone;
                BtnResend.Visibility = ViewStates.Gone;
                try
                {
                    //CurrentUser.
                    EmailVerification(false);
                }
                catch (Exception ex)
                {
                    LoggingClass.LogError(ex.Message, screenid, ex.StackTrace);
                }
                AuthServ = await svc.AuthencateUser("test", CardNumber, CurrentUser.GetDeviceID());

                CurrentUser.SaveInternalCustometID(AuthServ.customer.CustomerID.ToString());
                LoggingClass.LogInfo("User Tried to login with " + CardNumber, screenid);
                if (CardNumber != null)
                {
                    CurrentUser.SaveCardNumber(CardNumber);
                }
                if (AuthServ != null)
                {
                    CurrentUser.SaveUserName(AuthServ.customer.FirstName + AuthServ.customer.LastName, AuthServ.customer.CustomerID.ToString());
                    CurrentUser.SavePrefered(AuthServ.customer.PreferredStore);
                    if (AuthServ.customer.Email != "" && AuthServ.customer.Email != null)
                    {
                        SendRegistrationToAppServer(CurrentUser.getDeviceToken());
                        if (AuthServ.ErrorDescription != null || AuthServ.ErrorDescription == "")
                        {
                            TxtScanresult.Text = AuthServ.ErrorDescription;
                        }
                        else
                        {
                            TxtScanresult.Text = " Hi " + AuthServ.customer.FirstName + AuthServ.customer.LastName + ",\nWe are sending a verification email to " + AuthServ.customer.Email + "..To proceed press continue. To change your emailAddress click on Update.";
                        }
                        TxtScanresult.SetTextColor(Android.Graphics.Color.Black);
                        BtnContinue.Visibility    = ViewStates.Visible;
                        BtnUpdateEmail.Visibility = ViewStates.Invisible;
                        update.Visibility         = ViewStates.Visible;
                        BtnContinue.Click        += async delegate
                        {
                            {
                                AndHUD.Shared.Show(this, " Please Wait...", Convert.ToInt32(MaskType.Clear));
                                AuthServ = await svc.ContinueService(AuthServ);

                                ShowInfo(AuthServ);
                                AndHUD.Shared.Dismiss();
                            }
                        };
                        update.Click += delegate
                        {
                            TxtScanresult.Text        = "";
                            BtnContinue.Visibility    = ViewStates.Gone;
                            update.Visibility         = ViewStates.Gone;
                            txtmail.Visibility        = ViewStates.Visible;
                            Txtem.Visibility          = ViewStates.Visible;
                            BtnUpdateEmail.Visibility = ViewStates.Visible;
                        };
                        BtnUpdateEmail.Click += delegate
                        {
                            {
                                BtnUpdateEmail_Click("please enter your new e-mail id.");
                            }
                        };
                    }
                    else
                    {
                        if (AuthServ.ErrorDescription != null || AuthServ.ErrorDescription == "")
                        {
                            TxtScanresult.Text = AuthServ.ErrorDescription;
                        }
                        else
                        {
                            TxtScanresult.Text = "Hi " + AuthServ.customer.FirstName + AuthServ.customer.LastName + ", \nIt seems we do not have your email address! Please update it so we can send you a verification link that will activate your account.";
                        }
                        TxtScanresult.SetTextColor(Android.Graphics.Color.Red);
                        BtnContinue.Visibility    = ViewStates.Gone;
                        BtnUpdateEmail.Visibility = ViewStates.Visible;
                        txtmail.Visibility        = ViewStates.Visible;
                        Txtem.Visibility          = ViewStates.Visible;
                        BtnUpdateEmail.Click     += delegate
                        {
                            BtnUpdateEmail_Click("please enter your new e-mail id.");
                        };
                    }
                }
                else
                {
                    TxtScanresult.Text   = "Sorry. Your Card number is not matching our records.\n Please re-scan Or Try app as Guest Log In.";
                    BtnResend.Visibility = ViewStates.Invisible;
                    BtnLogin.Visibility  = ViewStates.Invisible;
                    TxtScanresult.SetTextColor(Android.Graphics.Color.Red);
                    AndHUD.Shared.Dismiss();
                }
                AndHUD.Shared.Dismiss();
            }
            catch (Exception exe)
            {
            }
        }