Skip to content

Commit

Permalink
Update rooms for sessions form
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimuthu7 committed Oct 2, 2020
1 parent 8f42820 commit a755e00
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions TimeTable_App/Forms/SubForms/RoomsforSessionSubForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,19 @@ private void btnInsert_Click(object sender, EventArgs e)
{
RoomsforSessionModel saveObj = saveResult.Data;
MessageBox.Show("Rooms With Session : " + saveObj.Room + "-" + saveObj.SessionId + " Sucessfully Saved!", "Save Message", MessageBoxButtons.OK, MessageBoxIcon.Information);

//Added by Dimuthu
int intSelectSessCode = Int32.Parse(comboBox1.SelectedItem.ToString());
string strSelectRoom = (string)selected;
using (var db = new TimeTableDbContext())
{
var tm = db.Sessions.Where(f => f.SessionCode == intSelectSessCode).ToList();
tm.ForEach(a => {
a.Room = strSelectRoom;
});
db.SaveChanges();
}

initForm();
}
else
Expand Down Expand Up @@ -170,6 +183,19 @@ private void btnDelete_Click(object sender, EventArgs e)
{
RoomsforSessionModel deleteObj = deleteResult.Data;
MessageBox.Show("Room " + (string)selected + " Sucessfully Deleted!", "Delete Message", MessageBoxButtons.OK, MessageBoxIcon.Information);

//Added by Dimuthu
int intSelectSessCode = Int32.Parse(comboBox1.SelectedItem.ToString());
string strSelectRoom = (string)selected;
using (var db = new TimeTableDbContext())
{
var tm = db.Sessions.Where(f => f.SessionCode == intSelectSessCode).ToList();
tm.ForEach(a => {
a.Room = "";
});
db.SaveChanges();
}

initForm();
}
else
Expand Down

0 comments on commit a755e00

Please sign in to comment.