private void InitAttachmentGrid() { var eqptAttachmentBll = new BLL.EqptAttachment(); _eqptAttachments = eqptAttachmentBll.GetModelListWithoutAttachment(String.Format("SmId = {0} and LayerName = '{1}'", _smId, _layerInfo.LayerName)); gc_Attachment.DataSource = _eqptAttachments; }
private void btn_DeleteAttachment_Click(object sender, EventArgs e) { if (gv_Attachment.FocusedRowHandle < 0) { XtraMessageBox.Show("当前未选中附件!", "提示"); return; } var attachmentId = Convert.ToInt32(gv_Attachment.GetFocusedRowCellValue("Id")); if (XtraMessageBox.Show("删除后不可恢复,您确定要删除?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { var eqptAttachmentBll = new BLL.EqptAttachment(); if (eqptAttachmentBll.Delete(attachmentId)) { var eqptAttachment = _eqptAttachments.First(m => m.Id == attachmentId); _eqptAttachments.Remove(eqptAttachment); gc_Attachment.RefreshDataSource(); } } }
private void InitAttachmentGrid() { var eqptAttachmentBll = new BLL.EqptAttachment(); _eqptAttachments = eqptAttachmentBll.GetModelListWithoutAttachment(String.Format("SmId = {0} and LayerName = '{1}'", _smId, _layerInfo.LayerName)); gc_Attachment.DataSource = _eqptAttachments; }
private void btn_DeleteAttachment_Click(object sender, EventArgs e) { if (gv_Attachment.FocusedRowHandle < 0) { XtraMessageBox.Show("当前未选中附件!", "提示"); return; } var attachmentId = Convert.ToInt32(gv_Attachment.GetFocusedRowCellValue("Id")); if (XtraMessageBox.Show("删除后不可恢复,您确定要删除?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { var eqptAttachmentBll = new BLL.EqptAttachment(); if (eqptAttachmentBll.Delete(attachmentId)) { var eqptAttachment = _eqptAttachments.First(m => m.Id == attachmentId); _eqptAttachments.Remove(eqptAttachment); gc_Attachment.RefreshDataSource(); } } }