private InsiderDashboardOtherModel BindDashboardForOtherSecurities() { LoginUserDetails objLoginUserDetails = null; InsiderDashboardDTO_OS objInsiderDashboardDTO_OS = null; UserInfoDTO objUserInfoDTO = null; ApprovedPCLDTO objApprovedPCLDTO = null; PasswordExpiryReminderDTO objPassExpiryReminderDTO = null; DateTime CurrentDate; ArrayList lst = new ArrayList(); UserPolicyDocumentEventLogDTO objChangePasswordEventLogDTO = null; CompanyConfigurationDTO objCompanyConfigurationDTO = null; int noOfDays; objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails); using (InsiderDashboardSL_OS objInsiderDashboardSL_OS = new InsiderDashboardSL_OS()) { objInsiderDashboardDTO_OS = objInsiderDashboardSL_OS.GetDashboardDetails_OS(objLoginUserDetails.CompanyDBConnectionString, objLoginUserDetails.LoggedInUserID); Common.Common.CopyObjectPropertyByName(objInsiderDashboardDTO_OS, objInsiderDashboardModel.objInsiderDashboardOtherModel); CurrentDate = Convert.ToDateTime(DateTime.Now.Date.ToString("dd/MM/yyyy"), System.Globalization.CultureInfo.GetCultureInfo("hi-IN").DateTimeFormat); objPassExpiryReminderDTO = objInsiderDashboardSL_OS.GetPasswordExpiryReminder(objLoginUserDetails.CompanyDBConnectionString, objLoginUserDetails.LoggedInUserID); if (objLoginUserDetails.LoggedInUserID == objPassExpiryReminderDTO.UserID && objPassExpiryReminderDTO.ValidityDate.Date >= CurrentDate && objPassExpiryReminderDTO.ExpiryReminderDate.Date <= CurrentDate) { if ((objPassExpiryReminderDTO.ValidityDate.Date - CurrentDate.Date).Days == 1) { noOfDays = (objPassExpiryReminderDTO.ValidityDate.Date - CurrentDate.Date).Days; } else { noOfDays = (objPassExpiryReminderDTO.ValidityDate.Date - CurrentDate.Date).Days + 1; } lst.Add(noOfDays); lst.Add(objPassExpiryReminderDTO.ValidityDate.Date.ToString("dd/MM/yyyy")); ViewBag.PasswordReminderMsg = Common.Common.getResource("pc_msg_50569", lst); } else if (objPassExpiryReminderDTO.ValidityDate.Date < CurrentDate) { objInsiderDashboardModel.objInsiderDashboardOtherModel.IsChangePassword = true; } } return(objInsiderDashboardModel.objInsiderDashboardOtherModel); }
public PasswordExpiryReminderDTO GetPasswordExpiryReminder(string i_sConnectionString, int nUserId) { PasswordExpiryReminderDTO objPasswordExpiryReminderDTO = new PasswordExpiryReminderDTO(); try { //InsiderDashboardDAL objInsiderDashboardDAL = new InsiderDashboardDAL(); using (var objInsiderDashboardDAL = new InsiderDashboardDAL()) { objPasswordExpiryReminderDTO = objInsiderDashboardDAL.GetPasswordExpiryReminder(i_sConnectionString, nUserId); } } catch (Exception exp) { throw exp; } return(objPasswordExpiryReminderDTO); }
public ActionResult ChangePassword(int formId, int acid, PasswordManagementModel objPwdMgmtModel) { bool bErrorOccurred = false; string i_ErrorMessage = ""; LoginUserDetails objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails); PasswordManagementDTO objPwdMgmtDTO = new PasswordManagementDTO(); PasswordConfigModel objPassConfigModel = new PasswordConfigModel(); UserInfoSL objUserInfoSL = new UserInfoSL(); UserPolicyDocumentEventLogDTO objChangePasswordEventLogDTO = null; PasswordExpiryReminderDTO objPassExpiryReminderDTO = null; InsiderTradingEncryption.DataSecurity objPwdHash = new InsiderTradingEncryption.DataSecurity(); try { DataSecurity objDataSecurity = new DataSecurity(); string sOldPassword = string.Empty; string sNewPassword = string.Empty; string sConfirmNewPassword = string.Empty; string sPasswordHash = string.Empty; string sPasswordHashWithSalt = string.Empty; string sSaltValue = string.Empty; string javascriptEncryptionKey = Common.ConstEnum.Javascript_Encryption_Key; string userPasswordHashSalt = Common.ConstEnum.User_Password_Encryption_Key; if (objPwdMgmtModel.OldPassword == null || objPwdMgmtModel.OldPassword == "" || objPwdMgmtModel.NewPassword == null || objPwdMgmtModel.NewPassword == "" || objPwdMgmtModel.ConfirmNewPassword == null || objPwdMgmtModel.ConfirmNewPassword == "") { i_ErrorMessage = "All fields are required fields."; bErrorOccurred = true; } else if (objPwdMgmtModel.NewPassword == null || objPwdMgmtModel.NewPassword == "" || objPwdMgmtModel.ConfirmNewPassword == null || objPwdMgmtModel.ConfirmNewPassword == "") { i_ErrorMessage = "Please enter new password and confirm new password."; bErrorOccurred = true; } else if (objPwdMgmtModel.NewPassword != objPwdMgmtModel.ConfirmNewPassword) { i_ErrorMessage = "New password and Confirm password are not matching."; bErrorOccurred = true; } else if (objPwdMgmtModel.OldPassword == objPwdMgmtModel.NewPassword) { i_ErrorMessage = "New password should not be same as old password."; bErrorOccurred = true; } else if (!string.IsNullOrEmpty(objPwdMgmtModel.OldPassword) && !string.IsNullOrEmpty(objPwdMgmtModel.NewPassword) && !string.IsNullOrEmpty(objPwdMgmtModel.ConfirmNewPassword)) { sOldPassword = DecryptStringAES(objPwdMgmtModel.OldPassword, javascriptEncryptionKey, javascriptEncryptionKey); sNewPassword = DecryptStringAES(objPwdMgmtModel.NewPassword, javascriptEncryptionKey, javascriptEncryptionKey); sConfirmNewPassword = DecryptStringAES(objPwdMgmtModel.ConfirmNewPassword, javascriptEncryptionKey, javascriptEncryptionKey); sPasswordHashWithSalt = objPwdHash.CreateSaltandHash(sNewPassword); sPasswordHash = sPasswordHashWithSalt.Split('~')[0].ToString(); sSaltValue = sPasswordHashWithSalt.Split('~')[1].ToString(); } //Check if the new password follows Password policy if (!bErrorOccurred) { Common.Common objCommon = new Common.Common(); bool isPasswordValid = objCommon.ValidatePassword(objLoginUserDetails.CompanyDBConnectionString, objLoginUserDetails.UserName, sNewPassword, sPasswordHash, objLoginUserDetails.LoggedInUserID, out i_ErrorMessage); if (!isPasswordValid) { bErrorOccurred = true; } } if (bErrorOccurred) { ViewBag.LoginError = i_ErrorMessage; return(View("ChangePassword")); } objPwdMgmtModel.UserInfoID = objLoginUserDetails.LoggedInUserID; string saltValue = string.Empty; string calledFrom = "ChangPwd"; using (UserInfoSL ObjUserInfoSL = new UserInfoSL()) { List <AuthenticationDTO> lstUserDetails = ObjUserInfoSL.GetUserLoginDetails(objLoginUserDetails.CompanyDBConnectionString, Convert.ToString(objLoginUserDetails.LoggedInUserID), calledFrom); foreach (var UserDetails in lstUserDetails) { saltValue = UserDetails.SaltValue; } } string usrSaltValue = (saltValue == null || saltValue == string.Empty) ? userPasswordHashSalt : saltValue; if (saltValue != null && saltValue != "") { objPwdMgmtModel.OldPassword = objPwdHash.CreateHashToVerify(sOldPassword, usrSaltValue); } else { objPwdMgmtModel.OldPassword = objPwdHash.CreateHash(sOldPassword, usrSaltValue); } objPwdMgmtModel.NewPassword = sPasswordHash; objPwdMgmtModel.ConfirmNewPassword = sPasswordHash; objPwdMgmtModel.SaltValue = sSaltValue; InsiderTrading.Common.Common.CopyObjectPropertyByName(objPwdMgmtModel, objPwdMgmtDTO); objUserInfoSL.ChangePassword(objLoginUserDetails.CompanyDBConnectionString, ref objPwdMgmtDTO); objLoginUserDetails.PasswordChangeMessage = Common.Common.getResource("usr_msg_11271"); Common.Common.SetSessionValue(ConstEnum.SessionValue.UserDetails, objLoginUserDetails); Common.Common.SetSessionValue("IsChangePassword", false); } catch (Exception exp) { string sErrMessage = Common.Common.getResource(exp.InnerException.Data[0].ToString()); ViewBag.LoginError = sErrMessage; objPassConfigModel = GetPasswordConfigDetails(); return(View("ChangePassword")); } finally { objLoginUserDetails = null; objPwdMgmtDTO = null; objUserInfoSL = null; objPwdHash = null; } return(RedirectToAction("Index", "Home", new { acid = Convert.ToString(Common.ConstEnum.UserActions.CRUSER_COUSERDASHBOARD_DASHBOARD) })); }
public ActionResult Index(int acid) { TempData.Remove("SearchArray"); LoginUserDetails objLoginUserDetails = null; InsiderDashboardDTO objInsiderDashboardDTO = null; UserInfoDTO objUserInfoDTO = null; ApprovedPCLDTO objApprovedPCLDTO = null; PasswordExpiryReminderDTO objPassExpiryReminderDTO = null; DateTime CurrentDate; ArrayList lst = new ArrayList(); UserPolicyDocumentEventLogDTO objChangePasswordEventLogDTO = null; CompanyConfigurationDTO objCompanyConfigurationDTO = null; int RequiredModuleID = 0; int noOfDays = 0; object path; ViewBag.dupTransCnt = false; ViewBag.ApprovedPCLCnt = false; Common.Common.WriteLogToFile("Start Method", System.Reflection.MethodBase.GetCurrentMethod()); try { objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails); // check IsUserLogin flag in session, and set flag true -- this will indicate user is login and redirect here for first time if (!objLoginUserDetails.IsUserLogin) { objLoginUserDetails.IsUserLogin = true; Common.Common.SetSessionValue(ConstEnum.SessionValue.UserDetails, objLoginUserDetails); } if (objLoginUserDetails.CompanyName == "DCBBank") { ViewBag.IsVisible = 0; } else { ViewBag.IsVisible = 1; } using (var objInsiderInitialDisclosureSL = new InsiderInitialDisclosureSL()) { InsiderInitialDisclosureDTO objInsiderInitialDisclosureDTO = null; objInsiderInitialDisclosureDTO = objInsiderInitialDisclosureSL.Get_mst_company_details(objLoginUserDetails.CompanyDBConnectionString); RequiredModuleID = objInsiderInitialDisclosureDTO.RequiredModule; } objInsiderDashboardModel = new InsiderDashboardModel(); objInsiderDashboardModel.objInsiderDashboardOtherModel = new InsiderDashboardOtherModel(); switch (RequiredModuleID) { case ConstEnum.Code.RequiredModuleOwnSecurity: ViewBag.RequiredModuleOwn = true; ViewBag.RequiredModuleBoth = false; ViewBag.RequiredModuleOther = false; break; case ConstEnum.Code.RequiredModuleOtherSecurity: ViewBag.RequiredModuleOwn = false; ViewBag.RequiredModuleBoth = false; ViewBag.RequiredModuleOther = true; objInsiderDashboardModel.objInsiderDashboardOtherModel = BindDashboardForOtherSecurities(); break; case ConstEnum.Code.RequiredModuleBoth: ViewBag.RequiredModuleOwn = true; int?TradingPolicyID_OS; //check other sericity model is applicable for user or not InsiderInitialDisclosureDTO objInsiderInitialDisclosureDTO = null; using (var objInsiderInitialDisclosureSL = new InsiderInitialDisclosureSL()) { objInsiderInitialDisclosureDTO = objInsiderInitialDisclosureSL.Get_TradingPolicyID_forOS(objLoginUserDetails.CompanyDBConnectionString, objLoginUserDetails.LoggedInUserID); TradingPolicyID_OS = objInsiderInitialDisclosureDTO.TradingPolicyID_OS; } if (TradingPolicyID_OS == null || TradingPolicyID_OS == 0) { ViewBag.RequiredModuleBoth = false; ViewBag.RequiredModuleOther = false; } else { ViewBag.RequiredModuleBoth = true; ViewBag.RequiredModuleOther = true; } objInsiderDashboardModel.objInsiderDashboardOtherModel = BindDashboardForOtherSecurities(); break; } if (objInsiderDashboardModel.objInsiderDashboardOtherModel.IsChangePassword) { Common.Common.SetSessionValue("IsChangePassword", true); return(RedirectToAction("ChangePassword", "UserDetails", new { acid = Convert.ToString(Common.ConstEnum.UserActions.CHANGE_PASSWORD) })); } using (InsiderDashboardSL objInsiderDashboardSL = new InsiderDashboardSL()) { objInsiderDashboardDTO = objInsiderDashboardSL.GetTradingCalenderDetails(objLoginUserDetails.CompanyDBConnectionString, objLoginUserDetails.LoggedInUserID); if (objInsiderDashboardDTO.IsActivated == 1) { ViewBag.hideTrading = 0; } else { ViewBag.hideTrading = 1; } objInsiderDashboardDTO = objInsiderDashboardSL.GetDashboardDetails(objLoginUserDetails.CompanyDBConnectionString, objLoginUserDetails.LoggedInUserID); Common.Common.CopyObjectPropertyByName(objInsiderDashboardDTO, objInsiderDashboardModel); CurrentDate = Convert.ToDateTime(DateTime.Now.Date.ToString("dd/MM/yyyy"), System.Globalization.CultureInfo.GetCultureInfo("hi-IN").DateTimeFormat); objPassExpiryReminderDTO = objInsiderDashboardSL.GetPasswordExpiryReminder(objLoginUserDetails.CompanyDBConnectionString, objLoginUserDetails.LoggedInUserID); if (objLoginUserDetails.LoggedInUserID == objPassExpiryReminderDTO.UserID && objPassExpiryReminderDTO.ValidityDate.Date >= CurrentDate && objPassExpiryReminderDTO.ExpiryReminderDate.Date <= CurrentDate) { if ((objPassExpiryReminderDTO.ValidityDate.Date - CurrentDate.Date).Days == 1) { noOfDays = (objPassExpiryReminderDTO.ValidityDate.Date - CurrentDate.Date).Days; } else { noOfDays = (objPassExpiryReminderDTO.ValidityDate.Date - CurrentDate.Date).Days + 1; } lst.Add(noOfDays); lst.Add(objPassExpiryReminderDTO.ValidityDate.Date.ToString("dd/MM/yyyy")); ViewBag.PasswordReminderMsg = Common.Common.getResource("pc_msg_50569", lst); } else if (objPassExpiryReminderDTO.ValidityDate.Date < CurrentDate) { Common.Common.SetSessionValue("IsChangePassword", true); return(RedirectToAction("ChangePassword", "UserDetails", new { acid = Convert.ToString(Common.ConstEnum.UserActions.CHANGE_PASSWORD) })); } } using (UserInfoSL objUserInfoSL = new UserInfoSL()) { objUserInfoDTO = objUserInfoSL.GetUserDetails(objLoginUserDetails.CompanyDBConnectionString, objLoginUserDetails.LoggedInUserID); if (objUserInfoDTO.DateOfBecomingInsider != null) { ViewBag.InsiderTypeUser = 1; } else { ViewBag.InsiderTypeUser = 0; } } int SecurityTypeCodeIdCnt = 0; int TransactionTypeCodeIdCnt = 0; int DateOfAcquisitionCnt = 0; using (InsiderDashboardSL objInsiderDashboardSL = new InsiderDashboardSL()) { List <DupTransCntDTO> lstDupTransCnt = objInsiderDashboardSL.Get_DupTransCnt(objLoginUserDetails.CompanyDBConnectionString, objLoginUserDetails.LoggedInUserID); foreach (var dupTransCnt in lstDupTransCnt) { SecurityTypeCodeIdCnt = dupTransCnt.SecurityTypeCodeIdCnt; TransactionTypeCodeIdCnt = dupTransCnt.TransactionTypeCodeIdCnt; DateOfAcquisitionCnt = dupTransCnt.DateOfAcquisitionCnt; } } if (SecurityTypeCodeIdCnt != 0 && TransactionTypeCodeIdCnt != 0 && DateOfAcquisitionCnt != 0) { ViewBag.dupTransCnt = true; TempData["TradingTransactionModel"] = null; TempData["DuplicateTransaction"] = null; } int localApprovedPCLCnt = 0; using (TradingTransactionSL objTradingTransactionSL = new TradingTransactionSL()) { List <ApprovedPCLDTO> lstApprovedPCLCnt = objTradingTransactionSL.GetApprovedPCLCntSL(objLoginUserDetails.CompanyDBConnectionString, objLoginUserDetails.LoggedInUserID); foreach (var ApprovedPCLCnt in lstApprovedPCLCnt) { localApprovedPCLCnt = ApprovedPCLCnt.ApprovedPCLCnt; } } if (localApprovedPCLCnt != 0) { ViewBag.ApprovedPCLCnt = true; } } catch (Exception exp) { Common.Common.WriteLogToFile("Exception occurred ", System.Reflection.MethodBase.GetCurrentMethod(), exp); } finally { objLoginUserDetails = null; objInsiderDashboardDTO = null; objUserInfoDTO = null; } Common.Common.WriteLogToFile("End Method", System.Reflection.MethodBase.GetCurrentMethod()); return(View(objInsiderDashboardModel)); }
public ActionResult Index(int acid) { int RequiredModuleID = 0; LoginUserDetails objLoginUserDetails = null; CODashboardDTO objInsiderDashboardDTO = null; PasswordExpiryReminderDTO objPassExpiryReminderDTO = null; DateTime CurrentDate; ArrayList lst = new ArrayList(); UserPolicyDocumentEventLogDTO objChangePasswordEventLogDTO = null; int noOfDays = 0; Common.Common.WriteLogToFile("Start Method", System.Reflection.MethodBase.GetCurrentMethod()); try { objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails); // check IsUserLogin flag in session, and set flag true -- this will indicate user is login and redirect here for first time if (!objLoginUserDetails.IsUserLogin) { objLoginUserDetails.IsUserLogin = true; Common.Common.SetSessionValue(ConstEnum.SessionValue.UserDetails, objLoginUserDetails); } objInsiderDashboardModel = new CODashboardModel(); using (var objInsiderInitialDisclosureSL = new InsiderInitialDisclosureSL()) { InsiderInitialDisclosureDTO objInsiderInitialDisclosureDTO = null; objInsiderInitialDisclosureDTO = objInsiderInitialDisclosureSL.Get_mst_company_details(objLoginUserDetails.CompanyDBConnectionString); RequiredModuleID = objInsiderInitialDisclosureDTO.RequiredModule; } ViewBag.UserTypeCodeId = objLoginUserDetails.UserTypeCodeId; objInsiderDashboardModel.objCODashboardModel_OS = new CODashboardModel_OS(); switch (RequiredModuleID) { case ConstEnum.Code.RequiredModuleOwnSecurity: ViewBag.RequiredModuleOwn = true; ViewBag.RequiredModuleBoth = false; ViewBag.RequiredModuleOther = false; break; case ConstEnum.Code.RequiredModuleOtherSecurity: ViewBag.RequiredModuleOwn = false; ViewBag.RequiredModuleBoth = false; ViewBag.RequiredModuleOther = true; objInsiderDashboardModel.objCODashboardModel_OS = BindCODashboardForOtherSecurities(); break; case ConstEnum.Code.RequiredModuleBoth: ViewBag.RequiredModuleOwn = true; ViewBag.RequiredModuleBoth = true; ViewBag.RequiredModuleOther = true; objInsiderDashboardModel.objCODashboardModel_OS = BindCODashboardForOtherSecurities(); break; } using (CODashboardSL objInsiderDashboardSL = new CODashboardSL()) { objInsiderDashboardDTO = objInsiderDashboardSL.GetDashboardDetails(objLoginUserDetails.CompanyDBConnectionString, objLoginUserDetails.LoggedInUserID); Common.Common.CopyObjectPropertyByName(objInsiderDashboardDTO, objInsiderDashboardModel); } using (InsiderDashboardSL objInsiderDashboardSL = new InsiderDashboardSL()) { CurrentDate = Convert.ToDateTime(DateTime.Now.Date.ToString("dd/MM/yyyy"), System.Globalization.CultureInfo.GetCultureInfo("hi-IN").DateTimeFormat); objPassExpiryReminderDTO = objInsiderDashboardSL.GetPasswordExpiryReminder(objLoginUserDetails.CompanyDBConnectionString, objLoginUserDetails.LoggedInUserID); if (objLoginUserDetails.LoggedInUserID == objPassExpiryReminderDTO.UserID && objPassExpiryReminderDTO.ValidityDate.Date >= CurrentDate && objPassExpiryReminderDTO.ExpiryReminderDate.Date <= CurrentDate) { if ((objPassExpiryReminderDTO.ValidityDate.Date - CurrentDate.Date).Days == 1) { noOfDays = (objPassExpiryReminderDTO.ValidityDate.Date - CurrentDate.Date).Days; } else { noOfDays = (objPassExpiryReminderDTO.ValidityDate.Date - CurrentDate.Date).Days + 1; } lst.Add(noOfDays); lst.Add(objPassExpiryReminderDTO.ValidityDate.Date.ToString("dd/MM/yyyy")); ViewBag.PasswordReminderMsg = Common.Common.getResource("pc_msg_50569", lst); } else if (objPassExpiryReminderDTO.ValidityDate.Date < CurrentDate) { Common.Common.SetSessionValue("IsChangePassword", true); return(RedirectToAction("ChangePassword", "UserDetails", new { acid = Convert.ToString(Common.ConstEnum.UserActions.CHANGE_PASSWORD) })); } } } catch (Exception exp) { Common.Common.WriteLogToFile("Exception occurred ", System.Reflection.MethodBase.GetCurrentMethod(), exp); } finally { objLoginUserDetails = null; } Common.Common.WriteLogToFile("End Method", System.Reflection.MethodBase.GetCurrentMethod()); return(View(objInsiderDashboardModel)); }