コード例 #1
0
        private bool ShowCardInfo(StringBuilder payOnlineMessage, bool doUpdate, bool isok)
        {
            bool flag  = false;
            bool flag2 = false;
            bool flag3 = false;
            bool flag4 = false;
            bool flag5 = false;
            IList <OrderItemInfo> infoListByOrderId = OrderItem.GetInfoListByOrderId(this.m_OrderInfo.OrderId);
            int  stockId          = 0;
            bool isFirstStockItem = true;

            foreach (OrderItemInfo info in infoListByOrderId)
            {
                if (Product.CharacterIsExists(info.ProductCharacter, ProductCharacter.Card))
                {
                    flag5 = ProcessCards(payOnlineMessage, doUpdate, info, ref isFirstStockItem, ref stockId);
                    flag4 = true;
                }
                if (Product.CharacterIsExists(info.ProductCharacter, ProductCharacter.Practicality))
                {
                    flag = true;
                }
                if (Product.CharacterIsExists(info.ProductCharacter, ProductCharacter.Service))
                {
                    flag2 = true;
                }
                if (Product.CharacterIsExists(info.ProductCharacter, ProductCharacter.Download))
                {
                    flag3 = true;
                }
            }
            if (!isFirstStockItem)
            {
                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;
                StockManage.Add(stockInfo);
            }
            if (doUpdate && !flag)
            {
                if ((flag3 && !flag4) && !flag2)
                {
                    Order.Recieve(this.m_OrderInfo.OrderId);
                    return(isok);
                }
                if (!flag5)
                {
                    this.m_OrderInfo.DeliverStatus = DeliverStatus.Consignment;
                    isok = Order.Update(this.m_OrderInfo);
                }
            }
            return(isok);
        }
コード例 #2
0
        private static bool ProcessCards(StringBuilder payOnlineMessage, bool doUpdate, OrderItemInfo itemInfo, ref bool isFirstStockItem, ref int stockId)
        {
            bool             flag = false;
            IList <CardInfo> list = Cards.GetCardList(itemInfo.TableName, itemInfo.ProductId, itemInfo.ItemId);

            if (list.Count == 0)
            {
                if (doUpdate)
                {
                    IList <CardInfo> list2 = Cards.GetUnsoldCard(itemInfo.TableName, itemInfo.ProductId, itemInfo.Amount);
                    string           str   = string.Empty;
                    if (list2.Count >= itemInfo.Amount)
                    {
                        foreach (CardInfo info in list2)
                        {
                            string str2 = str;
                            str = str2 + "<br>卡号:" + info.CardNum + "&nbsp;&nbsp;&nbsp;&nbsp;密码:" + StringHelper.Base64StringDecode(info.Password);
                            info.OrderItemId = itemInfo.ItemId;
                            Cards.Update(info);
                        }
                        if (isFirstStockItem)
                        {
                            stockId          = StockManage.GetMaxId() + 1;
                            isFirstStockItem = false;
                        }
                        Order.AddStockItemBySendCard(stockId, itemInfo);
                    }
                    else
                    {
                        flag = true;
                    }
                    payOnlineMessage.Append("<br /><br />您购买的充值卡的信息如下,请您尽快使用,以防充值卡被他人使用!<br />");
                    payOnlineMessage.Append(str);
                    payOnlineMessage.Append("<br><br><a href='../User/Info/Recharge.aspx'>使用充值卡充值</a>&nbsp;&nbsp;&nbsp;&nbsp;");
                }
                return(flag);
            }
            payOnlineMessage.Append("<br /><br />您购买的充值卡的信息如下,请您尽快使用,以防充值卡被他人使用!<br />");
            foreach (CardInfo info2 in list)
            {
                payOnlineMessage.Append("<br />卡号:" + info2.CardNum + "&nbsp;&nbsp;&nbsp;&nbsp;密码:" + StringHelper.Base64StringDecode(info2.Password));
                payOnlineMessage.Append("<br /><br /><a href='../User/Info/Recharge.aspx'>使用充值卡充值</a>&nbsp;&nbsp;&nbsp;&nbsp;");
            }
            return(flag);
        }
