private void createLoginLog() { SecLoginLog loginlog = new SecLoginLog(); loginlog.UserId = (int)Session["UserId"]; SecLoginLogManager.Update(loginlog); }
private void createLoginLog() { SecLoginLog loginlog = new SecLoginLog(); /*changed after DB changes*/ //loginlog.userid = (int)Session["UserId"]; loginlog.UserId = (int)Session["UserId"]; SecLoginLogManager.Update(loginlog); }
public static void Save(SecLoginLog secloginlogMaster) { /*changed after DB changes*/ //if (secloginlogMaster.logid == 0) if (secloginlogMaster.LogId == 0) { DbContextHelper.DbContext.Add(secloginlogMaster); } DbContextHelper.DbContext.SaveChanges(); }
private void createLoginLog(int UserId, bool sucess) { SecLoginLog loginlog = new SecLoginLog(); loginlog.UserId = UserId; loginlog.LoginId = txtUserName.Text.Trim(); loginlog.LoginTime = DateTime.Now; loginlog.LogoutTime = DateTime.Now; if (sucess == true) { loginlog.Sucess = true; } else { loginlog.Sucess = false; } loginlog.CreatedMachineIP = Request.ServerVariables["remote_addr"].ToString(); SecLoginLogManager.Save(loginlog); }
public static void Update(SecLoginLog secloginlogMaster) { /*changed after DB changes*/ // var querySecLoginLog = //from secloginlog in DbContextHelper.DbContext.SecLoginLogs //where // ((from secloginlog0 in DbContextHelper.DbContext.SecLoginLogs // where // secloginlog0.userid == secloginlogMaster.userid // orderby // secloginlog0.logid descending // select new // { // secloginlog0.logid // }).Take(1)).Contains(new { secloginlog.logid }) // select secloginlog; // foreach (var secloginlog in querySecLoginLog) // { // secloginlog.logouttime = DateTime.Now; // } // DbContextHelper.DbContext.SaveChanges();var querySecLoginLog = var querySecLoginLog = from secloginlog in DbContextHelper.DbContext.SecLoginLog where ((from secloginlog0 in DbContextHelper.DbContext.SecLoginLog where secloginlog0.UserId == secloginlogMaster.UserId orderby secloginlog0.LogId descending select new { secloginlog0.LogId }).Take(1)).Contains(new { secloginlog.LogId }) select secloginlog; foreach (var secloginlog in querySecLoginLog) { secloginlog.LogoutTime = DateTime.Now; } DbContextHelper.DbContext.SaveChanges(); }