diff --git a/TimeTable_App/Forms/SubForms/RoomsforSessionSubForm.Designer.cs b/TimeTable_App/Forms/SubForms/RoomsforSessionSubForm.Designer.cs index 0e06616..c55d938 100644 --- a/TimeTable_App/Forms/SubForms/RoomsforSessionSubForm.Designer.cs +++ b/TimeTable_App/Forms/SubForms/RoomsforSessionSubForm.Designer.cs @@ -63,7 +63,6 @@ private void InitializeComponent() this.lblCaption.Size = new System.Drawing.Size(254, 30); this.lblCaption.TabIndex = 2; this.lblCaption.Text = "Rooms With Lecturers"; - this.lblCaption.Click += new System.EventHandler(this.lblCaption_Click); // // listBox1 // @@ -147,7 +146,6 @@ private void InitializeComponent() this.label1.Size = new System.Drawing.Size(90, 21); this.label1.TabIndex = 2; this.label1.Text = "All Rooms"; - this.label1.Click += new System.EventHandler(this.label1_Click); // // label2 // diff --git a/TimeTable_App/Forms/SubForms/RoomsforSessionSubForm.cs b/TimeTable_App/Forms/SubForms/RoomsforSessionSubForm.cs index 317e782..75749bd 100644 --- a/TimeTable_App/Forms/SubForms/RoomsforSessionSubForm.cs +++ b/TimeTable_App/Forms/SubForms/RoomsforSessionSubForm.cs @@ -42,7 +42,7 @@ private void initForm() listBox1.Items.Clear(); listBox2.Items.Clear(); comboBox1.Items.Clear(); - ActionResult SesResult = formCtrl._getFormData(typeof(SessionsSubFormModel), "Sessions"); + ActionResult SesResult = formCtrl._getFormData(typeof(SessionsSubFormModel), "Session"); if (SesResult.State) { List SesList = SesResult.Data; @@ -58,12 +58,12 @@ private void updateLecturer() listBox1.Items.Clear(); listBox2.Items.Clear(); - ActionResult roomsWithLecResult = formCtrl._getFormData(typeof(RoomsforSessionModel), "RoomsforaLecturer"); - if (roomsWithLecResult.State) + ActionResult roomsWithSesResult = formCtrl._getFormData(typeof(RoomsforSessionModel), "RoomsforSession"); + if (roomsWithSesResult.State) { - List RoomsWithLecModalList = roomsWithLecResult.Data; - var SelectedRWTList = RoomsWithLecModalList.Where(RWT => RWT.SessionId.ToString() == comboBox1.SelectedItem.ToString()).ToList(); + List RoomsWithSesModalList = roomsWithSesResult.Data; + var SelectedRWTList = RoomsWithSesModalList.Where(RWT => RWT.SessionId.ToString() == comboBox1.SelectedItem.ToString()).ToList(); SelectedRWTList.ForEach(RWT => listBox2.Items.Add(RWT.Room) ); @@ -94,8 +94,8 @@ private void updateLecturer() }); } - dataGridView1.DataSource = roomsWithLecResult.Data; - dataGridView1.Columns[1].HeaderCell.Value = "Lecturer"; + dataGridView1.DataSource = roomsWithSesResult.Data; + dataGridView1.Columns[1].HeaderCell.Value = "Seesion Id"; dataGridView1.Columns[2].HeaderCell.Value = "Room"; dataGridView1.Columns[0].Visible = false; dataGridView1.RowHeadersVisible = false; @@ -110,7 +110,7 @@ private void btnInsert_Click(object sender, EventArgs e) if (selected is null) { - MessageBox.Show("Please Select Lecturer", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show("Please Select Room", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { @@ -124,7 +124,7 @@ private void btnInsert_Click(object sender, EventArgs e) if (saveResult.State) { RoomsforSessionModel saveObj = saveResult.Data; - MessageBox.Show("Rooms With Lecturer : " + saveObj.Room + "-" + saveObj.SessionId + " Sucessfully Saved!", "Save Message", MessageBoxButtons.OK, MessageBoxIcon.Information); + MessageBox.Show("Rooms With Session : " + saveObj.Room + "-" + saveObj.SessionId + " Sucessfully Saved!", "Save Message", MessageBoxButtons.OK, MessageBoxIcon.Information); initForm(); } else @@ -138,7 +138,7 @@ private void btnInsert_Click(object sender, EventArgs e) private void btnDelete_Click(object sender, EventArgs e) { - /*var selected = listBox2.SelectedItem; + var selected = listBox2.SelectedItem; if (selected is null) @@ -149,22 +149,22 @@ private void btnDelete_Click(object sender, EventArgs e) { int id = 0; - ActionResult roomsWithLecResult = formCtrl._getFormData(typeof(RoomsforSessionModel), "RoomsforaLecturer"); - if (roomsWithLecResult.State) + ActionResult roomsWithSesResult = formCtrl._getFormData(typeof(RoomsforSessionModel), "RoomsforSession"); + if (roomsWithSesResult.State) { - foreach (RoomsforSessionModel room in roomsWithLecResult.Data) + foreach (RoomsforSessionModel room in roomsWithSesResult.Data) { - if (room.Room == (string)selected && room.Lecturer == comboBox1.SelectedItem.ToString()) + if (room.Room == (string)selected && room.SessionId.ToString() == comboBox1.SelectedItem.ToString()) { - id = room.RoomWithLectureID; + id = room.RoomWithSessionID; } } } - ActionResult deleteResult = formCtrl._deleteFormData(new RoomsforSessionModel() { RoomWithLectureID = id }); + ActionResult deleteResult = formCtrl._deleteFormData(new RoomsforSessionModel() { RoomWithSessionID = id }); if (deleteResult.State) { @@ -176,7 +176,7 @@ private void btnDelete_Click(object sender, EventArgs e) { MessageBox.Show(deleteResult.Data, "Delete Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } - }*/ + } } @@ -185,15 +185,5 @@ private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) selectedSec = comboBox1.SelectedIndex; updateLecturer(); } - - private void label1_Click(object sender, EventArgs e) - { - - } - - private void lblCaption_Click(object sender, EventArgs e) - { - - } } } \ No newline at end of file diff --git a/TimeTable_App/Global/TimeTableDbContext.cs b/TimeTable_App/Global/TimeTableDbContext.cs index ecf03df..f7742eb 100644 --- a/TimeTable_App/Global/TimeTableDbContext.cs +++ b/TimeTable_App/Global/TimeTableDbContext.cs @@ -53,10 +53,7 @@ public TimeTableDbContext() : base("DBCON") public DbSet RoomsForASubject { get; set; } public DbSet RoomsforaLecturer { get; set; } public DbSet RoomsforaSubGroup { get; set; } - public DbSet RoomsforTimeNotReserved { get; set; } - public DbSet ConsectiveSessions { get; set; } public DbSet RoomsforConsectiveSession { get; set; } public DbSet RoomsforSession { get; set; } - public DbSet Sessions { get; set; } } }