|
|
|
@ -0,0 +1,51 @@ |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Text; |
|
|
|
using BWP.B3Sale.BL; |
|
|
|
using BWP.B3Sale.BO; |
|
|
|
using Forks.EnterpriseServices.BusinessInterfaces; |
|
|
|
using Forks.EnterpriseServices.DomainObjects2; |
|
|
|
using Forks.EnterpriseServices.DomainObjects2.DQuery; |
|
|
|
using TSingSoft.WebPluginFramework.BIPlugins.BLEvents; |
|
|
|
|
|
|
|
namespace BWP.B3_YunKen.BLActions |
|
|
|
{ |
|
|
|
public class CustomerDealerBLAction : IBLMethodAction |
|
|
|
{ |
|
|
|
public string Description |
|
|
|
{ |
|
|
|
get { return "若所选择【经销商】档案明细没有此客户,则在【经销商】中下插入一条明细"; } |
|
|
|
} |
|
|
|
|
|
|
|
public void Execute(Forks.EnterpriseServices.BusinessInterfaces.IDmoContext context, object dmo, object parameter) |
|
|
|
{ |
|
|
|
var customer = dmo as Customer; |
|
|
|
if (customer!=null && !customer.IsDealers && customer.Dealer_ID != null) { |
|
|
|
var query = new DQueryDom(new JoinAlias(typeof(Dealer_Detail))); |
|
|
|
query.Columns.Add(DQSelectColumn.Field("ID")); |
|
|
|
query.Where.Conditions.Add(DQCondition.EQ("Dealer_ID", customer.Dealer_ID)); |
|
|
|
query.Where.Conditions.Add(DQCondition.EQ("Customer_ID", customer.ID)); |
|
|
|
var id = (long?)context.Session.ExecuteScalar(query); |
|
|
|
if (id == null) { |
|
|
|
var bl = BIFactory.Create<IDealerBL>(context.Session); |
|
|
|
var dealer = bl.Load(customer.Dealer_ID.Value); |
|
|
|
var detail = new Dealer_Detail(); |
|
|
|
detail.Customer_ID = customer.ID; |
|
|
|
dealer.Details.Add(detail); |
|
|
|
bl.Update(dealer); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public IList<string> Features |
|
|
|
{ |
|
|
|
get { return new List<string>(); } |
|
|
|
} |
|
|
|
|
|
|
|
public string Name |
|
|
|
{ |
|
|
|
get { return "B3_HuaDu.若所选择【经销商】档案明细没有此客户,则在【经销商】中下插入一条明细"; } |
|
|
|
} |
|
|
|
} |
|
|
|
} |