private void button1_Click_1(object sender, EventArgs e) { using (var ctx = new ScheduleContext()) { if (textBox2.Text == "" || textBox3.Text == "") { MessageBox.Show("Missing required input.", "Missing input", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { var classroom = new Classroom { Name = textBox2.Text.ToString(), Capacity = Convert.ToInt32(textBox3.Text) }; ctx.Classrooms.Add(classroom); ctx.SaveChanges(); var len = ctx.Classrooms.ToArray().Length; this.Close(); //Adding ClassroomTimeRestriction foreach (var r in restrictions) { var restriction = new ClassroomTimeRestriction { TimeslotId = r, }; ctx.ClassroomTimeRestrictions.Add(restriction); ctx.SaveChanges(); } } } }
private void button1_Click(object sender, EventArgs e) { using (var ctx = new ScheduleContext()) { if (comboBox1.SelectedItem.ToString() == "" || comboBox2.SelectedItem.ToString() == "" || comboBox3.SelectedItem.ToString() == "") { MessageBox.Show("Missing required input from dropdown menu.", "Missing input", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { int groupId = Convert.ToInt32(comboBox1.SelectedValue); int courseId = Convert.ToInt32(comboBox2.SelectedValue); int professorId = Convert.ToInt32(comboBox3.SelectedValue); if (ctx.GroupCourseProfessors.Any(gcp => gcp.GroupId == groupId && gcp.CourseId == courseId && gcp.ProfessorId == professorId)) { this.Close(); return; } var g = new GroupCourseProfessor { GroupId = groupId, CourseId = courseId, ProfessorId = professorId, Timeslots = Convert.ToInt32(textBox1.Text) }; ctx.GroupCourseProfessors.Add(g); ctx.SaveChanges(); this.Close(); } } }
private void button1_Click(object sender, EventArgs e) { using (var ctx = new ScheduleContext()) { if (textBox2.Text == "") { MessageBox.Show("Missing required input.", "Missing input", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { var prof = new Professor { // Podesi input, automatski increase ID Name = textBox2.Text.ToString(), }; ctx.Professors.Add(prof); ctx.SaveChanges(); //Adding ProfessorTimeRestriction foreach (var r in restrictions) { var restriction = new ProfessorTimeRestriction { ProfessorId = prof.Id, TimeslotId = r, }; ctx.ProfessorTimeRestrictions.Add(restriction); ctx.SaveChanges(); } this.Close(); } } }
private void GroupACD_Load(object sender, EventArgs e) { _context = new ScheduleContext(); _context.Groups.Load(); comboBox1.DataSource = _context.Groups.ToList(); comboBox1.ValueMember = "id"; comboBox1.DisplayMember = "name"; }
public SchedulePreview(int id) { InitializeComponent(); ctx = new ScheduleContext(); dataGridView1.AllowUserToAddRows = false; ctx.Schedules.Load(); s = ctx.Schedules.Find(id); }
private void ProfessorView_Load(object sender, EventArgs e) { professorDataGridView.MultiSelect = false; professorDataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; _context = new ScheduleContext(); _context.Professors.Load(); this.professorBindingSource.DataSource = _context.Professors.Local.ToBindingList(); }
private void GroupView_Load(object sender, EventArgs e) { groupDataGridView.MultiSelect = false; groupDataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; _context = new ScheduleContext(); _context.Groups.Load(); this.groupBindingSource.DataSource = _context.Groups.Local.ToBindingList(); }
private void Form1_Load(object sender, EventArgs e) { scheduleDataGridView.MultiSelect = false; scheduleDataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; _context = new ScheduleContext(); _context.Schedules.Load(); this.scheduleBindingSource.DataSource = _context.Schedules.Local.ToBindingList(); }
private void ClassroomView_Load(object sender, EventArgs e) { classroomDataGridView.MultiSelect = false; classroomDataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; _context = new ScheduleContext(); _context.Classrooms.Load(); this.classroomBindingSource.DataSource = _context.Classrooms.Local.ToBindingList(); }
private void TimeslotsView_Load(object sender, EventArgs e) { timeslotDataGridView.MultiSelect = false; timeslotDataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; _context = new ScheduleContext(); _context.Timeslots.Load(); this.timeslotBindingSource.DataSource = _context.Timeslots.Local.ToBindingList(); }
public void GenerateSchedule() { var ctx = new ScheduleContext(); ctx.GroupCourseProfessors.Load(); ctx.Timeslots.Load(); List<int> timeslots = new List<int>(); foreach (Timeslot t in ctx.Timeslots) { timeslots.Add(t.Id); } }
public void GenerateSchedule() { var ctx = new ScheduleContext(); ctx.GroupCourseProfessors.Load(); ctx.Timeslots.Load(); List <int> timeslots = new List <int>(); foreach (Timeslot t in ctx.Timeslots) { timeslots.Add(t.Id); } }
private void GCP_Load(object sender, EventArgs e) { _context = new ScheduleContext(); _context.Groups.Load(); comboBox1.DataSource = _context.Groups.ToList(); comboBox1.ValueMember = "id"; comboBox1.DisplayMember = "name"; _context.Courses.Load(); comboBox2.DataSource = _context.Courses.ToList(); comboBox2.ValueMember = "id"; comboBox2.DisplayMember = "name"; _context.Professors.Load(); comboBox3.DataSource = _context.Professors.ToList(); comboBox3.ValueMember = "id"; comboBox3.DisplayMember = "name"; }
private void button1_Click(object sender, EventArgs e) { using (var ctx = new ScheduleContext()) { if (textBox2.Text == "") { MessageBox.Show("Missing required input.", "Missing input", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { var schedule = new Schedule { Name = textBox2.Text.ToString(), }; ctx.Schedules.Add(schedule); ctx.SaveChanges(); this.Close(); } } }
private void button1_Click(object sender, EventArgs e) { using (var ctx = new ScheduleContext()) { if (textBox2.Text == "") { MessageBox.Show("Missing required input.", "Missing input", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { var course = new Course { Name = textBox2.Text.ToString(), }; ctx.Courses.Add(course); ctx.SaveChanges(); var len = ctx.Classrooms.ToArray().Length; this.Close(); } } }
private void button1_Click(object sender, EventArgs e) { using (var ctx = new ScheduleContext()) { if (textBox2.Text == "" || textBox3.Text == "") { MessageBox.Show("Missing required input.", "Missing input", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { var group = new Group { Name = textBox2.Text.ToString(), Members = Convert.ToInt32(textBox3.Text.ToString()), ParentId = Convert.ToInt32(comboBox1.SelectedValue), }; ctx.Groups.Add(group); ctx.SaveChanges(); var len = ctx.Groups.ToArray().Length; this.Close(); } } }
private void button1_Click(object sender, EventArgs e) { using (var ctx = new ScheduleContext()) { if (comboBox1.SelectedItem.ToString() == "") { MessageBox.Show("Missing required input from dropdown menu.", "Missing input", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { var timeslot = new Timeslot { From = Convert.ToInt32(textBox2.Text), To = Convert.ToInt32(textBox3.Text), Day = comboBox1.SelectedItem.ToString(), }; ctx.Timeslots.Add(timeslot); ctx.SaveChanges(); var len = ctx.Timeslots.ToArray().Length; this.Close(); } } }