public static void 作废支票(ArchiveOperationForm masterForm) { 支票 entity = masterForm.DisplayManager.CurrentItem as 支票; if (entity == null) { return; } if (entity.Submitted) { ServiceProvider.GetService <IMessageBox>().ShowWarning("此支票不能作废!"); return; } if (entity.是否作废) { ServiceProvider.GetService <IMessageBox>().ShowWarning("此支票已作废!"); return; } masterForm.DoEdit(); entity.是否作废 = true; masterForm.ControlManager.OnCurrentItemChanged(); }
public static void 撤销操作支票(ArchiveOperationForm masterForm) { 支票 entity = masterForm.DisplayManager.CurrentItem as 支票; if (entity == null) { return; } if (!entity.Submitted && !entity.是否作废) { ServiceProvider.GetService <IMessageBox>().ShowWarning("此支票未进行操作!"); return; } if (entity.Submitted && !string.IsNullOrEmpty(entity.支付凭证号)) { ServiceProvider.GetService <IMessageBox>().ShowWarning("此支票已支付!"); return; } if (!MessageForm.ShowYesNo("是否确认撤销?", "确认")) { return; } Dictionary <string, object> saved = new Dictionary <string, object>(); saved["日期"] = entity.日期; if (entity is 转账支票) { saved["入款账户编号"] = (entity as 转账支票).入款账户编号; } entity.Submitted = false; entity.是否作废 = false; entity.日期 = null; masterForm.ControlManager.Dao.Update(entity); // 不能采用这种方式,EndEdit()会把界面上的值保存到Entity中 //masterForm.ControlManager.EditCurrent(); //masterForm.ControlManager.EndEdit(); masterForm.ControlManager.OnCurrentItemChanged(); }