예제 #1
0
 private void grcCadidate_EmbeddedNavigator_ButtonClick(object sender, NavigatorButtonClickEventArgs e)
 {
     if (e.Button.ButtonType == DevExpress.XtraEditors.NavigatorButtonType.Append)
     {
         e.Handled = true;
         frmAddCadidate frm = new frmAddCadidate();
         frm.ShowDialog();
         LoadCandidate();
     }
     if (e.Button.ButtonType == NavigatorButtonType.Remove)
     {
         if (XtraMessageBox.Show("Are you sure you want to delete ?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
         {
             e.Handled = true;
             int    IDCandidates = int.Parse(grvCandidate.GetFocusedRowCellValue(colID).ToString());
             string res          = mdCandidate.Delete(IDCandidates);
             if (res != "OK")
             {
                 XtraMessageBox.Show(res);
             }
             else
             {
                 XtraMessageBox.Show("Deleted ID = " + IDCandidates.ToString());
                 LoadCandidate();
             }
         }
         LoadCandidate();
     }
 }
예제 #2
0
        private void grcCadidate_DoubleClick(object sender, EventArgs e)
        {
            if (grvCandidate.FocusedRowHandle < 0)
            {
                return;
            }
            int            IDCandidates = int.Parse(grvCandidate.GetFocusedRowCellValue(colID).ToString());
            frmAddCadidate frm          = new frmAddCadidate(IDCandidates);

            frm.ShowDialog();
            LoadCandidate();
        }