|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using BWP.B3Frameworks.Utils;
|
|
|
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 CustomerWithDealerBLAction : IBLMethodAction
|
|
|
{
|
|
|
public string Description
|
|
|
{
|
|
|
get { return @"1、【客户档案】保存增加业务逻辑:若该客户同时为经销商档案,则{是否经销商}选择为否,不能保存,提示:该客户是经销商客户是否经销商不能选择为否(客户名称查询【经销商】档案基本属性的‘经销商’)
|
|
|
2、【客户档案】增加保存逻辑:若该客户在【经销商】档案的明细表已存在,则{是否经销商}选择为是,不能保存,提示:该客户所属于**经销商,请先维护经销商档案"; }
|
|
|
}
|
|
|
|
|
|
public void Execute(Forks.EnterpriseServices.BusinessInterfaces.IDmoContext context, object dmo, object parameter)
|
|
|
{
|
|
|
var customer = dmo as Customer;
|
|
|
if (customer != null) {
|
|
|
var id = InnerBLUtil.GetDmoProperty<Dealer, long?>(context.Session, "ID", new Tuple<string, object>("Customer_ID", customer.ID));
|
|
|
if (id != null && !customer.IsDealers)
|
|
|
throw new ApplicationException("该客户是经销商客户是否经销商不能选择为否(客户名称查询【经销商】档案基本属性的‘经销商’)");
|
|
|
var dealerID = InnerBLUtil.GetDmoProperty<Dealer_Detail, long?>(context.Session, "Dealer_ID", new Tuple<string, object>("Customer_ID", customer.ID));
|
|
|
if (dealerID != null && customer.IsDealers)
|
|
|
throw new ApplicationException("该客户属于【经销商】档案No." + dealerID + ",请先维护经销商档案");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public IList<string> Features
|
|
|
{
|
|
|
get { return new List<string>(); }
|
|
|
}
|
|
|
|
|
|
public string Name
|
|
|
{
|
|
|
get { return "B3_HaoYue.【客户】档案与【经销商】档案逻辑控制"; }
|
|
|
}
|
|
|
}
|
|
|
}
|