コード例 #1
0
        private void Delete()
        {
            try
            {
                using (new HourGlass())
                {
                    if (Utilities.GetCurrentRow(dgView, 0).Length <= 0)
                    {
                        return;
                    }

                    if (
                        MessageBox.Show(Resources.Do_you_want_to_delete_this_record, Resources.Delete,
                                        MessageBoxButtons.YesNo,
                                        MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) != DialogResult.Yes)
                    {
                        return;
                    }

                    if (Listing.Delete(Utilities.GetCurrentRow(dgView, 0)))
                    {
                        MessageBox.Show(Resources.Data_Deleted, Resources.Saved, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        LoadAll();
                    }
                    else
                    {
                        MessageBox.Show(Resources.Please_try_again, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageClass.ShowError(ex.Message, this.Text);
            }
        }