| @ -0,0 +1,33 @@ | |||||
| using System; | |||||
| using BWP.B3Frameworks; | |||||
| using BWP.B3Sale.BL; | |||||
| using BWP.B3Sale.BO; | |||||
| using Forks.EnterpriseServices.DomainObjects2; | |||||
| using Forks.EnterpriseServices.DomainObjects2.DQuery; | |||||
| using Forks.EnterpriseServices.SqlDoms; | |||||
| using TSingSoft.WebPluginFramework; | |||||
| namespace BWP.B3_YunKen.TypeIoc | |||||
| { | |||||
| [TypeIOC(typeof(OrderBL), typeof(OrderBL.IAddPhone))] | |||||
| public class SaleOrderCustomerPhoneTypeIoc : OrderBL.IAddPhone | |||||
| { | |||||
| public void Invoke(Order dmo) | |||||
| { | |||||
| dmo.CellPhone = CustomerPhone(dmo.Customer_ID); | |||||
| } | |||||
| private string CustomerPhone(long? CustomerId) | |||||
| { | |||||
| var main = new JoinAlias(typeof(Customer)); | |||||
| var detail = new JoinAlias(typeof(CustomerLinkMan_Detail)); | |||||
| var dom = new DQueryDom(detail); | |||||
| dom.From.AddJoin(JoinType.Left, new DQDmoSource(main), DQCondition.EQ(main, "ID", detail, "Customer_ID")); | |||||
| dom.Where.Conditions.Add(DQCondition.And( DQCondition.EQ(detail, "Customer_ID", CustomerId), DQCondition.EQ(main, "ID", CustomerId))); | |||||
| dom.Columns.Add(DQSelectColumn.Field("CellPhone", detail)); | |||||
| dom.Range = SelectRange.Top(1); | |||||
| var result = dom.EExecuteScalar<string>(); | |||||
| return result; | |||||
| } | |||||
| } | |||||
| } | |||||