private void SubmitButton()
        {
            Common cmnObj = new Common();
            RegEx  regObj = new RegEx();

            if (LoginModel.textBoxEmail.Length == 0)
            {
                LoginModel.errormessage = GenericError.strEmptyEmail;
            }
            else if (!Regex.IsMatch(LoginModel.textBoxEmail, regObj.strRegEmail))
            {
                LoginModel.errormessage = GenericError.strValidEmail;
            }
            else
            {
                var datatable = GenericEmpOp.Login(LoginModel.textBoxEmail, LoginModel.passwordBox1);
                if (datatable != null)
                {
                    string username = datatable.Rows[0][1].ToString();
                    string userType = datatable.Rows[0][6].ToString();
                    if (userType == "A")
                    {
                    }
                    Welcome welcomeCls = new Welcome();
                    welcomeCls.Show();
                }
                else
                {
                    LoginModel.errormessage = GenericError.strInvalidUserPassword;
                }
            }
        }
예제 #2
0
        private void Register()
        {
            RegEx  regObj = new RegEx();
            Common cmnObj = new Common();

            if (RegistrationModel.textBoxEmail.Length == 0)
            {
                RegistrationModel.errormessage = GenericError.strEmptyEmail;
            }
            else if (!Regex.IsMatch(RegistrationModel.textBoxEmail, regObj.strRegEmail))
            {
                RegistrationModel.errormessage = GenericError.strValidEmail;
            }
            else
            {
                if (RegistrationModel.passwordBox1.Length == 0)
                {
                    RegistrationModel.errormessage = GenericError.strPassword;
                }
                else if (RegistrationModel.passwordBoxConfirm.Length == 0)
                {
                    RegistrationModel.errormessage = GenericError.strConfirmPassword;
                }
                else if (RegistrationModel.passwordBox1 != RegistrationModel.passwordBoxConfirm)
                {
                    RegistrationModel.errormessage = GenericError.strMatchPassword;
                }
                else
                {
                    int status = GenericEmpOp.AddNewRecord(RegistrationModel.textBoxFirstName, RegistrationModel.textBoxLastName, RegistrationModel.textBoxEmail, RegistrationModel.passwordBox1, RegistrationModel.textBoxAddress, RegistrationModel.IsCheckBoxChecked);
                    if (status == 1)
                    {
                        RegistrationModel.errormessage = GenericError.strRegistrationSuccessful;
                        cmnObj.Reset("Registration");
                    }
                }
            }
        }