public void PriceChangedSendMail(SOInfo soInfo) { try { List <SOInternalMemoInfo> memoList = ObjectFactory <SOInternalMemoProcessor> .Instance.GetBySOSysNo(soInfo.SysNo.Value); List <int> productSysNoList = (from item in soInfo.Items select item.ProductSysNo.Value).ToList(); List <ECCentral.BizEntity.IM.ProductInfo> productList = ExternalDomainBroker.GetProductInfoListByProductSysNoList(productSysNoList); if (productList != null) { DataTable dtMemo = new DataTable(); dtMemo.Columns.AddRange(new DataColumn[] { new DataColumn("LogTime"), new DataColumn("Content"), new DataColumn("Note") }); productList.ForEach(p => { SOItemInfo item = soInfo.Items.Find(i => i.ProductSysNo.Value == p.SysNo); if (item != null) { KeyValueVariables keyValueVariables = new KeyValueVariables(); KeyTableVariables keyTableVariables = new KeyTableVariables(); string pmEmailAddress = p.ProductBasicInfo.ProductManager.UserInfo.EmailAddress; StringBuilder mailBody = new StringBuilder(); keyValueVariables.Add("SOSysNo", soInfo.SysNo.Value); keyValueVariables.Add("ProductID", item.ProductID); keyValueVariables.Add("ProductName", item.ProductName); keyValueVariables.Add("Quantity", item.Quantity); keyValueVariables.Add("Weight", item.Weight); keyValueVariables.Add("Price", item.Price); keyValueVariables.Add("GainAveragePoint", item.GainAveragePoint); keyValueVariables.Add("PromotionAmount", item.PromotionAmount); keyValueVariables.Add("Warranty", item.Warranty); if (memoList != null && memoList.Count > 0 && dtMemo.Rows.Count == 0) { foreach (SOInternalMemoInfo internalMemo in memoList) { DataRow dr = dtMemo.NewRow(); dr["LogTime"] = internalMemo.LogTime.HasValue ? internalMemo.LogTime.Value.ToString(SOConst.DateTimeFormat) : String.Empty; dr["Content"] = internalMemo.Content; dr["Note"] = internalMemo.Note; dtMemo.Rows.Add(dr); } } keyValueVariables.Add("MemoListDisplay", dtMemo.Rows.Count > 0); keyTableVariables.Add("MemoList", dtMemo); ExternalDomainBroker.SendInternalEmail("SO_Product_PriceChanged", keyValueVariables, keyTableVariables); } }); } } catch (Exception ex) { ExceptionHelper.HandleException(ex); } }
/// <summary> /// 填充调用与外Domain相关的字段 /// </summary> /// <param name="soList"></param> protected void FillSOInfo(List <SOInfo> soList) { if (soList != null && soList.Count > 0) { List <SOItemInfo> soItemList = new List <SOItemInfo>(); List <int> productSysNoList = new List <int>(); List <int> customerSysNoList = new List <int>(); List <SOItemInfo> exItemList = new List <SOItemInfo>(); soList.ForEach(soInfo => { //取得订单使用的礼品卡记录 soInfo.SOGiftCardList = ExternalDomainBroker.GetSOGiftCardBySOSysNo(soInfo.SysNo.Value); if (!customerSysNoList.Exists(no => no == soInfo.BaseInfo.CustomerSysNo.Value)) { customerSysNoList.Add(soInfo.BaseInfo.CustomerSysNo.Value); } soInfo.Items.ForEach(item => { item.ProductID = string.Empty; switch (item.ProductType.Value) { case SOProductType.Coupon: item.ProductID = item.ProductSysNo.ToString(); soItemList.Add(item); break; case SOProductType.ExtendWarranty: exItemList.Add(item); break; default: { soItemList.Add(item); if (!productSysNoList.Exists(sysNo => sysNo == item.ProductSysNo)) { productSysNoList.Add(item.ProductSysNo.Value); } break; } } }); }); List <CustomerBasicInfo> customerList = ExternalDomainBroker.GetCustomerBasicInfo(customerSysNoList); if (customerList != null) { customerList.ForEach(c => { SOInfo soInfo = soList.Find(so => so.BaseInfo.CustomerSysNo == c.CustomerSysNo); if (soInfo != null) { soInfo.BaseInfo.CustomerID = c.CustomerID; soInfo.BaseInfo.CustomerName = c.CustomerName; } }); } if (productSysNoList.Count > 0) { List <ECCentral.BizEntity.IM.ProductInfo> productList = ExternalDomainBroker.GetProductInfoListByProductSysNoList(productSysNoList); if (productList != null) { productList.ForEach(product => { List <SOItemInfo> itemList = soItemList.FindAll(item => { return(item.ProductType != SOProductType.Coupon && item.ProductType != SOProductType.ExtendWarranty && item.ProductSysNo == product.SysNo); }); foreach (SOItemInfo item in itemList) { item.ProductID = product.ProductID; } }); exItemList.ForEach(ei => { int mpNo = int.TryParse(ei.MasterProductSysNo, out mpNo) ? mpNo : int.MinValue; SOItemInfo mp = soItemList.Find(i => i.ProductSysNo == mpNo); if (mp != null) { ei.ProductID = mp.ProductID + "E"; } }); } } } }