示例#1
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     if (ControlValidation.Isblank(txtPassword.Text.Trim()) == true || ControlValidation.IsReserveWord(txtPassword.Text.Trim().ToLower()))
     {
         lblError.Text    = "Pleasse enter Password !";
         txtPassword.Text = "";
         txtPassword.Focus();
     }
     else if (txtPassword.Text.Trim() != txtConfirmPassword.Text.Trim())
     {
         lblError.Text    = "Password Mismatch !";
         txtPassword.Text = "";
         txtPassword.Focus();
         txtConfirmPassword.Text = "ConfirmNewPassword";
     }
     else
     {
         var result = new Results();
         result = UpdatePassword();
         if (result.Result)
         {
             MessageBox.Show("Password Reset Successfully!!!!");
             Login loginform = new Login();
             loginform.Show();
             this.Hide();
         }
         else
         {
             lblError.Text = result.Message;
         }
     }
 }
示例#2
0
        private void btnReset_Click(object sender, EventArgs e)
        {
            if (ControlValidation.Isblank(txtUsername.Text.Trim()) == true || ControlValidation.IsReserveWord(txtUsername.Text.Trim().ToLower()))
            {
                lblError.Text    = "Please enter Username !";
                txtUsername.Text = "";
                txtUsername.Focus();
            }
            else if (ControlValidation.Isblank(txtAnswer1.Text.Trim()) == true || ControlValidation.IsReserveWord(txtAnswer1.Text.Trim().ToLower()))
            {
                lblError.Text   = "Enter Answar for Question1 !";
                txtAnswer1.Text = "";
                txtAnswer1.Focus();
            }
            else if (ControlValidation.Isblank(txtAnswer2.Text.Trim()) == true || ControlValidation.IsReserveWord(txtAnswer2.Text.Trim().ToLower()))
            {
                lblError.Text   = "Enter Answar for Question2 !";
                txtAnswer2.Text = "";
                txtAnswer2.Focus();
            }

            else
            {
                var result = CheckAnswer();
                if (result.Result)
                {
                    if ((MessageBox.Show("Are you Sure to Reset the Password ???", "Password Reset", MessageBoxButtons.YesNo) == DialogResult.Yes))
                    {
                        NewPassword newpasswordform = new NewPassword();
                        newpasswordform.userName = txtUsername.Text.Trim();
                        newpasswordform.userID   = Convert.ToInt32(txthiddenUserID.Text.Trim());
                        newpasswordform.Show();
                        this.Hide();
                    }
                    else
                    {
                        ForgotPassword forgotPasswordform = new ForgotPassword();
                        forgotPasswordform.Show();
                    }
                }
                else
                {
                    lblError.Text = result.Message;
                }
            }
        }
示例#3
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     if (ControlValidation.Isblank(txtUsername.Text.Trim()) == true || ControlValidation.IsReserveWord(txtUsername.Text.Trim().ToLower()))
     {
         lblPasswordError.Text = "";
         lblUsernameError.Text = "Please enter a valid Username";
         txtUsername.Text      = "";
         txtUsername.Focus();
     }
     else if (ControlValidation.Isblank(txtPassword.Text.Trim()) == true || ControlValidation.IsReserveWord(txtPassword.Text.Trim().ToLower()))
     {
         lblUsernameError.Text = "";
         lblPasswordError.Text = "Pleasse enter a valid Password";
         txtPassword.Text      = "";
         txtPassword.Focus();
     }
     else
     {
         //After Password Validation Successful
         var login = _userAuthRepository.GetAll().Where(x => x.UserName == txtUsername.Text && x.Password == txtPassword.Text).FirstOrDefault();
         if (login != null)
         {
             CacheItemPolicy policy = new CacheItemPolicy();
             policy.AbsoluteExpiration = DateTimeOffset.Now.AddHours(12);
             _userInfoCache.Add("userinfo", login, policy);
             //Dashboard dashboardfrm = new Dashboard();
             //dashboardfrm.Show();
             //Accessing the Cache Value from Cache Memory
             var    userInfo = (UserAuth)_userInfoCache.Get("userinfo");
             string str      = userInfo.UserName;
             this.Hide();
         }
         else
         {
             lblLoginError.Text = "Invalid UserId and Password!";
         }
         lblUsernameError.Text = "";
         lblPasswordError.Text = "";
     }
 }
