private void dgvDetail_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e) { if (e.Column.FieldName == "row4") { object objectDictID = dgvDetail.GetRowCellValue(e.RowHandle, "row3"); if (objectDictID != null) { string dictID = objectDictID.ToString(); //删除 if (MessageBox.Show("真的要删除吗?", "提示", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { ConnectionManager.Context.table("NormalUnitDict").where ("DID='" + dictID + "'").delete(); loadData(); } } } else if (e.Column.FieldName == "row5") { object objectDictID = dgvDetail.GetRowCellValue(e.RowHandle, "row3"); if (objectDictID != null) { string dictID = objectDictID.ToString(); //编辑 DB.Entitys.NormalUnitDict nuddd = ConnectionManager.Context.table("NormalUnitDict").where ("DID='" + dictID + "'").select("*").getItem <DB.Entitys.NormalUnitDict>(new DB.Entitys.NormalUnitDict()); if (!string.IsNullOrEmpty(nuddd.DID)) { AddOrUpdateNormalUnit unuForm = new AddOrUpdateNormalUnit(nuddd); if (unuForm.ShowDialog() == DialogResult.OK) { loadData(); } } } } }
private void btnAddNormalUnit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { AddOrUpdateNormalUnit aunu = new AddOrUpdateNormalUnit(null); if (aunu.ShowDialog() == DialogResult.OK) { loadData(); } }