private void btnUpdate_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { int RowHandle = 0; if (selection.SelectedCount == 0) { MessageBox.Show("请先选择需要修改的记录"); } else if (selection.SelectedCount > 1) { MessageBox.Show("一次只能修改一条记录,请重新选择!"); } else { int RowIndex = selection.GetSelectedRowIndex(0); RowHandle = gridView1.GetRowHandle(RowIndex); structStaff sStaff = new structStaff(); sStaff.strOPERATORID = gridView1.GetRowCellDisplayText(RowHandle, colOPERATORID); sStaff.strOPERATORNO = gridView1.GetRowCellDisplayText(RowHandle, colOPERATORNO); sStaff.strOPERATORNAME = gridView1.GetRowCellDisplayText(RowHandle, colOPERATORNAME); sStaff.strFASTCODE = gridView1.GetRowCellDisplayText(RowHandle, colFASTCODE); sStaff.strSEX = gridView1.GetRowCellDisplayText(RowHandle, colSEX); sStaff.strDEPARTID = gridView1.GetRowCellDisplayText(RowHandle, colDEPARTID); sStaff.strBIRTHDAY = gridView1.GetRowCellDisplayText(RowHandle, colBIRTHDAY); sStaff.strTELEPHONE = gridView1.GetRowCellDisplayText(RowHandle, colTELEPHONE); sStaff.strCONTACTADDRESS = gridView1.GetRowCellDisplayText(RowHandle, colCONTACTADDRESS); sStaff.strMOBILETELEPHONE = gridView1.GetRowCellDisplayText(RowHandle, colMOBILETELEPHONE); sStaff.strEMAIL = gridView1.GetRowCellDisplayText(RowHandle, colEMAIL); FrmStaffMtChild frmUpdate = new FrmStaffMtChild(sStaff); frmUpdate.Text = "修改员工"; frmUpdate.ShowDialog(); selection.ClearSelection(); unitOfWork1.DropIdentityMap(); xpServerCollectionSource1.Reload(); gridView1.FocusedRowHandle = RowHandle; } }
private void btnAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { structStaff sStaff = new structStaff(); FrmStaffMtChild frmAdd = new FrmStaffMtChild(sStaff); frmAdd.Text = "增加员工"; frmAdd.ShowDialog(); selection.ClearSelection(); unitOfWork1.DropIdentityMap(); xpServerCollectionSource1.Reload(); }