Ejemplo n.º 1
0
        private void Forgot(object sender, RoutedEventArgs e)
        {
            ForgotPasswordEntity forgotPasswordEntity = new ForgotPasswordEntity();
            ForgotPasswordBLL    ForgotPasswordBLL    = new ForgotPasswordBLL();

            string employeeEmail = txtEmail.Text;
            int    employeeId    = int.Parse(txtId.Text);


            forgotPasswordEntity.EmployeeEmail = employeeEmail;
            forgotPasswordEntity.EmployeeID    = employeeId;

            string requestReset = null;

            requestReset = ForgotPasswordBLL.ForgotBLL(forgotPasswordEntity);

            if (requestReset != null)
            {
                MessageBox.Show("Your password is" + requestReset);
            }
            else
            {
                MessageBox.Show("Something is wrong..check your details again..");
            }
        }
Ejemplo n.º 2
0
        public static DbStatusEntity[] ForgotPasword(ForgotPasswordEntity email)
        {
            var       details      = new List <DbStatusEntity>();
            SendEmail objsendemail = new SendEmail();

            try
            {
                DbStatusEntity objret = new ForgotPasswordDAO().GetFogotPassword(email.EMAIL);
                if (objret.RESULT == 1)
                {
                    string password   = CryptographyHelper.Instance.Decrypt(objret.MSG);
                    string strsubject = "Password retrival from Jewellery Catalog website.";
                    string strbody    = "Hi,<br><br>Your Email : <b>" + email.EMAIL + "</b><br>Your passowrd : <b>" + password + "</b><br><br>Team Jewellery Catalog";
                    if (objsendemail.SendMail(email.EMAIL, strsubject, strbody) == false)
                    {
                        objret.RESULT = 0;
                        objret.MSG    = "Mail sending failue";
                    }
                    else
                    {
                        objret.MSG = "Login details email sent to " + email.EMAIL;
                    }
                }
                details.Add(objret);
            }
            catch (Exception ex)
            {
                details.Add(new DbStatusEntity(ex.Message));
            }
            return(details.ToArray());
        }
Ejemplo n.º 3
0
        public static async Task <string> SendRequestAsync(ForgotPasswordEntity forgotPassEntity)
        {
            if (!(ForgotPasswordManager.forgotPassHandler is IForgotPasswordHandlerAsync))
            {
                return(ForgotPasswordManager.forgotPassHandler.SendRequest(forgotPassEntity));
            }
            string str = await((IForgotPasswordHandlerAsync)ForgotPasswordManager.forgotPassHandler).SendRequestAsync(forgotPassEntity);

            return(str);
        }
Ejemplo n.º 4
0
 public string ForgotBLL(ForgotPasswordEntity forgotPasswordEntity)
 {
     if (validateEmail(forgotPasswordEntity))
     {
         string password = forgotPasswordDAL.ForgotDAL(forgotPasswordEntity);
         return(password);
     }
     else
     {
         return("");
     }
 }
Ejemplo n.º 5
0
        public bool validateEmail(ForgotPasswordEntity forgotPasswordEntity)
        {
            bool          ValidEmployee = true;
            StringBuilder message       = new StringBuilder();
            Regex         regex1        = new Regex("^[A-Za-z0-9*.]{1,50}@(gmail|yahoo|outlook|).(com|org|in|us|au|uk|co.in)$");
            String        email         = forgotPasswordEntity.EmployeeEmail;

            if (!regex1.IsMatch(email))
            {
                message.Append(Environment.NewLine + "Email should follow standards!!");
                ValidEmployee = false;
            }

            if (ValidEmployee == false)
            {
                throw new ALMSException(message.ToString());
            }
            return(ValidEmployee);
        }
Ejemplo n.º 6
0
        public string ForgotDAL(ForgotPasswordEntity forgotPasswordEntity)
        {
            ForgotPasswordEntity searchedEmployee = new ForgotPasswordEntity();

            try
            {
                connection.Open();
                string     command    = "spForgot";
                SqlCommand sqlCommand = new SqlCommand(command, connection);
                sqlCommand.CommandType = CommandType.StoredProcedure;

                sqlCommand.Parameters.AddWithValue("@Email", searchedEmployee.EmployeeEmail);
                sqlCommand.Parameters.AddWithValue("@Id", searchedEmployee.EmployeeID);

                SqlDataReader reader = sqlCommand.ExecuteReader();

                if (reader.Read())
                {
                    string epass = reader["Employee_Password"].ToString();
                    searchedEmployee.EmployeePassword = epass;
                }
                else
                {
                    Console.WriteLine("Record is not present in the DataBase");
                }
            }
            catch (SqlException exception)
            {
                Console.WriteLine("Something Went Wrong." + exception.Message);
            }

            finally
            {
                if (connection.State == ConnectionState.Open)
                {
                    connection.Close();
                }
            }
            return(searchedEmployee.EmployeePassword);
        }
Ejemplo n.º 7
0
 public static string SendRequest(ForgotPasswordEntity forgotPassEntity)
 {
     return(ForgotPasswordManager.forgotPassHandler.SendRequest(forgotPassEntity));
 }