Ejemplo n.º 1
0
 private void tbtnDelete_Click(object sender, EventArgs e)
 {
     if (dgJobGrade.Rows.Count > 0)
     {
         if (MessageBox.Show("Warning: \nModifying job grade settings might cause discrepancies on employee's details associated with it. \nIt is advisable to create a new job grade than to modify/delete existing one.\n\nAre you sure to continue?", clsMessageBox.MessageBoxText, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
         {
             JobGrade objJobGrade = new JobGrade();
             objJobGrade.JGCode = dgJobGrade.SelectedRows[0].Cells[0].Value.ToString();
             objJobGrade.Delete();
             this.BindJobGradeList();
         }
     }
 }
        private void btn删除_Click(object sender, EventArgs e)
        {
            ColumnView colView = (ColumnView)gridControl1.MainView;

            if (colView != null)
            {
                if (MessageBox.Show("确实删除当前记录吗?", "删除提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2, 0, false) == DialogResult.Yes)
                {
                    JobGrade currentItem = (JobGrade)colView.GetFocusedRow();
                    currRows.Remove(currentItem);
                    currentItem.Delete();

                    MyHelper.WriteLog(LogType.信息, "删除职等", currentItem.ToString <JobGrade>());

                    gridControl1.RefreshDataSource();
                    MessageBox.Show("删除成功。", "删除提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }