示例#1
0
        private void SelectionDeclineButton_Click(object sender, EventArgs e)
        {
            if (New) //reset
            {
                //reset
                SetSelection(new SubjectSelection());

                //reset all lecturers
                for (int i = 0; i < LecturersGridView.Rows.Count; ++i)
                {
                    if (LecturersGridView["Select", i].Value != null &&
                        (bool)LecturersGridView["Select", i].Value)
                    {
                        LecturersGridView["Select", i].Value = false;
                    }
                }
                checked_lecturers_id.Clear();

                TimetableControl.ResetLectureTimes();
            }
            else if (CustomMessages.YesNoDelete(this))
            {
                Deleted = controller.Delete(selection);
                Close();
            }
        }
        private void deleteLecturerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!CustomMessages.YesNoDelete(this))
            {
                return;
            }

            int index = LecturersGridView.CurrentCell.RowIndex,
                id    = (int)LecturersGridView["Id", index].Value;

            //delete from database
            new LecturerController().Delete(new Lecturer()
            {
                Id   = id,
                Name = LecturersGridView["Name", index].Value.ToString()
            });

            //remove from datatable
            foreach (DataRow row in all_lecturers.Rows)
            {
                if (Convert.ToInt32(row["Id"]) == id)
                {
                    all_lecturers.Rows.Remove(row);
                    break;
                }
            }
        }
        private void DeclineButton_Click(object sender, EventArgs e)
        {
            if (New)
            {
                NameTextbox.Text = "";
            }
            else if (CustomMessages.YesNoDelete(this))
            {
                Deleted = controller.Delete(lecturer);

                Close();
            }
        }
 private void DeclineButton_Click(object sender, EventArgs e)
 {
     if (New)
     {
         NameTextbox.Text     = "";
         CodenameTextbox.Text = "";
     }
     else if (CustomMessages.YesNoDelete(this))
     {
         Deleted = controller.Delete(subject);
         if (!Deleted)
         {
             CustomMessages.DeleteFail(this, "subject");
         }
         Close();
     }
 }
 private void DeclineButton_Click(object sender, EventArgs e)
 {
     if (New)
     {
         BuildingTextbox.Text     = "";
         FloorNumericUpdown.Value = 0;
         RoomTextbox.Text         = "";
     }
     else if (CustomMessages.YesNoDelete(this))
     {
         Deleted = controller.Delete(hall);
         if (!Deleted)
         {
             CustomMessages.DeleteFail(this, "lecture hall");
         }
         Close();
     }
 }