예제 #1
0
        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();
            }
        }
예제 #2
0
        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();
            }
        }