Пример #1
0
        private void DeleteLeave()
        {
            if (leafBindingSource?.Current == null)
            {
                return;
            }
            var dResult = MessageBox.Show(@"Delete current record? - Leave", @"Delete", MessageBoxButtons.YesNo,
                                          MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

            if (dResult != DialogResult.Yes)
            {
                return;
            }
            if (LeaveManager.Delete(((Leaf)leafBindingSource.Current).LeaveId))
            {
                MessageBox.Show(@"Record was deleted successfully.", @"Delete", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                leafBindingSource.RemoveCurrent();
            }
            else
            {
                MessageBox.Show(@"Error on delete operation.", @"Delete", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                leafDataGridView.Focus();
            }
        }