Пример #1
0
 public void UpdateUserLogOutDetails(UpdateUserLogOutDetailViewModel model)
 {
     try
     {
         db.UserLoginLogOutDetails.Single(l => l.LoginDetailRowID == model.LoginDetailRowID && l.LoginStatus == 1).LogoutTime = model.LogoutTime;
         db.SaveChanges();
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #2
0
        //Common Method
        private void UpdateLogOutDetails()
        {
            try
            {
                DictionaryEntry dictionaryEntry = new DictionaryEntry();
                DictionaryEntry dictionaryEntry1;

                UpdateUserLogOutDetailViewModel model = new UpdateUserLogOutDetailViewModel();
                model.LoginDetailRowID = Convert.ToInt32(Session["LoginDetailRowID"]);
                model.LogoutTime       = DateTime.Now;

                repoAccount.UpdateUserLogOutDetails(model);

                FormsAuthentication.SignOut();

                this.Session.Clear();
                this.Session.Abandon();

                // Clear authentication cookie.
                HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, "");
                cookie.Expires = DateTime.Now.AddYears(-1);
                Response.Cookies.Add(cookie);

                IDictionaryEnumerator enumerator = HttpContext.Cache.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    object current = enumerator.Current;
                    if (current != null)
                    {
                        dictionaryEntry1 = (DictionaryEntry)current;
                    }
                    else
                    {
                        dictionaryEntry1 = dictionaryEntry;
                    }
                    DictionaryEntry dictionaryEntry2 = dictionaryEntry1;
                    HttpContext.Cache.Remove(dictionaryEntry2.Key.ToString());
                }

                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                Response.Cache.SetNoServerCaching();
                Response.Cache.SetNoStore();
            }
            catch (Exception Ex)
            {
                clsCommonMethods.ErrorLog(Server.MapPath("~\\ErrorLogs\\Logfiles"), Ex.Message, Ex.StackTrace);
                throw Ex;
            }
        }