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)); + } + } + } +}