From 87f40913aa562b7555c4860a1c1dda1e159310c3 Mon Sep 17 00:00:00 2001 From: wushukun <18860363876@163.com> Date: Wed, 17 Jan 2018 09:49:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TypeIoc/CustomerApplyBeforeSaveTypeIoc.cs | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 BWP.B3_YunKen/TypeIoc/CustomerApplyBeforeSaveTypeIoc.cs diff --git a/BWP.B3_YunKen/TypeIoc/CustomerApplyBeforeSaveTypeIoc.cs b/BWP.B3_YunKen/TypeIoc/CustomerApplyBeforeSaveTypeIoc.cs new file mode 100644 index 0000000..57fd9c4 --- /dev/null +++ b/BWP.B3_YunKen/TypeIoc/CustomerApplyBeforeSaveTypeIoc.cs @@ -0,0 +1,32 @@ +using BWP.B3Frameworks; +using BWP.B3Sale.BL; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using BWP.B3Sale.BO; +using Forks.EnterpriseServices.BusinessInterfaces; +using Forks.EnterpriseServices.DomainObjects2.DQuery; +using Forks.EnterpriseServices.DomainObjects2; + +namespace BWP.B3_YunKen.TypeIoc +{ + + [TypeIOC(typeof(CustomerApplyBL), typeof(CustomerApplyBL.BaseBLIOCs.BeforeSave))] + class CustomerApplyBeforeSaveTypeIoc : CustomerApplyBL.BaseBLIOCs.BeforeSave + { + public void Invoke(IDmoContext context, CustomerApply dmo) + { + var alias = new JoinAlias("cus", typeof(Customer)); + var query = new DQueryDom(alias); + query.Where.Conditions.Add(DQCondition.EQ("Stopped", false)); + query.Where.Conditions.Add(DQCondition.EQ("Name", dmo.Name)); + query.Columns.Add(DQSelectColumn.Field("ID")); + var re = context.Session.ExecuteScalar(query); + if (re != null) + { + throw new Exception(string.Format("客户名称{0}和客户档案中单据ID为{1}的一致", dmo.Name, re)); + } + } + } +}