|
|
|
@ -0,0 +1,37 @@ |
|
|
|
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 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+" 上"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |