dynamic doCustomerTypeloginValidation(string username, string password, string clienturl, string ipaddress) { var result = _repository.Customer.GetCustomerLoginMobile(username); if (result.Count <= 0) { return(null); } //To set for Session Data string LoginUserID = result[0].customerID.ToString(); _session.SetString("LoginUserID", LoginUserID); _session.SetString("LoginRemoteIpAddress", ipaddress); _session.SetString("LoginTypeParam", "1"); string oldhash = result[0].password; //"wlaf1//SXWsJp/2+Mo8+1wnmxbmZ5ZAt"; //gwtsoft string oldsalt = result[0].salt; //"/SApKtKXpIa6YnHCjKLxQJAeb279BlX8"; bool flag = Operational.Encrypt.SaltedHash.Verify(oldsalt, oldhash, password); if (flag == false) { //increase login_failure count Customer objCustomer = _repository.Customer.FindById(result[0].customerID); bool accLock = false; if (objCustomer != null) { var newfailcount = result[0].login_fail_count + 1; var settingresult = (_repository.Setting.GetAllowLoginFailCount()).ToList(); var settingfailcount = settingresult[0].Value; //change access_status to 2 if login_failure_count = 'Allow Login Failure Count' from setting table if (newfailcount >= Int32.Parse(settingfailcount)) { objCustomer.access_status = 2; accLock = true; //send email to unlock var emailtemplateresult = (_repository.EmailTemplate.GetEmailTemplate("Account Lock Notification")).ToList(); var settingResult = _repository.EmailTemplate.GetSettingResult(); string Message = emailtemplateresult[0].template_content; string Subject = emailtemplateresult[0].subject; string Variable = emailtemplateresult[0].variable; string FromEmail = emailtemplateresult[0].from_email; string Email = result[0].Email; string Account_Name = result[0].customername; string Login_Name = result[0].username; var plainTextBytes = Encoding.UTF8.GetBytes(result[0].customerID.ToString()); string ID = Convert.ToBase64String(plainTextBytes).Replace("=", "%3D");; string unlock_url = "#/unlock/" + ID; string body = Message.Replace("[Account Name]", Account_Name).Replace("[Login Name]", Login_Name).Replace("[Unlock URL]", unlock_url).Replace("\n", "<br/>"); Globalfunction.SendEmailAsync(settingResult, Email, FromEmail, Subject, body, true); } objCustomer.login_fail_count = newfailcount; _repository.Customer.Update(objCustomer); _repository.EventLog.Info("Login failed for this account UserName : "******" , Password : "******"Successful login for this account UserName : " + username); result = _repository.Customer.GetCustomerLoginMobile(username); } } return(result); }