public static Order AddNewOrder(TheatersChairs OrderInfo, int EventID, DateTime OrderDate, int TotalChairOrdered)
 {
     Order o = new Order();
     o.CartId = OrderInfo.cartID;
     o.EventID = EventID;
     o.OrderDate = OrderDate;
     o.TimeScreeningID = OrderInfo.TimeScreening.TimeScreeningID;
     o.TotalChairsOrdered = TotalChairOrdered;
     return o;
 }
        //ctor(order)
        public EventsData(Event _Event, bool OrderExist)
        {
            if (_Event != null)
            {
                try
                {
                    //first get the full implement
                    evnt = _Event;
                    cartID = evnt.cartID;

                    // get the movieShowTime via Event.MovieShowTimeID
                    movieShowTime = db.MovieShowTimes.Find(Event.MovieShowTimeID);

                    movie = MovieShowTime.Movie;

                    // get the theatres item
                    theaters = (from theat in db.Theaters
                                where theat.MovieTheatersID ==
                                (from rw in db.Rows
                                 where rw.RowsID ==
                                 (from hc in db.HallChairs
                                  where hc.HallChairsID ==
                                  (from co in db.ChairsOrderd
                                   where co.EventID == Event.EventID
                                   select co).FirstOrDefault().HallChairID
                                  select hc).FirstOrDefault().RowID
                                 select rw).FirstOrDefault().TheatersID
                                select theat).SingleOrDefault();

                    // get the TimeScreening item
                    timeScreening = (from ts in db.TimeScreening
                                     where _Event.MovieShowTimeID == ts.MovieShowTimeID && ts.MovieTheatersID == theaters.MovieTheatersID
                                     select ts).SingleOrDefault();

                    ChairsNumber = new List<string>();
                    int[] ChairOrderID = Event.ChairsOrderds.Where(x=>x.EventID== Event.EventID).Select(x=>x.ChairsOrderdiD).ToArray();

                    ChairsNumber.AddRange(EcomLogic.GetChairNumbers(ChairOrderID,Event.ChairsOrderds));
                    getTotalChairsOrdered();

                    OrderDate = DateTime.Now;

                    // if there is a order all fine.. if no , go to catch and make one.
                    try
                    {
                        if (OrderExist == true)
                        {
                            order = (from odr in db.Orders
                                     where odr.EventID == evnt.EventID && odr.CartId == cartID
                                     select odr).SingleOrDefault();
                        }

                    }
                    catch (Exception)
                    {

                        ifEror = "Error by adding the Order.";
                    }

                    ifEror = null;
                }
                catch (Exception ex)
                {
                    ifEror = "There is an error while adding detial's."+ex.Message;
                }
            }
        }