示例#1
0
 private void getValidation()
 {
     if (string.IsNullOrEmpty(contactUserName.Text) &&
         string.IsNullOrEmpty(contactUserTopic.Text) &&
         string.IsNullOrEmpty(contactUserMessagge.Text))
     {
         Helpers.XFToast.ShortMessage("Contact failed");
         //DisplayAlert("Alert", "Contact failed", "Cancel");
         return;
     }
     else
     {
         EmailValid emailValid = new EmailValid();
         emailValid.emailAddress = contactUserEmail.Text.ToString();
         if (emailValid.IsValidEmail())
         {
             Helpers.XFToast.ShortMessage("Contact");
             //DisplayAlert("Success", "Request", "Cancel");
         }
         else
         {
             Helpers.XFToast.ShortMessage("Email Error");
             //DisplayAlert("Alert", "Email Error", "Cancel");
             return;
         }
     }
 }
示例#2
0
        private void getValidationPassive()
        {
            try
            {
                if (string.IsNullOrEmpty(requestUserName.Text) ||
                    string.IsNullOrEmpty(requestUserPhone.Text) ||
                    string.IsNullOrEmpty(requestUserMessage.Text) ||
                    string.IsNullOrEmpty(requestUserEmail.Text) ||
                    string.IsNullOrEmpty(requestUserService.SelectedIndex.ToString()) ||
                    string.IsNullOrEmpty(requestUserDay.ToString()))
                {
                    Helpers.XFToast.ShortMessage("request failed");
                    //DisplayAlert("Alert", "request failed", "Cancel");
                    return;
                }

                else
                {
                    EmailValid emailValid = new EmailValid();
                    emailValid.emailAddress = requestUserEmail.Text.ToString();

                    if (emailValid.IsValidEmail())
                    {
                        if (requestUserPhone.Text.Length != 11)
                        {
                            Helpers.XFToast.ShortMessage("Telephone Error");
                            //DisplayAlert("Alert", "Telephone Error", "Cancel");
                            return;
                        }
                        else
                        {
                            if (0 < DateTime.Compare(DateTime.Now, requestUserDay.Date) || DateTime.Compare(DateTime.Now, requestUserDay.Date) == 0)
                            {
                                RequestUserModel requestUserModel = new RequestUserModel();
                                requestUserModel.reUserName    = requestUserName.Text;
                                requestUserModel.reUserPhone   = requestUserPhone.Text;
                                requestUserModel.reUserMessage = requestUserMessage.Text;
                                requestUserModel.reUserService = requestUserService.SelectedIndex.ToString();
                                requestUserModel.reUserDay     = requestUserDay.Date;
                                requestUserModel.reState       = 0;

                                Helpers.XFToast.ShortMessage("Request");
                            }
                            else
                            {
                                Helpers.XFToast.ShortMessage("Date Time Error");
                            }
                            //DisplayAlert("Success", "Request", "Cancel");
                        }
                    }
                    else
                    {
                        Helpers.XFToast.ShortMessage("Email Error");
                        //DisplayAlert("Alert", "Email Error", "Cancel");
                        return;
                    }
                }
            }
            catch (Exception e) { Helpers.XFToast.ShortMessage(e.Message.ToString()); }
        }
