using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Web.UI; using BWP.B3Frameworks.BO; using BWP.B3Frameworks.Utils; using BWP.B3Sale.BL; using BWP.B3Sale.BO; using Forks.EnterpriseServices.BusinessInterfaces; using Forks.EnterpriseServices.DomainObjects2; namespace BWP.Web.Pages.WeixinMessage_ { public class CusAcceptWeixinMessageTemplate : WeixinMessageUtil.IWeixinMessageView { WeixinMessage mMessage; public CusAcceptWeixinMessageTemplate(WeixinMessage message) { mMessage = message; } public System.Web.UI.Control CreateContent() { var bl = BIFactory.Create(); var cusAccept = bl.Load(mMessage.TargetID.Value); var dmoTypeId = DmoTypeIDAttribute.GetID(typeof(SaleOutStore)); string outCode = string.Empty; string dealer = string.Empty; string car_Name = string.Empty; string freightUnitPrice = string.Empty; string driver_Name = string.Empty; string driverPhone = string.Empty; string allUnitNum = string.Empty; string money = string.Empty; string freightPrice = string.Empty; if (cusAccept.BillType == dmoTypeId) { var outbl = BIFactory.Create(); if (cusAccept.BillID != null) { var saleOutStore = outbl.Load(cusAccept.BillID.Value); outCode = saleOutStore.Code; dealer = saleOutStore.CustomerDealer_Name; car_Name = saleOutStore.Car_Name; if (!string.IsNullOrEmpty(saleOutStore.Car_Name) && !string.IsNullOrEmpty(saleOutStore.HandcarNumber)) { car_Name = saleOutStore.Car_Name + "/" + saleOutStore.HandcarNumber; } freightUnitPrice = saleOutStore.FreightUnitPrice == null ? string.Empty : saleOutStore.FreightUnitPrice.ToString(); driver_Name = saleOutStore.Driver_Name; driverPhone = saleOutStore.DriverPhone; if (!string.IsNullOrEmpty(saleOutStore.DriverPhone) && !string.IsNullOrEmpty(saleOutStore.DriverPhone1)) { driverPhone = saleOutStore.DriverPhone + "/" + saleOutStore.DriverPhone1; } allUnitNum = saleOutStore.AllUnitNum == null ? string.Empty : saleOutStore.AllUnitNum.ToString(); money = saleOutStore.Money == null ? string.Empty : saleOutStore.Money.ToString(); freightPrice = saleOutStore.FreightPrice == null ? string.Empty : saleOutStore.FreightPrice.ToString(); } else { outCode = cusAccept.BillIDs; dealer = cusAccept.CustomerDealer_Name; car_Name = cusAccept.Car_Name; if (!string.IsNullOrEmpty(cusAccept.Car_Name) && !string.IsNullOrEmpty(cusAccept.HandcarNumber)) { car_Name = cusAccept.Car_Name + "/" + cusAccept.HandcarNumber; } freightUnitPrice = cusAccept.FreightUnitPrice == null ? string.Empty : cusAccept.FreightUnitPrice.ToString(); driver_Name = cusAccept.Driver_Name; driverPhone = cusAccept.DriverPhone; if (!string.IsNullOrEmpty(cusAccept.DriverPhone) && !string.IsNullOrEmpty(cusAccept.DriverPhone1)) { driverPhone = cusAccept.DriverPhone + "/" + cusAccept.DriverPhone1; } allUnitNum = cusAccept.AcceptNumber == null ? string.Empty : cusAccept.AcceptNumber.ToString(); money = cusAccept.Money == null ? string.Empty : cusAccept.Money.ToString(); freightPrice = cusAccept.FreightPrice == null ? string.Empty : cusAccept.FreightPrice.ToString(); } } var checkTime = cusAccept.CheckTime == null ? "" : cusAccept.CheckTime.Value.ToString(); var acceptNumber = cusAccept.AcceptNumber==null?string.Empty:cusAccept.AcceptNumber.ToString(); var acceptFreightUnitPrice = cusAccept.FreightUnitPrice==null?string.Empty:cusAccept.FreightUnitPrice.ToString(); var acceptMoney = cusAccept.Money==null?string.Empty:cusAccept.Money.ToString(); var acceptFreightPrice = cusAccept.FreightPrice==null?string.Empty:cusAccept.FreightPrice.ToString(); var employee_Name = cusAccept.Employee_Name; var tel = string.Empty; using (var context = new TransactionContext()) { tel = InnerBLUtil.GetDmoPropertyByID(context.Session, typeof(Employee), "HandPhone", cusAccept.Employee_ID ?? 0); } var html = @"

{title}

{trs}
经销商发货信息单号{OutCode}
发货工厂{AccountingUnit_Name}发货时间{CheckTime}
客户名称{CustomerDealer_Name}
运输车号{Car_Name}运费单价{FreightUnitPrice}
司机姓名{Driver_Name}司机电话{DriverPhone}
总数量(kg){AllUnitNum}总金额{Money}总运费{FreightPrice}
客户经理{Employee_Name}联系电话{Tel}
温馨提示:如您对货单有疑问,请联系客户经理,谢谢!
分销商发货明细单号{AcceptCode}
客户名称{Customer_Name}
名称品牌件数单价重量金额
总数量{AcceptNumber}运费单价{AcceptFreightUnitPrice}
总金额{AcceptMoney}运费金额{AcceptFreightPrice}
"; html = html.Replace("{title}", mMessage.Title); html = html.Replace("{OutCode}", outCode).Replace("{AccountingUnit_Name}", cusAccept.AccountingUnit_Name).Replace("{CheckTime}", checkTime).Replace("{CustomerDealer_Name}", dealer).Replace("{Car_Name}", car_Name).Replace("{FreightUnitPrice}", freightUnitPrice).Replace("{Driver_Name}", driver_Name).Replace("{DriverPhone}", driverPhone).Replace("{AllUnitNum}", allUnitNum).Replace("{Money}", money).Replace("{FreightPrice}", freightPrice).Replace("{AcceptCode}", cusAccept.Code).Replace("{Customer_Name}", cusAccept.Customer_Name).Replace("{AcceptNumber}", acceptNumber).Replace("{AcceptFreightUnitPrice}", acceptFreightUnitPrice).Replace("{AcceptMoney}", acceptMoney).Replace("{AcceptFreightPrice}", acceptFreightPrice).Replace("{Employee_Name}", employee_Name).Replace("{Tel}", tel); if (cusAccept.Details.Count() > 0) { var str = new StringBuilder(); foreach (var detail in cusAccept.Details) { str.Append(""); str.Append(""); str.Append(detail.Goods_Name); str.Append(""); str.Append(""); str.Append(detail.BrandItem_Name); str.Append(""); str.Append(""); str.Append(detail.AcceptSecondNumber); str.Append(""); str.Append(""); str.Append(detail.Price); str.Append(""); str.Append(""); str.Append(detail.AcceptNum); str.Append(""); str.Append(""); str.Append(detail.AcceptMoney); str.Append(""); str.Append(""); } html = html.Replace("{trs}", str.ToString()); } return new LiteralControl(html); } public string GetTitle() { return mMessage.Title; } } }