protected void Lnk_LogOut_Click(object sender, EventArgs e) { try { if (Session["USER_ID"] != null) { SMHR_USERLOG _obj_SMHR_USER_LOG = new SMHR_USERLOG(); _obj_SMHR_USER_LOG.USERLOG_ID = Convert.ToInt32(Session["UserlogID"]); _obj_SMHR_USER_LOG.USERLOG_LOGEND = DateTime.Now; if (BLL.GET_USER_LOG_UPDATE(_obj_SMHR_USER_LOG)) { Session.Remove("USER_ID"); } Response.Redirect("~/Logout.aspx"); } } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "SMHRMaster", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }
private void LoadGrid() { try { SMHR_USERLOG _obj_SMHR_USERLOG = new SMHR_USERLOG(); _obj_SMHR_USERLOG.USERLOG_USER_ID = Convert.ToInt32(Session["USER_ID"]); DataTable dt = BLL.GET_USER_LOG_CHECK(_obj_SMHR_USERLOG); rgUserlog.DataSource = dt; // ClearControls(); } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_UserLog", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }
protected void USER_LOG() { string ipaddress; string strHostName = System.Net.Dns.GetHostName(); ipaddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; ipaddress = Convert.ToString(Request.ServerVariables["REMOTE_ADDR"]); SMHR_USERLOG SMHR_USER_LOG = new SMHR_USERLOG(); SMHR_USER_LOG.USERLOG_USER_ID = Convert.ToInt32(Session["USER_ID"]); SMHR_USER_LOG.USERLOG_IP = Convert.ToString(ipaddress); SMHR_USER_LOG.USERLOG_LOGSTART = DateTime.Now; SMHR_USER_LOG.USERLOG_CREATEDBY = Convert.ToInt32(Session["Userid"]); SMHR_USER_LOG.USERLOG_CREATEDDATE = DateTime.Now; Boolean saveUserLog = BLL.GET_USER_LOG_INSERT(SMHR_USER_LOG); //userLogEngine.SaveUserLog(SMHRUserLog); DataTable userLog = BLL.GET_LATEST_USER_LOG_ID(SMHR_USER_LOG); Session["UserlogID"] = Convert.ToInt32(userLog.Rows[0]["MAX_ID"]); }