public AuditoriumEvent(string name, Calendar calendar, Ring ring, Auditorium auditorium) { Name = name; Calendar = calendar; Ring = ring; Auditorium = auditorium; }
public AuditoriumView(Auditorium auditorium) { AuditoriumId = auditorium.AuditoriumId; Name = auditorium.Name; if (auditorium.Building != null) { Buildingname = auditorium.Building.Name; } }
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(); }
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; } }
public MySqlAuditorium(Auditorium auditorium) { AuditoriumId = auditorium.AuditoriumId; Name = auditorium.Name; BuildingId = auditorium.Building.BuildingId; }
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(); } }