示例#4
0
 private void btnSignUp_Click(object sender, EventArgs e)
 {
     if (ControlValidation.Isblank(txtUsername.Text.Trim()) == true || ControlValidation.IsReserveWord(txtUsername.Text.Trim().ToLower()))
     {
         lblError.Text    = "Please enter Username !";
         txtUsername.Text = "";
         txtUsername.Focus();
     }
     else if (ControlValidation.Isblank(txtPassword.Text.Trim()) == true || ControlValidation.IsReserveWord(txtPassword.Text.Trim().ToLower()))
     {
         lblError.Text    = "Pleasse enter Password !";
         txtPassword.Text = "";
         txtPassword.Focus();
     }
     else if (txtPassword.Text.Trim() != txtConfirmPassword.Text.Trim())
     {
         lblError.Text    = "Password Mismatch !";
         txtPassword.Text = "";
         txtPassword.Focus();
         txtConfirmPassword.Text = "ConfirmPassword";
     }
     else if (ControlValidation.Isblank(txtFirstName.Text.Trim()) == true || ControlValidation.IsReserveWord(txtFirstName.Text.Trim().ToLower()))
     {
         lblError.Text     = "Enter First Name !";
         txtFirstName.Text = "";
         txtFirstName.Focus();
     }
     else if (ControlValidation.Isblank(txtLastName.Text.Trim()) == true || ControlValidation.IsReserveWord(txtLastName.Text.Trim().ToLower()))
     {
         lblError.Text    = "Enter Last Name !";
         txtLastName.Text = "";
         txtLastName.Focus();
     }
     else if (radioMale.Checked == false && radioFemale.Checked == false)
     {
         lblError.Text = "Select Gender !";
     }
     else if (ControlValidation.Isblank(txtMobileNo.Text.Trim()) == true || txtMobileNo.Text.Trim() == "MobileNo" || ControlValidation.IsValidMobileNo(txtMobileNo.Text.Trim()) == false)
     {
         lblError.Text    = "Enter valid Mobile Number !";
         txtMobileNo.Text = "";
         txtMobileNo.Focus();
     }
     else if (ControlValidation.Isblank(txtEmail.Text.Trim()) == true || txtEmail.Text.Trim() == "E-mail" || ControlValidation.IsValidEmail(txtEmail.Text.Trim()) == false)
     {
         lblError.Text = "Enter a valid email id !";
         txtEmail.Text = "";
         txtEmail.Focus();
     }
     else if (cmbQues1.SelectedIndex == 0)
     {
         lblError.Text = "Select Security Question 1 !";
     }
     else if (ControlValidation.Isblank(txtAnswer1.Text.Trim()) == true || ControlValidation.IsReserveWord(txtAnswer1.Text.Trim().ToLower()))
     {
         lblError.Text   = "Enter Answer for Question1 !";
         txtAnswer1.Text = "";
         txtAnswer1.Focus();
     }
     else if (cmbQues2.SelectedIndex == 0)
     {
         lblError.Text = "Select Security Question 2 !";
     }
     else if (ControlValidation.Isblank(txtAnswer2.Text.Trim()) == true || ControlValidation.IsReserveWord(txtAnswer2.Text.Trim().ToLower()))
     {
         lblError.Text   = "Enter Answer for Question2 !";
         txtAnswer2.Text = "";
         txtAnswer2.Focus();
     }
     else
     {
         InventoryEntities database = new InventoryEntities();
         if (ControlValidation.IsReserveWord(txtMiddleName.Text.Trim()))
         {
             txtMiddleName.Text = "";
         }
         var result = Register();
         if (result.Result == true)
         {
             lblError.Text = "";
             Login loginform = new Login();
             loginform.Show();
             this.Hide();
         }
         else
         {
             lblError.Text = result.Message;
         }
     }
 }