Ejemplo n.º 1
0
 public static void RegisterSession(SessionItems session)
 {
     try
     {
         HttpContext.Current.Session["Authentication"] = session;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 2
0
 public static void RegisterSession(User user)
 {
     try
     {
         SessionItems session = new SessionItems(user);
         using (var db = new BudgetContext())
         {
             var lastestCostCenter = db.CurrentWorkingCCs
                                     .Where(c => c.EmployeeID == user.EmployeeID)
                                     .OrderByDescending(c => c.ModifiedAt)
                                     .FirstOrDefault();
             if (lastestCostCenter != null)
             {
                 session.WorkingCostCenter = db.CostCenters.Where(c => c.CostCenterID == lastestCostCenter.WorkingCostCenterID).FirstOrDefault();
             }
         }
         HttpContext.Current.Session["Authentication"] = session;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }