Пример #1
0
 public bool changePassword(mdlChangePassword ObjmdlChangePassword)
 {
     Existed = Objusersecurity.ChangePassword(ObjmdlChangePassword);
     return Existed;
 }
Пример #2
0
        public bool ChangePassword(mdlChangePassword ObjmdlChangePassword)
        {
            bool returnvalue = false;

            try
            {
                SqlCommand cmd = new SqlCommand("stp_ERP_ChangePassword_Update", Con);
                cmd.Parameters.Add("@oldPassword", SqlDbType.VarChar, 20).Value = ObjmdlChangePassword.oldPassword;
                cmd.Parameters.Add("@newPassword", SqlDbType.VarChar, 20).Value = ObjmdlChangePassword.newPassword;
                cmd.Parameters.Add("@userID", SqlDbType.VarChar, 6).Value = ObjmdlChangePassword.userID;
                cmd.CommandType = CommandType.StoredProcedure;
                if (Con.State == ConnectionState.Open)
                {
                    Con.Close();
                }
                Con.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                if (reader.HasRows)
                {
                    reader.Read();
                    returnvalue = Convert.ToBoolean(reader.GetValue(0));
                }
                if (Con.State == ConnectionState.Open)
                {
                    Con.Close();
                }
                if (Convert.ToBoolean(returnvalue) == true)
                {
                    returnvalue = true;
                }
            }
            catch (Exception ex)
            {
                returnvalue = false;
                MessageBox.Show(ex.Message, "ERP - Babar Medicine Company Lahore", MessageBoxButtons.OK, MessageBoxIcon.Error);
                if (Con.State == ConnectionState.Open)
                {
                    Con.Close();
                }
            }
            return returnvalue;
        }