public void SetSeedValues() { try { CurrentInfo objCurInfo = new CurrentInfo(); string passPolicy = objCurInfo.GetPrivilegeValue("PASSWORD_POLICY", "NO"); string passwordHisCount = objCurInfo.GetPrivilegeValue("PASSWORD_HISTORY_COUNT", "0"); string passwordStrength = objCurInfo.GetPrivilegeValue("PASSWORD_STRENGTH", ""); if (passPolicy.ToUpper() == "YES") { if (passwordHisCount == "0" || passwordHisCount == "") { ViewBag.PasswordHistoryNeed = "NO"; ViewBag.PasswordHistoryCount = "0"; } else { ViewBag.PasswordHistoryNeed = "YES"; ViewBag.PasswordHistoryCount = passwordHisCount; } AssignExisitingPassword(); ViewBag.PasswordStrength = passwordStrength; } } catch (Exception ex) { DataControl.Impl.ExceptionHandler.WriteLog(ex, null); } }
protected void AssignExisitingPassword() { try { DataControl.HiDoctorFactoryClasses.BL_ChangePassword _objBLChangePass = new DataControl.HiDoctorFactoryClasses.BL_ChangePassword(); StringBuilder passBuilder = new StringBuilder(); CurrentInfo objCurInfo = new CurrentInfo(); string companyCode = objCurInfo.GetCompanyCode(); string userCode = objCurInfo.GetUserCode(); string passwordHistoryCount = objCurInfo.GetPrivilegeValue("PASSWORD_HISTORY_COUNT", "0"); if (passwordHistoryCount != "0") { IEnumerable <MVCModels.PasswordHistory> iePassHis = _objBLChangePass.GetPasswordHistory(companyCode, userCode, passwordHistoryCount); foreach (MVCModels.PasswordHistory objPassHisModel in iePassHis) { passBuilder.Append(objPassHisModel.User_Pass + ","); } ViewBag.PassHistory = passBuilder.ToString().TrimEnd(','); } } catch (Exception ex) { DataControl.Impl.ExceptionHandler.WriteLog(ex, null); } }
public string GetPrivillegeValue() { DOCTOR_CAPTION = _objCurrentInfo.GetPrivilegeValue("DOCTOR_CAPTION_DISPLAY_NAME", "Doctor"); if (DOCTOR_CAPTION.Length >= 21) { DOCTOR_CAPTION = DOCTOR_CAPTION.Remove(20) + "..."; } CHEMIST_CAPTION = _objCurrentInfo.GetPrivilegeValue("CHEMIST_CAPTION_DISPLAY_NAME", "Chemist"); if (CHEMIST_CAPTION.Length >= 21) { CHEMIST_CAPTION = CHEMIST_CAPTION.Remove(20) + "..."; } STOCKIEST_CAPTION = _objCurrentInfo.GetPrivilegeValue("STOCKIEST_CAPTION_DISPLAY_NAME", "Stockist"); if (STOCKIEST_CAPTION.Length >= 21) { STOCKIEST_CAPTION = STOCKIEST_CAPTION.Remove(20) + "..."; } return(DOCTOR_CAPTION); }
public bool UpdatePassword(string companyCode, string userCode, string userName, string oldPassword, string newPassword, string confirmPassword, out string outputMsg) { outputMsg = string.Empty; CurrentInfo objCurInfo = new CurrentInfo(); string strOldPassword = oldPassword; string strNewPassword = newPassword; string strConfirmPassword = confirmPassword; DataSet dsExistpassword = new DataSet(); ArrayList alPasswords = new ArrayList(); string successMsg = ""; bool blStatus; bool result = false; string passwordpolicy = objCurInfo.GetPrivilegeValue("PASSWORD_POLICY", "NO"); string changeFirstTimePassword = objCurInfo.GetPrivilegeValue("CHANGE_FIRSTTIME_PASSWORD", "NO"); string passwordHistoryCount = objCurInfo.GetPrivilegeValue("PASSWORD_HISTORY_COUNT", "0"); if (_objDALChangePass.CheckOldPassWord(companyCode, userName: userName, userPass: oldPassword)) { if (strNewPassword.ToUpper() == "HIDOCTOR" && changeFirstTimePassword == "YES")// User should not have hidoctor as a password. { outputMsg = "You should not use 'hidoctor' as a password. Please try someother password."; } if (passwordpolicy.ToUpper() == "YES") { if (passwordHistoryCount == "0" || passwordHistoryCount == "") { blStatus = _objDALChangePass.InsertUserMasterHistory(companyCode, userCode: userCode); if (blStatus) { blStatus = _objDALChangePass.UpdatePassword(companyCode, userCode: userCode, userPass: newPassword, userName: userName); if (blStatus) { outputMsg = "Password has been updated"; result = true; } else { outputMsg = "Error on update"; } } } else { IEnumerable <MVCModels.PasswordHistory> iePassHis = GetPasswordHistory(companyCode, userCode, passwordHistoryCount); foreach (MVCModels.PasswordHistory objPassHis in iePassHis) { alPasswords.Add(objPassHis.User_Pass); } if (!alPasswords.Contains(strNewPassword)) { blStatus = _objDALChangePass.InsertUserMasterHistory(companyCode: companyCode, userCode: userCode); if (blStatus) { blStatus = _objDALChangePass.UpdatePassword(companyCode: companyCode, userCode: userCode, userPass: newPassword, userName: userName); if (blStatus) { //AssignExisitingPassword(); outputMsg = "Password has been updated"; result = true; } else { outputMsg = "Error on update"; } } } else { outputMsg = "Your Password Is Matched With Last " + alPasswords.Count.ToString() + " Passwords Please Try New One"; } } } else { blStatus = _objDALChangePass.InsertUserMasterHistory(companyCode: companyCode, userCode: userCode); if (blStatus) { blStatus = _objDALChangePass.UpdatePassword(companyCode: companyCode, userCode: userCode, userPass: newPassword, userName: userName); if (blStatus) { outputMsg = "Password has been updated"; result = true; } else { outputMsg = "Error on update"; } } } } else { outputMsg = "Old Password is incorrect"; } return(result); }