public void SaveHall(Model.Hall record)
        {
            using (Ringsted1Entities111 context = new Ringsted1Entities111())
            {
                Hall query = (from o in context.Halls
                              where o.Name == record.Name
                              select o).FirstOrDefault();

                //hall wasn't found in the database - create one
                if (query == null)
                {
                    Hall hallE = new Hall();
                    hallE.Name = record.Name;
                    context.Halls.Add(hallE);
                    try
                    {
                        context.SaveChanges();
                    }
                    catch (Exception ex)
                    {
                        LoggerSingleton.Instance.Log("An exception occurred when attempting to save a new hall to the database: ", ex);
                    }
                }
            }
        }
Exemple #2
0
 public void Init()
 {
     _bassin     = new Model.Bassin();
     _hall       = new Model.Hall();
     _silo       = new Model.Silo();
     _sensor     = new Model.Sensor();
     _sensorData = new Model.SensorData();
     _trigger    = new Model.Trigger();
     _warning    = new Model.Warning();
     _hall.Name  = "Test";
 }
 public List <Model.Hall> FindHalls(int mId)
 {
     using (PersonServiceClient proxy = new PersonServiceClient())
     {
         List <Hall>       halls = proxy.FindHalls(mId);
         List <Model.Hall> mH    = new List <Model.Hall>();
         foreach (Hall tempH in halls)
         {
             Model.Hall h = new Model.Hall();
             h.HallId   = tempH.HallId;
             h.MovieId  = tempH.MovieId;
             h.ShowDate = tempH.ShowDate;
             h.ShowTime = tempH.ShowTime;
             mH.Add(h);
         }
         return(mH);
     }
 }
        internal List <Model.Hall> FindHalls(int movieId)
        {
            using (PersonServiceClient proxy = new PersonServiceClient())
            {
                List <Model.Hall> halls = new List <Model.Hall>();
                List <Hall>       hS    = proxy.FindHalls(movieId);
                foreach (Hall h in hS)
                {
                    Model.Hall hall = new Model.Hall();
                    hall.HallId   = h.HallId;
                    hall.MovieId  = h.MovieId;
                    hall.ShowTime = h.ShowTime;

                    halls.Add(hall);
                }

                return(halls);
            }
        }