예제 #1
0
 /// <summary>
 /// Add New Order Object To The Session
 /// </summary>
 /// <param name="session"></param>
 /// <param name="registrationPlate"></param>
 /// <param name="start"></param>
 /// <param name="end"></param>
 /// <returns></returns>
 public static bool SetOrder(this HttpSessionStateBase session, string registrationPlate, DateTime start, DateTime end)
 {
     using (CarsData db = new CarsData())
     {
         bool   isValid = db.IsDateValid(start, end, registrationPlate);
         string userId  = session.GetUserID();
         if (isValid && userId != string.Empty)
         {
             session["order"] = new Order()
             {
                 startdate = start,
                 enddate   = end,
                 carid     = registrationPlate,
                 userid    = userId
             };
             return(true);
         }
         return(false);
     }
 }