示例#3
0
        private void getValidation()
        {
            if (!string.IsNullOrEmpty(userEmail.Text.ToString()) && !string.IsNullOrEmpty(userName.Text.ToString()))
            {
                EmailValid emailValid = new EmailValid();
                emailValid.emailAddress = userEmail.Text.ToString();

                if (emailValid.IsValidEmail())
                {
                    if (userPhone.Text.Length != 11)
                    {
                        Helpers.XFToast.ShortMessage("Telephone Error");
                        return;
                    }
                    else
                    {
                        try
                        {
                            UserModel userModels = new UserModel();

                            userModels.userId          = users.userId;
                            userModels.userPassword    = users.userPassword;
                            userModels.userBirthday    = userBirthday.Date;
                            userModels.userBloodGroup  = userBloodType.SelectedIndex.ToString();
                            userModels.userEmail       = userEmail.Text.ToString();
                            userModels.userGender      = userGender.SelectedIndex.ToString();
                            userModels.userImageUrl    = userImage.ToString();
                            userModels.userName        = userName.Text.ToString();
                            userModels.userNationality = userNationalityType.SelectedIndex.ToString();
                            userModels.userPhone       = userPhone.Text.ToString();

                            Helpers.XFToast.ShortMessage("Save Success");
                        }
                        catch (Exception ex) { ex.Message.ToString(); }
                    }
                }
                else
                {
                    Helpers.XFToast.ShortMessage("Email Error");
                    return;
                }
            }
            else
            {
                Helpers.XFToast.ShortMessage("Name and Email inValid");
                return;
            }
        }
        public string ActivationKey(string email)
        {
            string guid = Guid.NewGuid().ToString();

            while (_activationService.GetByFilter(i => i.ActivationKey == guid) != null)
            {
                guid = Guid.NewGuid().ToString();
            }
            string     key        = email + ":OSK:" + DateTime.Now + ":OSK:" + guid;
            EmailValid emailValid = new EmailValid
            {
                Email         = email,
                Time          = DateTime.Now,
                ActivationKey = guid
            };

            _activationService.Insert(emailValid);
            return(new Helpers.AESEncryption().EncryptText(key));
        }
        public IActionResult Activation(string key)
        {
            string output = new Helpers.AESEncryption().DecryptText(key);

            string[]   tokens     = output.Split(":OSK:");
            EmailValid emailValid = _activationService.GetByFilter(i => i.Email == tokens[0] && i.ActivationKey == tokens[2] && DateTime.Parse(i.Time.ToString()) == DateTime.Parse(tokens[1]));

            if (emailValid != null)
            {
                if (DateTime.Now > DateTime.Parse(tokens[1]).AddDays(1))
                {
                    return(RedirectToAction("EmailValidExpired", "Alert"));
                }
                _activationService.Delete(emailValid);
                CryptoBox.Data.Models.Users user = _userService.GetByFilter(i => emailValid.Email == i.Email);
                user.EmailValid = true;
                _userService.UpdateUser(user);
                return(RedirectToAction("EmailValidSuccess", "Alert"));
            }
            return(RedirectToAction("EmailValidFailed", "Alert"));
        }
示例#6
0
        private void getValidation()
        {
            if (string.IsNullOrEmpty(loginUserEmail.Text) && string.IsNullOrEmpty(loginUserPassword.Text))
            {
                Helpers.XFToast.ShortMessage("login failed");
                //DisplayAlert("Alert", "login failed", "Cancel");
                return;
            }
            else
            {
                EmailValid emailValid = new EmailValid();
                emailValid.emailAddress = loginUserEmail.Text.ToString();
                if (emailValid.IsValidEmail())
                {
                    //Helpers.XFToast.ShortMessage("login");


                    if (App.userModel.userEmail.Equals(loginUserEmail.Text) && (App.userModel.userPassword.Equals(loginUserPassword.Text)))
                    {
                        App.IsUserLoggedIn = true;
                        Navigation.RemovePage(this);
                        Navigation.PushAsync(new UserMenuPage(App.userModel));
                    }
                    else
                    {
                        Helpers.XFToast.ShortMessage("Email or Password Error");
                    }

                    //DisplayAlert("Success", "Login", "Cancel");
                }
                else
                {
                    Helpers.XFToast.ShortMessage("Email Error");
                    //DisplayAlert("Alert", "Email Error", "Cancel");
                    return;
                }
            }
        }
示例#7
0
        private void getValidation()
        {
            if (string.IsNullOrEmpty(registerUserName.Text) &&
                string.IsNullOrEmpty(registerUserPassword.Text))
            {
                Helpers.XFToast.ShortMessage("Register failed");

                //DisplayAlert("Alert", "Register failed", "Cancel");
                return;
            }
            else
            {
                EmailValid emailValid = new EmailValid();
                emailValid.emailAddress = registerUserEmail.Text.ToString();
                if (emailValid.IsValidEmail())
                {
                    if (registerUserPassword.Text.Length > 7)
                    {
                        Helpers.XFToast.ShortMessage("Register");
                        //DisplayAlert("Success", "Register", "Cancel");
                        Navigation.RemovePage(this);
                    }
                    else
                    {
                        Helpers.XFToast.ShortMessage("Register Password little 8");
                        //DisplayAlert("Alert", "Register Password little 8", "Cancel");
                        return;
                    }
                }
                else
                {
                    Helpers.XFToast.ShortMessage("Email Error");
                    //DisplayAlert("Alert", "Email Error", "Cancel");
                    return;
                }
            }
        }
示例#8
0
 public void Delete(EmailValid entity)
 {
     _repositoryBase.Remove(entity);
 }
示例#9
0
 public void Insert(EmailValid entity)
 {
     _repositoryBase.Insert(entity);
 }