Пример #1
0
 private void BtnSave_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(txtNotes.Text))
     {
         SupervisorNotesModel editSupervisorNotes = new SupervisorNotesModel()
         {
             Date     = dateTimePicker1.Value.Date,
             Comments = txtNotes.Text
         };
         PrepAndPaintDB.SaveSuperVisorNotes(editSupervisorNotes);
         this.DialogResult = DialogResult.OK;
         Close();
     }
     else
     {
         MessageBox.Show("You didn't enter anything", "Error");
     }
 }
Пример #2
0
 private void DeleteNote()
 {
     if (dataGridView1.SelectedRows.Count > 0)
     {
         int selectedRowIndex = dataGridView1.SelectedCells[0].RowIndex;
         int Id = (int)dataGridView1.Rows[selectedRowIndex].Cells[0].Value;
         if (MessageBox.Show("Are you sure you wanted to delete this entry?", "Confirm delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             SupervisorNotesModel deleteId = new SupervisorNotesModel()
             {
                 Id = Id
             };
             PrepAndPaintDB.DeleteSuperVisorNote(deleteId);
         }
         GetInfo();
     }
     else
     {
         MessageBox.Show("Sorry you need to select an entry to delete!", "Error", MessageBoxButtons.OK);
     }
 }