private void btnSave_Click(object sender, RoutedEventArgs e) { if (!ValidationManager.Validate(this.LayoutRoot)) { return; } if (string.IsNullOrEmpty(_vm.BrandSysNo)) { CurrentWindow.Alert("错误", "请选择一个品牌!", MessageType.Error); return; } if (string.IsNullOrEmpty(_vm.C3SysNo)) { CurrentWindow.Alert("错误", "请选择一个3级类别!", MessageType.Error); return; } CurrentWindow.Confirm("提示", "确定要进行保存操作吗?", (obj, args) => { if (args.DialogResult == DialogResultType.OK) { ProductRingDayInfo entity = EntityConverter <AdventProductsInfoVM, ProductRingDayInfo> .Convert(_vm); if (isAddAction) { _facade.InsertProductRingInfo(entity, (obj2, args2) => { if (args2.FaultsHandle()) { return; } CurrentWindow.Alert("提示", "创建成功!", MessageType.Information, (obj3, args3) => { this.Dialog.ResultArgs.DialogResult = DialogResultType.OK; this.Dialog.Close(true); }); }); } else { _facade.UpdateProductRingInfo(entity, (obj2, args2) => { if (args2.FaultsHandle()) { return; } CurrentWindow.Alert("提示", "保存成功!", MessageType.Information, (obj3, args3) => { this.Dialog.ResultArgs.DialogResult = DialogResultType.OK; this.Dialog.Close(true); }); }); } } }); }
/// <summary> /// 弹出待确认对话框 /// </summary> /// <param name="title">标题</param> /// <param name="content">内容</param> /// <param name="OKHandler">点击OK按钮的回调</param> /// <param name="CancelHandler">点击Cancel按钮的回调</param> protected void AlertConfirmDialog(string title, string content, Action <object> OKHandler, Action <object> CancelHandler) { CurrentWindow.Confirm(title, content, OKHandler, CancelHandler); }
/// <summary> /// 弹出待确认对话框 /// </summary> /// <param name="content">内容</param> /// <param name="OKHandler">点击OK按钮的回调</param>> protected void AlertConfirmDialog(string content, Action <object> OKHandler) { CurrentWindow.Confirm(content, OKHandler); }