コード例 #1
0
ファイル: UserController.cs プロジェクト: vibhutisuthar/TEST
 /// <summary>
 /// UserAlreadyExist
 /// </summary>
 /// <param name="strEmailAddress"></param>
 /// <param name="password"></param>
 /// <returns></returns>
 public int UserAlreadyExist(string strEmailAddress)
 {
     UsersBAL objUser = new UsersBAL();
     try
     {
         List<UsersModel> lstUsersModel = objUser.GetPasswordByEmail(strEmailAddress);
         if (lstUsersModel != null && lstUsersModel.Count > 0)
         {
             return 1;
         }
         else
         {
             return 0;
         }
     }
     catch
     {
         return 2;
     }
     finally
     {
         objUser = null;
     }
 }
コード例 #2
0
ファイル: UserController.cs プロジェクト: vibhutisuthar/TEST
 /// <summary>
 /// ChangePassword
 /// </summary>
 /// <param name="strEmailAddress"></param>
 /// <param name="strOldPassword"></param>
 /// <param name="strNewPassword"></param>
 /// <returns></returns>
 public int ChangePasswordMethod(string strEmailAddress, string strOldPassword, string strNewPassword)
 {
     UsersBAL objUsersBAL = new UsersBAL();
     int successfullyUpdated = 0;
     try
     {
         List<UsersModel> lstUsersModel = objUsersBAL.GetPasswordByEmail(strEmailAddress);
         if (lstUsersModel != null && lstUsersModel.Count > 0)
         {
             foreach (UsersModel obj in lstUsersModel)
             {
                 if (obj.Password == strOldPassword)
                 {
                     obj.Password = strNewPassword;
                     obj.encodestring = "";
                     obj.Status = "confirm";
                     successfullyUpdated = objUsersBAL.SaveUser(obj);
                     if (successfullyUpdated == 1)
                     {
                         return 1;
                     }
                 }
                 else
                 {
                     return 0; // Either email address not registered or old password is incorrect.
                     //  return RedirectToAction("Message", "MessageDisplay", new { E = 44 });
                 }
             }
         }
         else
         {
             return 0; // Either email address not registered or old password is incorrect.
             //  return RedirectToAction("Message", "MessageDisplay", new { E = 44 });
         }
         return 0;
     }
     catch (Exception)
     {
         return 2;
     }
     finally
     {
         objUsersBAL = null;
     }
 }