From d323c119c2cd638758f96c50ddcec31cc7f51822 Mon Sep 17 00:00:00 2001 From: duanluohua Date: Thu, 30 Nov 2017 19:10:16 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9C=80=E6=B1=82=E5=8D=95No.137533=EF=BC=8C?= =?UTF-8?q?=E3=80=90=E5=8F=B8=E6=9C=BA=E6=A1=A3=E6=A1=88=E3=80=91=E5=8F=96?= =?UTF-8?q?=E6=B6=88=E5=90=8D=E7=A7=B0=E4=B8=8D=E8=83=BD=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E9=80=BB=E8=BE=91=EF=BC=8C=E6=94=B9=E4=B8=BA=E8=BA=AB=E4=BB=BD?= =?UTF-8?q?=E8=AF=81=E5=8F=B7=E4=B8=8D=E8=83=BD=E9=87=8D=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BWP.B3_YunKen.Web/PluginClass.cs | 2 +- .../TypeIoc/DriverBeforeSaveTypeIoc.cs | 34 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 BWP.B3_YunKen/TypeIoc/DriverBeforeSaveTypeIoc.cs diff --git a/BWP.B3_YunKen.Web/PluginClass.cs b/BWP.B3_YunKen.Web/PluginClass.cs index 045615e..ef4e7f9 100644 --- a/BWP.B3_YunKen.Web/PluginClass.cs +++ b/BWP.B3_YunKen.Web/PluginClass.cs @@ -12,7 +12,7 @@ namespace BWP.B3_YunKen.Web GlobalFlags.On(B3SaleConsts.Flags.RecordLastSaleOutStoreDate); GlobalFlags.On(B3SaleConsts.Flags.IsYunKen); - + GlobalFlags.On(B3SaleConsts.Flags.DriverNameAllowSame); GlobalFlags.On(B3UnitedInfosConsts.GlobalFlags.库存支持品牌项); } diff --git a/BWP.B3_YunKen/TypeIoc/DriverBeforeSaveTypeIoc.cs b/BWP.B3_YunKen/TypeIoc/DriverBeforeSaveTypeIoc.cs new file mode 100644 index 0000000..9a18038 --- /dev/null +++ b/BWP.B3_YunKen/TypeIoc/DriverBeforeSaveTypeIoc.cs @@ -0,0 +1,34 @@ +using BWP.B3Sale.BL; +using System; +using BWP.B3Sale.BO; +using Forks.EnterpriseServices.BusinessInterfaces; +using BWP.B3Frameworks; +using Forks.EnterpriseServices.DomainObjects2.DQuery; +using Forks.EnterpriseServices.DomainObjects2; + +namespace BWP.B3_YunKen.TypeIocs +{ + [TypeIOC(typeof(DriverBL), typeof(DriverBL.BaseBLIOCs.BeforeSave))] + public class DriverBeforeSaveTypeIoc : DriverBL.BaseBLIOCs.BeforeSave + { + public void Invoke(IDmoContext context, Driver dmo) + { + CheckNotAllowSameName(context, dmo); + } + + private void CheckNotAllowSameName(IDmoContext context, Driver dmo) + { + var query = new DQueryDom(new JoinAlias(typeof(Driver))); + query.Where.Conditions.Add(DQCondition.EQ("IDCard", dmo.IDCard)); + query.Where.Conditions.Add(DQCondition.InEQ("ID", dmo.ID)); + + query.Columns.Add(DQSelectColumn.Field("ID")); + + var id = context.Session.ExecuteScalar(query); + if (id != null) + { + throw new Exception("身份证号:" + dmo.IDCard + " 已经存在单号:" + id + " 上"); + } + } + } +} \ No newline at end of file