Пример #1
0
        /// <summary>
        /// This method is used to get single company connection string
        /// </summary>
        /// <param name="s_CompanyName">string: Name of the company</param>
        /// <returns>CompanyDTO</returns>
        public static CompanyDTO GetCompanyDetials(string s_CompanyName)
        {
            CompaniesSL objCompanySL = new CompaniesSL();

            InsiderTradingDAL.CompanyDTO objSelectedCompany = objCompanySL.getSingleCompanies(CommonModel.getSystemConnectionString(), s_CompanyName);
            return(objSelectedCompany);
        }
Пример #2
0
 public InsiderTradingDAL.CompanyDTO getSingleCompanies(string i_sConnectionString, string i_sCompanyDatabaseName)
 {
     InsiderTradingDAL.CompanyDTO objCompaniesList = new InsiderTradingDAL.CompanyDTO();
     //InsiderTradingDAL.CompanyDAL objCompanyDAL = new InsiderTradingDAL.CompanyDAL();
     try
     {
         using (var objCompanyDAL = new InsiderTradingDAL.CompanyDAL())
         {
             objCompaniesList = objCompanyDAL.GetSingleCompanyDetails(i_sConnectionString, i_sCompanyDatabaseName);
         }
     }
     catch (Exception exp)
     {
         throw exp;
     }
     return(objCompaniesList);
 }
