public static bool ValiadateLogin(string idClient) { if (!string.IsNullOrEmpty(idClient)) { var chkLogin = Logins.Logins_Get(idClient); if (chkLogin != null && chkLogin.Rows.Count > 0) { var expired = chkLogin.Rows[0]["Expired"]; if (expired != DBNull.Value) { var dt = DateTime.ParseExact(expired.ToString(), SqliteHelper.SqliteDateTimeFormat, CultureInfo.InvariantCulture); if (dt >= DateTime.Now) { Logins.Logins_UpdateLastActive(idClient, DateTime.Now.ToString(SqliteHelper.SqliteDateTimeFormat), DateTime.Now.AddDays(2).ToString(SqliteHelper.SqliteDateTimeFormat)); return(true); } } else { var created = DateTime.ParseExact(chkLogin.Rows[0]["Created"].ToString(), SqliteHelper.SqliteDateTimeFormat, CultureInfo.InvariantCulture); if (created.AddDays(2) >= DateTime.Now) { Logins.Logins_UpdateLastActive(idClient, DateTime.Now.ToString(SqliteHelper.SqliteDateTimeFormat), DateTime.Now.AddDays(2).ToString(SqliteHelper.SqliteDateTimeFormat)); return(true); } } } } return(false); }
public ActionResult AccessLog() { var listAC = Logins.Logins_Get(); ViewBag.ListAccessLog = listAC; return(View("~/Views/Login/AccessLog.cshtml")); }
public ActionResult AccessLog(string xx = "/") { var ip = Request.Form["ActionRemove"]; //if (!string.IsNullOrEmpty(ip)) { var currentID = LoginsProcessing.GetRequestId(System.Web.HttpContext.Current); Logins.Logins_DeleteLog(ip); if (ip.Equals(currentID)) { Response.Redirect("/Login?ru=/Login/AccessLog"); return(null); } } var listAC = Logins.Logins_Get(); ViewBag.ListAccessLog = listAC; return(View("~/Views/Login/AccessLog.cshtml")); }