示例#1
0
 /// <summary>
 /// 更新任务库存
 /// </summary>
 /// <returns></returns>
 public void UpdateGoodsStock(string orderId)
 {
     if (new BllTableObject("T_Order_Info").Util_CheckIsExsitData("orderId='" + orderId + "' and (IsComplete=1 or IsPay=1)") == true)
     {
         DataTable dtDetail = new BllTableObject(" T_Order_InfoDetail").Util_GetList("OrderType,GoodsId,GoodsCode,Quantity,GoodsFormate", "orderId='" + orderId + "'");
         foreach (DataRow row in dtDetail.Rows)
         {
             int quantity = Int32.Parse(row["Quantity"].ToString());
             if (row["OrderType"].ToString() == "PT")
             {
                 if (row["GoodsFormate"].ToString() == "")
                 {
                     new BllTableObject("T_Goods_Info").Util_UpdateBat("TotalSaleCount=TotalSaleCount+" + quantity + ",Sotck=Sotck-" + quantity + "", "GoodsId='" + row["GoodsId"].ToString() + "'");
                 }
                 else
                 {
                     new BllTableObject("T_Goods_Info").Util_UpdateBat("TotalSaleCount=TotalSaleCount+" + quantity + "", "GoodsId='" + row["GoodsId"].ToString() + "'");
                     new BllTableObject("T_Goods_Formate").Util_UpdateBat("Stock=Stock-" + quantity + "", "GoodsId='" + row["GoodsId"].ToString() + "' and GoodsCode='" + row["GoodsCode"].ToString() + "'");
                 }
             }
             else if (row["OrderType"].ToString() == "TG")
             {
                 new BllTableObject("T_Group_GoodsInfo").Util_UpdateBat("GroupNumber=GroupNumber+" + quantity + ",Stock=Stock-" + quantity + "", "GoodsId='" + row["GoodsId"].ToString() + "'");
             }
         }
     }
 }
示例#2
0
        /// <summary>
        /// 支付订单
        /// </summary>
        public int PayOrder(string memberId, string orderId, string payInterfaceCode)
        {
            int      r   = 0;
            ModOrder mod = GetModel(orderId);

            if ((mod != null) && (mod.IsPay == 0))
            {
                r = new BllTableObject("T_Order_Info").Util_UpdateBat("IsPay=1,PayTime=getdate(),PayInterfaceCode='" + payInterfaceCode + "'", "isPay=0 and orderId='" + orderId + "' and memberId='" + memberId + "'");

                //进一步判断,更新销售量和库存数量
                UpdateGoodsStock(orderId);
            }
            return(r);
        }
示例#3
0
        /// <summary>
        /// 订单中包含的全部任务
        /// </summary>
        public string GetOrderAllGoods(string orderId)
        {
            string    s      = "";
            DataTable dtCate = new BllTableObject("T_Order_InfoDetail").Util_GetList("GoodsName,GoodsFormate,GoodsPic", "OrderId='" + orderId + "'");

            foreach (DataRow row in dtCate.Rows)
            {
                if (row["GoodsFormate"].ToString() != "")
                {
                    s += row["GoodsName"].ToString() + "(规格:" + row["GoodsFormate"].ToString() + "),";
                }
                else
                {
                    s += row["GoodsName"].ToString() + ",";
                }
            }
            if (s != "")
            {
                s = s.TrimEnd(',');
            }
            return(s);
        }