コード例 #3
0
ファイル: Present.cs プロジェクト: wangtingwei/EasyOne-csharp
        private static void AddStockInfo(PresentInfo presentInfo)
        {
            StockInfo stockInfo = new StockInfo();

            stockInfo.StockId   = StockManage.GetMaxId() + 1;
            stockInfo.StockNum  = StockItem.GetInStockNum();
            stockInfo.InputTime = DateTime.Now;
            stockInfo.StockType = StockType.InStock;
            stockInfo.Inputer   = PEContext.Current.Admin.AdminName;
            stockInfo.Remark    = "商品库存初始";
            if (StockManage.Add(stockInfo))
            {
                StockItemInfo info = new StockItemInfo();
                info.Amount      = presentInfo.Stocks;
                info.Price       = presentInfo.Price;
                info.ProductId   = presentInfo.PresentId;
                info.TableName   = string.Empty;
                info.Property    = string.Empty;
                info.ProductNum  = presentInfo.PresentNum;
                info.Unit        = presentInfo.Unit;
                info.ProductName = presentInfo.PresentName;
                StockItem.Add(info, stockInfo.StockId);
            }
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        public static bool Add(DeliverItemInfo deliverItemInfo)
        {
            bool flag = false;
            IList <OrderItemInfo> infoListByOrderId = OrderItem.GetInfoListByOrderId(deliverItemInfo.OrderId);
            DeliverStatus         preparative       = DeliverStatus.Preparative;
            int num = 0;
            IList <StockItemInfo> infoList = new List <StockItemInfo>();
            bool flag2 = true;

            foreach (OrderItemInfo info in infoListByOrderId)
            {
                bool flag3 = false;
                if (Product.CharacterIsExists(info.ProductCharacter, ProductCharacter.Practicality))
                {
                    flag3 = true;
                }
                else if ((deliverItemInfo.DeliverDirection != 1) && Product.CharacterIsExists(info.ProductCharacter, ProductCharacter.Card))
                {
                    flag3 = true;
                }
                if (flag3)
                {
                    if (flag2)
                    {
                        num   = StockManage.GetMaxId() + 1;
                        flag2 = false;
                    }
                    int amount = info.Amount;
                    if (deliverItemInfo.DeliverDirection == 1)
                    {
                        amount = -amount;
                        Product.AddBuyTimes(info.ProductId, info.TableName);
                    }
                    if (string.IsNullOrEmpty(info.TableName))
                    {
                        Present.AddStocks(info.ProductId, amount);
                    }
                    else
                    {
                        Product.AddStocks(info.ProductId, amount, info.Property);
                    }
                    StockItemInfo item = new StockItemInfo();
                    item.Amount      = Math.Abs(amount);
                    item.ItemId      = StockItem.GetMaxId() + 1;
                    item.Price       = info.TruePrice;
                    item.ProductId   = info.ProductId;
                    item.TableName   = info.TableName;
                    item.Property    = info.Property;
                    item.ProductName = info.ProductName;
                    item.ProductNum  = "";
                    item.StockId     = num;
                    item.Unit        = info.Unit;
                    infoList.Add(item);
                    Product.AddOrderNum(info.ProductId, info.TableName, info.Property, amount);
                }
            }
            if (!flag2)
            {
                StockInfo stockInfo = new StockInfo();
                stockInfo.Inputer   = deliverItemInfo.HandlerName;
                stockInfo.InputTime = deliverItemInfo.DeliverDate;
                stockInfo.Remark    = "退货";
                stockInfo.StockId   = num;
                if (deliverItemInfo.DeliverDirection == 1)
                {
                    stockInfo.StockNum  = StockItem.GetShipmentNum();
                    stockInfo.StockType = StockType.Shipment;
                    stockInfo.Remark    = "订单" + deliverItemInfo.OrderNum + "发货";
                    preparative         = DeliverStatus.Consignment;
                }
                else
                {
                    stockInfo.StockNum  = StockItem.GetInStockNum();
                    stockInfo.StockType = StockType.InStock;
                    stockInfo.Remark    = "订单" + deliverItemInfo.OrderNum + "退货";
                }
                if (StockManage.Add(stockInfo))
                {
                    StockItem.Add(infoList, stockInfo.StockId);
                }
            }
            if (Order.UpdateDeliverStatus(deliverItemInfo.OrderId, preparative))
            {
                flag = dal.Add(deliverItemInfo);
            }
            return(flag);
        }
コード例 #6
0
ファイル: Product.cs プロジェクト: wangtingwei/EasyOne-csharp
        public static bool Add(int modelId, ProductInfo productInfo, IList <ProductDataInfo> productDataInfoList, IList <ProductPriceInfo> priceInfoList)
        {
            ModelInfo modelInfoById = ModelManager.GetModelInfoById(modelId);

            if (modelInfoById.IsNull)
            {
                return(false);
            }
            string tableName    = modelInfoById.TableName;
            int    newProductId = GetNewProductId();

            productInfo.ProductId = newProductId;
            bool flag     = true;
            int  num2     = 0;
            int  alarmNum = 0;

            foreach (ProductDataInfo info2 in productDataInfoList)
            {
                num2    += info2.Stocks;
                alarmNum = info2.AlarmNum;
            }
            productInfo.Stocks   = num2;
            productInfo.AlarmNum = alarmNum;
            flag = Add(modelId, tableName, productInfo);
            StockInfo stockInfo = new StockInfo();

            stockInfo.StockId  = StockManage.GetMaxId() + 1;
            stockInfo.StockNum = StockItem.GetInStockNum();
            DataRow[] rowArray = productInfo.Fields.Select("FieldName='Inputer'");
            if (rowArray.Length > 0)
            {
                stockInfo.Inputer = rowArray[0]["FieldValue"].ToString();
            }
            stockInfo.InputTime = DateTime.Now;
            stockInfo.StockType = StockType.InStock;
            stockInfo.Remark    = "商品库存初始";
            StockManage.Add(stockInfo);
            if (flag)
            {
                IList <StockItemInfo> infoList = new List <StockItemInfo>();
                if (!string.IsNullOrEmpty(productInfo.Properties))
                {
                    flag = ProductData.Add(newProductId, tableName, productDataInfoList);
                    foreach (ProductDataInfo info4 in productDataInfoList)
                    {
                        StockItemInfo item = new StockItemInfo();
                        item.ItemId      = StockItem.GetMaxId() + 1;
                        item.Amount      = info4.Stocks;
                        item.Price       = info4.PriceInfo.Price;
                        item.ProductId   = newProductId;
                        item.TableName   = tableName;
                        item.Property    = info4.PropertyValue;
                        item.StockId     = stockInfo.StockId;
                        item.ProductNum  = productInfo.ProductNum;
                        item.Unit        = productInfo.Unit;
                        item.ProductName = productInfo.ProductName;
                        infoList.Add(item);
                    }
                }
                else
                {
                    StockItemInfo info6 = new StockItemInfo();
                    info6.Amount      = productInfo.Stocks;
                    info6.Price       = productInfo.PriceInfo.Price;
                    info6.ProductId   = newProductId;
                    info6.TableName   = tableName;
                    info6.Property    = string.Empty;
                    info6.ProductNum  = productInfo.ProductNum;
                    info6.Unit        = productInfo.Unit;
                    info6.ProductName = productInfo.ProductName;
                    infoList.Add(info6);
                }
                StockItem.Add(infoList, stockInfo.StockId);
                if (((productInfo.PriceInfo.PriceMember == -1M) || (productInfo.PriceInfo.PriceAgent == -1M)) && (priceInfoList != null))
                {
                    flag = ProductPrice.Add(newProductId, tableName, priceInfoList);
                }
            }
            return(flag);
        }
コード例 #7
0
ファイル: Product.cs プロジェクト: wangtingwei/EasyOne-csharp
        public static int BatchImport(DataTable dtField, string filePath, string specialId, int nodeId, int modelId)
        {
            ModelInfo modelInfoById = ModelManager.GetModelInfoById(modelId);

            if (modelInfoById.IsNull)
            {
                return(0);
            }
            string      tableName = modelInfoById.TableName;
            ProductInfo info      = new ProductInfo();

            info.EnableWholesale   = false;
            info.EnableSingleSell  = true;
            info.SalePromotionType = 0;
            info.ProductCharacter  = modelInfoById.Character;
            DataTable dataTable = GetDataTableFromModel(modelId, specialId, nodeId);

            info.Fields = ContentManage.GetNewContentData(dataTable);
            OleDbConnection  selectConnection  = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filePath + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1\"");
            string           selectCommandText = "select * from [sheet1$]";
            OleDbDataAdapter adapter           = new OleDbDataAdapter(selectCommandText, selectConnection);
            DataSet          dataSet           = new DataSet();

            try
            {
                adapter.Fill(dataSet, "ss");
            }
            catch (OleDbException)
            {
            }
            StringBuilder builder = new StringBuilder();
            int           num2    = 0;

            for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++)
            {
                int newProductId = GetNewProductId();
                info.ProductId = newProductId;
                DataRow rows = dataSet.Tables[0].Rows[i];
                info.ProductName = GetExcelFieldValue(rows, dtField, "ProductName", string.Empty);
                info.ProductNum  = GetExcelFieldValue(rows, dtField, "ProductNum", string.Empty);
                if (string.IsNullOrEmpty(info.ProductNum))
                {
                    Random random = new Random();
                    info.ProductNum = DateTime.Now.ToString("yyyyMMddHHmmss") + random.Next().ToString();
                }
                else if (IsExistSameProductNum(info.ProductNum))
                {
                    builder.Append("<li>商品:" + info.ProductName + "的编号已存在,未导入!</li>");
                    continue;
                }
                info.Unit                  = GetExcelFieldValue(rows, dtField, "Unit", "个");
                info.PriceInfo.Price       = DataConverter.CDecimal(GetExcelFieldValue(rows, dtField, "Price", string.Empty));
                info.PriceMarket           = DataConverter.CDecimal(GetExcelFieldValue(rows, dtField, "Price_Market", string.Empty));
                info.Weight                = DataConverter.CDouble(GetExcelFieldValue(rows, dtField, "Weight", string.Empty));
                info.Stocks                = DataConverter.CLng(GetExcelFieldValue(rows, dtField, "Stocks", string.Empty));
                info.AlarmNum              = DataConverter.CLng(GetExcelFieldValue(rows, dtField, "AlarmNum", string.Empty));
                info.ProducerName          = GetExcelFieldValue(rows, dtField, "ProducerName", string.Empty);
                info.TrademarkName         = GetExcelFieldValue(rows, dtField, "TrademarkName", string.Empty);
                info.BarCode               = GetExcelFieldValue(rows, dtField, "BarCode", string.Empty);
                info.ProductIntro          = GetExcelFieldValue(rows, dtField, "ProductIntro", string.Empty);
                info.ProductExplain        = GetExcelFieldValue(rows, dtField, "ProductExplain", string.Empty);
                info.Stars                 = DataConverter.CLng(GetExcelFieldValue(rows, dtField, "Stars", "3"));
                info.PriceInfo.PriceMember = DataConverter.CDecimal(GetExcelFieldValue(rows, dtField, "PriceMember", string.Empty));
                info.PriceInfo.PriceAgent  = DataConverter.CDecimal(GetExcelFieldValue(rows, dtField, "PriceAgent", string.Empty));
                DataRow[] rowArray = info.Fields.Select("FieldName='Title'");
                if (rowArray.Length == 0)
                {
                    AddNewRows(dataTable, "Title", info.ProductName, FieldType.TitleType, 0);
                }
                else
                {
                    rowArray[0][1] = info.ProductName;
                }
                foreach (DataRow row2 in info.Fields.Select("FieldLevel=1"))
                {
                    string str5 = GetExcelFieldValue(rows, dtField, row2["FieldName"].ToString() + "_F", string.Empty);
                    if (string.IsNullOrEmpty(str5))
                    {
                        goto Label_04AA;
                    }
                    FieldType fieldtype = (FieldType)Enum.Parse(typeof(FieldType), row2["FieldType"].ToString());
                    string    name      = Field.GetFieldDataType(fieldtype).Name;
                    if (name != null)
                    {
                        if (!(name == "Double"))
                        {
                            if (name == "Decimal")
                            {
                                goto Label_0448;
                            }
                            if (name == "DateTime")
                            {
                                goto Label_045C;
                            }
                            if (name == "Boolean")
                            {
                                goto Label_0476;
                            }
                            if (name == "Int32")
                            {
                                goto Label_048A;
                            }
                        }
                        else
                        {
                            str5 = DataConverter.CDouble(str5).ToString();
                        }
                    }
                    goto Label_049C;
Label_0448:
                    str5 = DataConverter.CDecimal(str5).ToString();
                    goto Label_049C;
Label_045C:
                    str5 = DataConverter.CDate(str5).ToString();
                    goto Label_049C;
Label_0476:
                    str5 = DataConverter.CBoolean(str5).ToString();
                    goto Label_049C;
Label_048A:
                    str5 = DataConverter.CLng(str5).ToString();
Label_049C:
                    row2["FieldValue"] = str5;
                    Label_04AA :;
                }
                bool      flag      = Add(modelId, tableName, info);
                StockInfo stockInfo = new StockInfo();
                stockInfo.StockId  = StockManage.GetMaxId() + 1;
                stockInfo.StockNum = StockItem.GetInStockNum();
                DataRow[] rowArray3 = info.Fields.Select("FieldName='Inputer'");
                if (rowArray3.Length > 0)
                {
                    stockInfo.Inputer = rowArray3[0]["FieldValue"].ToString();
                }
                stockInfo.InputTime = DateTime.Now;
                stockInfo.StockType = StockType.InStock;
                stockInfo.Remark    = "商品库存初始";
                StockManage.Add(stockInfo);
                if (flag)
                {
                    IList <StockItemInfo> infoList = new List <StockItemInfo>();
                    StockItemInfo         item     = new StockItemInfo();
                    item.Amount      = info.Stocks;
                    item.Price       = info.PriceInfo.Price;
                    item.ProductId   = newProductId;
                    item.TableName   = tableName;
                    item.Property    = string.Empty;
                    item.ProductNum  = info.ProductNum;
                    item.Unit        = info.Unit;
                    item.ProductName = info.ProductName;
                    infoList.Add(item);
                    StockItem.Add(infoList, stockInfo.StockId);
                }
                else
                {
                    builder.Append("<li>商品:" + info.ProductName + "导入失败!</li>");
                    continue;
                }
                num2++;
            }
            s_MessgeOfBatchImport = builder.ToString();
            dataSet.Dispose();
            adapter.Dispose();
            selectConnection.Dispose();
            return(num2);
        }