Пример #3
0
        public ActionResult ForgetPassword(PasswordManagementModel objPwdMgmtModel)
        {
            ModelState.Remove("KEY");
            ModelState.Add("KEY", new ModelState());
            ModelState.Clear();
            Session["UserCaptchaTextForgotPwd"] = (objPwdMgmtModel.sCaptchaText == null) ? string.Empty : objPwdMgmtModel.sCaptchaText;
            LoginUserDetails objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails);

            try
            {
                if (objLoginUserDetails == null)
                {
                    objLoginUserDetails = new LoginUserDetails();
                }

                PasswordManagementDTO objPwdMgmtDTO = new PasswordManagementDTO();
                UserInfoSL            objUserInfoSL = new UserInfoSL();
                CompaniesSL           objCompanySL  = new CompaniesSL();

                if (System.Configuration.ConfigurationManager.AppSettings["CompanyType"] == "Textbox")
                {
                    Dictionary <string, string> objCompaniesDictionary = null;

                    objCompaniesDictionary = new Dictionary <string, string>();

                    foreach (InsiderTradingDAL.CompanyDTO objCompanyDTO in objCompanySL.getAllCompanies(Common.Common.getSystemConnectionString()))
                    {
                        objCompaniesDictionary.Add(objCompanyDTO.sCompanyDatabaseName, objCompanyDTO.sCompanyName.ToLower());
                    }

                    if (objCompaniesDictionary.ContainsValue(objPwdMgmtModel.CompanyID.ToLower()))
                    {
                        objPwdMgmtModel.CompanyID = (from entry in objCompaniesDictionary
                                                     where entry.Value.ToLower() == objPwdMgmtModel.CompanyID.ToLower()
                                                     select entry.Key).FirstOrDefault();
                    }
                }

                InsiderTradingDAL.CompanyDTO objSelectedCompany = objCompanySL.getSingleCompanies(Common.Common.getSystemConnectionString(), objPwdMgmtModel.CompanyID);


                string SaltValue = Common.ConstEnum.User_Password_Encryption_Key;

                InsiderTradingEncryption.DataSecurity objPwdHash = new InsiderTradingEncryption.DataSecurity();
                string sHashCode = objPwdHash.CreateHash(objPwdMgmtModel.LoginID.ToString() + objPwdMgmtModel.CompanyID.ToString(), SaltValue);
                objPwdMgmtModel.HashValue = sHashCode;
                var CallBackUrl = Url.Action("SetPassword", "Account", new { @code = sHashCode });

                string sLoginID = string.Empty;
                string sEmailID = string.Empty;
                string javascriptEncryptionKey = Common.ConstEnum.Javascript_Encryption_Key;

                sLoginID = DecryptStringAES(objPwdMgmtModel.LoginID, javascriptEncryptionKey, javascriptEncryptionKey);
                sEmailID = DecryptStringAES(objPwdMgmtModel.EmailID, javascriptEncryptionKey, javascriptEncryptionKey);

                if (!string.IsNullOrEmpty(sEmailID))
                {
                    string emailRegex = @"^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$";
                    Regex  re         = new Regex(emailRegex);
                    if (!re.IsMatch(sEmailID))
                    {
                        ModelState.AddModelError("EmailID", "Please provide valid Email ID");
                    }
                }

                objPwdMgmtModel.LoginID = sLoginID;
                objPwdMgmtModel.EmailID = sEmailID;

                InsiderTrading.Common.Common.CopyObjectPropertyByName(objPwdMgmtModel, objPwdMgmtDTO);
                objPwdMgmtDTO = objUserInfoSL.ForgetPassword(objSelectedCompany.CompanyConnectionString, objPwdMgmtDTO);
                if (objPwdMgmtDTO.EmailID != null)
                {
                    if (objPwdMgmtModel.sCaptchaText != Session["CaptchaValueForgotPwd"].ToString())
                    {
                        TempData["ShowCaptchaForgotPwd"]  = true;
                        TempData["ErrorMessageForgotPwd"] = "Please provide valid Text";
                        @ViewBag.ErrorMessage             = "Please provide valid Text";
                        objLoginUserDetails.ErrorMessage  = "Please provide valid Text";
                        return(RedirectToAction("ForgetPassword", "Account"));
                    }
                    Common.Common.SendMail(CallBackUrl, objPwdMgmtDTO, objSelectedCompany.sCompanyDatabaseName);
                }
                objLoginUserDetails.SuccessMessage = Common.Common.getResourceForGivenCompany("usr_msg_11270", objSelectedCompany.sCompanyDatabaseName);
                Common.Common.SetSessionValue(ConstEnum.SessionValue.UserDetails, objLoginUserDetails);
                return(RedirectToAction("Login", "Account"));//.Success(Common.Common.getResourceForGivenCompany("usr_msg_11270", objSelectedCompany.sCompanyDatabaseName));
            }
            catch (Exception exp)
            {
                string sErrMessage = exp.Message;
                if (exp.InnerException != null && exp.InnerException.Data != null && exp.InnerException.Data.Count > 0)
                {
                    sErrMessage = Common.Common.getResourceForGivenCompany(exp.InnerException.Data[0].ToString(), objPwdMgmtModel.CompanyID);
                }
                @ViewBag.ErrorMessage   = sErrMessage;
                objPwdMgmtModel.LoginID = null;
                objPwdMgmtModel.EmailID = null;
                Dictionary <string, string> objCompaiesDictionary = new Dictionary <string, string>();
                objCompaiesDictionary.Add("", "Select Company");
                CompaniesSL objCompanySL = new CompaniesSL();
                List <InsiderTradingDAL.CompanyDTO> lstCompanies = new List <InsiderTradingDAL.CompanyDTO>();
                lstCompanies = objCompanySL.getAllCompanies(Common.Common.getSystemConnectionString());
                foreach (InsiderTradingDAL.CompanyDTO objCompanyDTO in lstCompanies)
                {
                    objCompaiesDictionary.Add(objCompanyDTO.sCompanyDatabaseName, objCompanyDTO.sCompanyName);
                }
                ViewBag.CompaniesDropDown        = objCompaiesDictionary;
                objLoginUserDetails.ErrorMessage = sErrMessage;
                Common.Common.SetSessionValue(ConstEnum.SessionValue.UserDetails, objLoginUserDetails);
                return(RedirectToAction("ForgetPassword", "Account"));
            }
        }