public virtual void CommonCreateHtml() { this.m_CreateId = Guid.NewGuid().ToString(); if (HttpContext.Current != null) { this.m_PhysicalApplicationPath = HttpContext.Current.Request.PhysicalApplicationPath; this.m_MapPath = VirtualPathUtility.AppendTrailingSlash(HttpContext.Current.Server.MapPath("~/")); this.m_SiteUrl = HttpContext.Current.Request.Url.Authority + VirtualPathUtility.AppendTrailingSlash(HttpContext.Current.Request.ApplicationPath); } this.m_MapPath = this.m_PhysicalApplicationPath; try { string filename = this.m_MapPath + "Config/CreateHtmlWork.config"; XmlDocument document = new XmlDocument(); document.Load(filename); XmlAttribute attribute = document.CreateAttribute("id"); attribute.Value = this.m_CreateId; XmlNode newChild = document.CreateElement("WorkId"); newChild.Attributes.Append(attribute); XmlNode node2 = document.CreateElement("ErrorTime"); newChild.AppendChild(node2); node2 = document.CreateElement("ErrorMessage"); newChild.AppendChild(node2); document.SelectSingleNode("CreateWork").AppendChild(newChild); document.Save(filename); } catch (FileNotFoundException) { CustomException.ThrowBllException("CreateHtmlWork.config文件未找到。"); } catch { CustomException.ThrowBllException("检查您的服务器是否给配置文件CreateHtmlWork.config或文件夹写入权限。"); } this.StartCreate(); if (HttpContext.Current != null) { HttpContext.Current.Application[this.m_CreateId] = this; } }
public static bool SendCard(int orderId) { bool flag = true; bool flag2 = false; StringBuilder content = new StringBuilder(); StringBuilder builder2 = new StringBuilder(); IList <OrderItemInfo> infoListByOrderId = OrderItem.GetInfoListByOrderId(orderId); int num = 0; StockInfo stockInfo = new StockInfo(); stockInfo.Inputer = PEContext.Current.Admin.AdminName; stockInfo.InputTime = DateTime.Now; stockInfo.Remark = "交付点卡"; stockInfo.StockId = StockManage.GetMaxId() + 1; stockInfo.StockNum = StockItem.GetShipmentNum(); stockInfo.StockType = StockType.Shipment; foreach (OrderItemInfo info2 in infoListByOrderId) { if (Product.CharacterIsExists(info2.ProductCharacter, ProductCharacter.Card) && Cards.GetCardByOrderItemId(info2.ProductId, info2.TableName, info2.ItemId).IsNull) { IList <CardInfo> list2 = Cards.GetUnsoldCard(info2.TableName, info2.ProductId, info2.Amount); if (list2.Count < info2.Amount) { builder2.Append("<li>" + info2.ProductName + "的充值卡数量已经不够交付!请先去充值卡管理中添加有关充值卡!</li>"); flag = false; } else { foreach (CardInfo info4 in list2) { info4.OrderItemId = info2.ItemId; if (!Cards.Update(info4)) { return(false); } GetMessageOrMailofCard(content, info4, info2.ProductName); } AddStockItemBySendCard(stockInfo.StockId, info2); num++; } } if (!flag2 && Product.CharacterIsExists(info2.ProductCharacter, ProductCharacter.Practicality)) { flag2 = true; } } if (num > 0) { StockManage.Add(stockInfo); } if (flag) { if (!flag2) { OrderInfo orderById = GetOrderById(orderId); if (!orderById.IsNull) { orderById.DeliverStatus = DeliverStatus.Consignment; Update(orderById); } } } else { CustomException.ThrowBllException(builder2.ToString()); } s_MessgeOrMailContentOfCard = GetMessageOrMailofCard(content.ToString()).ToString(); return(flag); }