public static void Remove_ActiveSession(string userName) { using (SessionsDataDataContext dc = new SessionsDataDataContext(SessionMannager.SessionsConnectionString)) { ActiveSession a = dc.ActiveSessions.Where(s => s.UserName.Equals(userName)).FirstOrDefault <ActiveSession>(); if (a != null) { SessionHistory wSessionHistory = new SessionHistory(); wSessionHistory.UserName = a.UserName; wSessionHistory.SessionID = a.SessionID; wSessionHistory.StatusDate = a.LoggedInDate; wSessionHistory.Status = "Log_In"; dc.SessionHistories.InsertOnSubmit(wSessionHistory); wSessionHistory = new SessionHistory(); wSessionHistory.UserName = a.UserName; wSessionHistory.SessionID = a.SessionID; wSessionHistory.StatusDate = DateTime.Now; wSessionHistory.Status = "Log_Out"; dc.SessionHistories.InsertOnSubmit(wSessionHistory); dc.ActiveSessions.DeleteOnSubmit(a); dc.SubmitChanges(); } } }
public static void Reg_ActiveSession(string sessionId, string userName) { using (SessionsDataDataContext dc = new SessionsDataDataContext(SessionMannager.SessionsConnectionString)) { ActiveSession a = new ActiveSession(); a.UserName = userName; a.SessionID = sessionId; a.LoggedInDate = DateTime.Now; dc.ActiveSessions.InsertOnSubmit(a); dc.SubmitChanges(); } }
partial void DeleteActiveSession(ActiveSession instance);
partial void UpdateActiveSession(ActiveSession instance);
partial void InsertActiveSession(ActiveSession instance);