public AuditoriumEvent(string name, Calendar calendar, Ring ring, Auditorium auditorium)
 {
     Name = name;
     Calendar = calendar;
     Ring = ring;
     Auditorium = auditorium;
 }
示例#2
0
 public AuditoriumView(Auditorium auditorium)
 {
     AuditoriumId = auditorium.AuditoriumId;
     Name = auditorium.Name;
     if (auditorium.Building != null)
     {
         Buildingname = auditorium.Building.Name;
     }
 }
示例#3
0
        private void add_Click(object sender, EventArgs e)
        {
            if (_repo.FindAuditorium(AudName.Text) != null)
            {
                MessageBox.Show("Такая аудитория уже есть.");
                return;
            }

            var newAuditorium = new Auditorium { Name = AudName.Text };
            _repo.AddAuditorium(newAuditorium);

            RefreshView();
        }
示例#4
0
        private void add_Click(object sender, EventArgs e)
        {
            if (_repo.Auditoriums.Find(AudName.Text) != null)
            {
                MessageBox.Show("Такая аудитория уже есть.");
                return;
            }

            var building = _repo.Buildings.GetBuilding((int)BuildingsList.SelectedValue);

            var newAuditorium = new Auditorium { Name = AudName.Text, Building = building };
            _repo.Auditoriums.Add(newAuditorium);

            RefreshView();
        }
        public void UpdateAuditorium(Auditorium aud)
        {
            using (var context = new ScheduleContext(ConnectionString))
            {
                var curAud = context.Auditoriums.FirstOrDefault(a => a.AuditoriumId == aud.AuditoriumId);

                curAud.Name = aud.Name;

                context.SaveChanges();
            }
        }
        public Auditorium AddAuditorium(Auditorium aud)
        {
            using (var context = new ScheduleContext(ConnectionString))
            {
                aud.AuditoriumId = 0;

                context.Auditoriums.Add(aud);
                context.SaveChanges();

                return aud;
            }
        }
示例#7
0
 public MySqlAuditorium(Auditorium auditorium)
 {
     AuditoriumId = auditorium.AuditoriumId;
     Name = auditorium.Name;
     BuildingId = auditorium.Building.BuildingId;
 }
示例#8
0
        private void forceDeleteWithReplace_Click(object sender, EventArgs e)
        {
            if (AuditoriumListView.SelectedCells.Count > 0)
            {
                var Aud = ((List<Auditorium>)AuditoriumListView.DataSource)[AuditoriumListView.SelectedCells[0].RowIndex];

                var replaceAud = _repo.FindAuditorium(newAuditorium.Text);

                if (replaceAud == null)
                {
                    replaceAud = new Auditorium { Name = newAuditorium.Text };
                    _repo.AddAuditorium(replaceAud);
                }

                var audLessons = _repo.GetFiltredLessons(l => l.Auditorium.AuditoriumId == Aud.AuditoriumId);

                if (audLessons.Count > 0)
                {
                    foreach (var lesson in audLessons)
                    {
                        lesson.Auditorium = replaceAud;
                        _repo.UpdateLesson(lesson);
                    }
                }

                _repo.RemoveAuditorium(Aud.AuditoriumId);

                RefreshView();
            }
        }