public JsonResult GetAllUserDetails_ForList(int?page, int?limit, string sortBy, string direction, string searchString = null, string state = null, string city = null, string parliament = null, string legislative = null, string pincode = null, string mobile = null) { try { UserModel model = new UserModel(); model.CurrentPage = page.Value; model.NumberOfRecords = limit.Value; model.OrderBy = string.Format("{0} {1}", sortBy, direction); model.Mobile = mobile; model.Parliamentary = parliament; model.Legislative = legislative; model.City = city; model.State = state; model.Pincode = pincode; var records = model.GetUserData_ForList(); int total = records.Count > 0 ? records.FirstOrDefault().TotalCount : 0; return(Json(new { records, total }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { UtilityController.LogException(ex, MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name); } return(Json(null, JsonRequestBehavior.AllowGet)); }
public static string Decrypt(string strEncrypted, string strKey) { try { TripleDESCryptoServiceProvider objDESCrypto = new TripleDESCryptoServiceProvider(); MD5CryptoServiceProvider objHashMD5 = new MD5CryptoServiceProvider(); byte[] byteHash, byteBuff; string strTempKey = strKey; byteHash = objHashMD5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(strTempKey)); objHashMD5 = null; objDESCrypto.Key = byteHash; objDESCrypto.Mode = CipherMode.ECB; //CBC, CFB byteBuff = Convert.FromBase64String(strEncrypted); string strDecrypted = ASCIIEncoding.ASCII.GetString (objDESCrypto.CreateDecryptor().TransformFinalBlock (byteBuff, 0, byteBuff.Length)); objDESCrypto = null; return(strDecrypted); } catch (Exception ex) { UtilityController.LogException(ex, MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name); } return(""); }
public void SendEmail(string Username, string Password, string EmailID, string Subject) { try { StringBuilder SBEmail = new StringBuilder(); SBEmail.AppendLine(System.IO.File.ReadAllText(System.Web.HttpContext.Current.Server.MapPath(@"~\EmailTemplate\ForgetPwd.html"))); SmtpClient SmtpServer = new SmtpClient(ConfigurationManager.AppSettings["smtpclient"]); SmtpServer.Port = Convert.ToInt32(ConfigurationManager.AppSettings["smtpPort"]); SmtpServer.Credentials = new System.Net.NetworkCredential(ConfigurationManager.AppSettings["mailUserName"], ConfigurationManager.AppSettings["mailPwd"]); SmtpServer.EnableSsl = false; MailMessage mail = new MailMessage(); mail.IsBodyHtml = true; mail.From = new MailAddress(ConfigurationManager.AppSettings["mailFrom"]); mail.To.Add(EmailID); if (!String.IsNullOrEmpty(ConfigurationManager.AppSettings["mailBCC"])) { mail.Bcc.Add(ConfigurationManager.AppSettings["mailBCC"]); } mail.Subject = Subject; SBEmail = SBEmail.Replace("@Username", Username); SBEmail = SBEmail.Replace("@Password", Password); mail.Body = SBEmail.ToString(); SmtpServer.Send(mail); mail.Dispose(); SmtpServer.Dispose(); } catch (Exception ex) { UtilityController.LogException(ex, MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name); } }
public JsonResult GetParliament() { try { CommonModel model = new CommonModel(); List <CommonModel> parliamentList = model.GetParliamentData(); var jsonData = new { rows = (from data in parliamentList select new { id = data.ParliamentID, parliament = data.ParliamentName.ToString() }).ToList() }; return(Json(jsonData, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { UtilityController.LogException(ex, MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name); } return(null); }