diff --git a/B3QingDaoWanFu/B3QingDaoWanFu.csproj b/B3QingDaoWanFu/B3QingDaoWanFu.csproj
index c39bf0e..8b8118a 100644
--- a/B3QingDaoWanFu/B3QingDaoWanFu.csproj
+++ b/B3QingDaoWanFu/B3QingDaoWanFu.csproj
@@ -69,11 +69,13 @@
False
..\..\..\tsref\Debug\B3Sale.dll
- False
+ False
+
False
..\..\..\tsref\Debug\b3saleinterface.dll
- False
+ False
+
False
D:\BwpB3Project\tsref\Debug\B3UnitedInfos.dll
@@ -130,7 +132,9 @@
Customer_version.cs
+
+
diff --git a/B3QingDaoWanFu/BLActions/BLActionUtil.cs b/B3QingDaoWanFu/BLActions/BLActionUtil.cs
new file mode 100644
index 0000000..fae9ae8
--- /dev/null
+++ b/B3QingDaoWanFu/BLActions/BLActionUtil.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using BWP.B3Frameworks.Utils;
+using BWP.B3Sale.BO;
+using Forks.EnterpriseServices.DomainObjects2;
+using Forks.EnterpriseServices.DomainObjects2.DQuery;
+
+namespace BWP.B3QingDaoWanFu.BLActions
+{
+ class BLActionUtil
+ {
+ public static void GetDepEmpByCustomer(IDmoSession session,long customerId,out long? depid,out long? empid)
+ {
+ depid = null;
+ empid = null;
+ var query = new DQueryDom(new JoinAlias(typeof(Customer)));
+ query.Columns.Add(DQSelectColumn.Field("Department_ID"));
+ query.Columns.Add(DQSelectColumn.Field("Employee_ID"));
+ query.Where.Conditions.Add(DQCondition.EQ("ID",customerId));
+
+ using (var reader=session.ExecuteReader(query))
+ {
+ if (reader.Read())
+ {
+ depid = (long?) reader[0];
+ empid = (long?) reader[1];
+ }
+ }
+
+ }
+ }
+}
diff --git a/B3QingDaoWanFu/BLActions/SaleOrderBLAction.cs b/B3QingDaoWanFu/BLActions/SaleOrderBLAction.cs
new file mode 100644
index 0000000..ae3084d
--- /dev/null
+++ b/B3QingDaoWanFu/BLActions/SaleOrderBLAction.cs
@@ -0,0 +1,82 @@
+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 TSingSoft.WebPluginFramework;
+using TSingSoft.WebPluginFramework.BIPlugins.BLEvents;
+
+namespace BWP.B3QingDaoWanFu.BLActions
+{
+ class SaleOrderCreateUpdateDepEmpBLAction: IBLMethodAction
+ {
+ public void Execute(IDmoContext context, object dmo, object parameter)
+ {
+ var order = dmo as Order;
+ long? depid;
+ long? empid;
+ BLActionUtil.GetDepEmpByCustomer(context.Session,order.Customer_ID??0, out depid,out empid);
+ if (depid != null)
+ {
+ order.Department_ID = depid;
+ }
+ if (empid != null)
+ {
+ order.Employee_ID = empid;
+ }
+ }
+
+ public string Name
+ {
+ get { return "B3QingDaoWanFu.销售订单创建根据客户档案更新部门经办人"; }
+ }
+ public string Description
+ {
+ get { return "销售订单创建根据客户档案更新部门经办人"; }
+ }
+ public IList Features
+ {
+ get { return new List(); }
+ }
+ }
+
+ class SaleOrderCheckUpdateDepEmpBLAction : IBLMethodAction
+ {
+ public void Execute(IDmoContext context, object dmo, object parameter)
+ {
+ var order = dmo as Order;
+ long? depid;
+ long? empid;
+ BLActionUtil.GetDepEmpByCustomer(context.Session, order.Customer_ID ?? 0, out depid, out empid);
+ if (depid.HasValue || empid.HasValue)
+ {
+ var updateDom = new DQUpdateDom(typeof(Order));
+ if (depid.HasValue)
+ {
+ updateDom.Columns.Add(new DQUpdateColumn("Department_ID", depid));
+ }
+ if (empid.HasValue)
+ {
+ updateDom.Columns.Add(new DQUpdateColumn("Employee_ID", empid));
+ }
+ updateDom.Where.Conditions.Add(DQCondition.EQ("ID",order.ID));
+ context.Session.ExecuteNonQuery(updateDom);
+ }
+ }
+
+ public string Name
+ {
+ get { return "B3QingDaoWanFu.销售订单审核根据客户档案更新部门经办人"; }
+ }
+ public string Description
+ {
+ get { return "销售订单审核根据客户档案更新部门经办人"; }
+ }
+ public IList Features
+ {
+ get { return new List(); }
+ }
+ }
+}