protected void On_ModifyCourseBtn_Clicked(object sender, EventArgs e) { //get selected course var seletedCourse = GetSelectedCourse(); if (seletedCourse == null) { return; } //show course info dialog var dlg = new CourseInfoDlg(seletedCourse); if (dlg.Run() == (int)ResponseType.Ok) { DB.UpdateCourse(dlg.course); dlg.Destroy(); UpdateCourseList(); MessageDialog success = new MessageDialog(this, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok, "\nUpdate course success"); success.Title = "Success"; success.Run(); success.Destroy(); } else { dlg.Destroy(); } }
protected void On_AddCourseBtn_Clicked(object sender, EventArgs e) { var dlg = new CourseInfoDlg(); dlg.Title = "Add Course"; if (dlg.Run() == (int)ResponseType.Ok) { DB.AddCourse(dlg.course); dlg.Destroy(); UpdateCourseList(); MessageDialog success = new MessageDialog(this, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok, "\nAdd course success"); success.Title = "Success"; success.Run(); success.Destroy(); } else { dlg.Destroy(); } }