Exemplo n.º 1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/json";
            string action = MXRequest.GetQueryString("myact");

            if (action == "upStock")
            {
                BLL.wx_shop_product spBll = new BLL.wx_shop_product();
                BLL.orders          oBll  = new BLL.orders();
                try
                {
                    string orderno = MyCommFun.QueryString("order_no");
                    //根据订单号得到订单
                    Model.orders oModel = oBll.GetModelByNo(orderno);
                    //得到所有订购商品
                    List <Model.order_goods> ogList = oModel.order_goods;

                    //根据订购商品的数量修改库存
                    foreach (Model.order_goods item in ogList)
                    {
                        Model.wx_shop_product spModel = spBll.GetModel(item.goods_id);
                        spModel.stock = spModel.stock - item.quantity;
                        spBll.Update(spModel);
                    }
                    context.Response.Write("{\"status\": 1, \"msg\": \"库存操作成功!\"}");
                    return;
                }
                catch (Exception)
                {
                    context.Response.Write("{\"status\": 0, \"msg\": \"库存操作失败!\"}");
                    return;
                }
            }
        }
Exemplo n.º 2
0
        public void ShopDetailPage()
        {
            BLL.wx_shop_product artDal = new BLL.wx_shop_product();
            int pid = MyCommFun.RequestInt("pid");

            Model.wx_shop_product product = artDal.GetModel(pid, wid);
            if (product != null)
            {
                string skuStr      = "[";
                string availSkuStr = "{";
                if (product.skulist != null && product.skulist.Count > 0)
                {
                    // string skuStr = "[{ \"pList\": [\"H\", \"H/VVS/32分/14号\"], \"pName\": \"戒指手寸\" }]";
                    // string   availSku = "{ \"戒指手寸:F-G/VVS/33分/12号\": { \"pid\": 12700, \"stockCount\": \"\", \"stockPrice\": \"1000\", \"maketPrice\": \"0\" },  }";

                    skuStr += "{ \"pList\": [";
                    //暂时只支持一种配件
                    for (int i = 0; i < product.skulist.Count; i++)
                    {
                        product.skulist[i].price += product.salePrice;
                        product.skulist[i].price *= 100;
                        if (i != (product.skulist.Count - 1))
                        {
                            skuStr      += "\"" + product.skulist[i].attributeValue + "\",";
                            availSkuStr += "\"" + product.skulist[0].attrName + ":" + product.skulist[i].attributeValue + "\": { \"pid\": " + product.skulist[i].id + ", \"stockCount\": \"\", \"stockPrice\": \"" + product.skulist[i].price + "\", \"maketPrice\": \"" + product.marketPrice + "\" }, ";
                        }
                        else
                        {
                            skuStr      += "\"" + product.skulist[i].attributeValue + "\"";
                            availSkuStr += "\"" + product.skulist[0].attrName + ":" + product.skulist[i].attributeValue + "\": { \"pid\": " + product.skulist[i].id + ", \"stockCount\": \"\", \"stockPrice\": \"" + product.skulist[i].price + "\", \"maketPrice\": \"" + product.marketPrice + "\" }";
                        }
                    }
                    skuStr += "], \"pName\": \"" + product.skulist[0].attrName + "\" }";

                    //MxWeiXinPF.DAL.ShopSKUDal skuDal = new DAL.ShopSKUDal();
                    //IList<Model.ShopSKU> skulist = skuDal.SKUConvert(product.skulist);
                    //this.Document.SetValue("skulist", skulist[0]);
                }
                skuStr      += "]";
                availSkuStr += "}";
                if (availSkuStr == "{}")
                {
                    availSkuStr = "{ \"\": { \"pid\": 0, \"stockCount\": \"\", \"stockPrice\": \"" + product.salePrice + "\", \"maketPrice\": \"" + product.marketPrice + "\" } }";
                }
                this.Document.SetValue("skuStr", skuStr);
                this.Document.SetValue("availSkuStr", availSkuStr);
                this.Document.SetValue("model", product);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        ///  设置操作
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value);

            BLL.wx_shop_product   bll   = new BLL.wx_shop_product();
            Model.wx_shop_product model = bll.GetModel(id);
            switch (e.CommandName)
            {
            case "lbtnIslatest":    //最新
                if (model.latest)
                {
                    bll.UpdateField(id, "latest=0");
                }
                else
                {
                    bll.UpdateField(id, "latest=1");
                }
                break;

            case "lbtnIshotsale":
                if (model.hotsale)
                {
                    bll.UpdateField(id, "hotsale=0");
                }
                else
                {
                    bll.UpdateField(id, "hotsale=1");
                }
                break;

            case "lbtnIsspecialOffer":
                if (model.specialOffer)
                {
                    bll.UpdateField(id, "specialOffer=0");
                }
                else
                {
                    bll.UpdateField(id, "specialOffer=1");
                }
                break;
            }
            this.RptBind(this.category_id, CombSqlTxt(this.keywords), "sort_id asc,id desc");
        }
Exemplo n.º 4
0
        /// <summary>
        /// 【微支付】 订单付款成功,处理订单:1将订单的状态改成付款完成;
        /// 李朴 add
        /// </summary>
        /// <param name="beforeFunName"></param>
        /// <param name="out_trade_no">商户订单号</param>
        /// <param name="transaction_id">订单交易号</param>
        /// <param name="result_code">支付结果</param>
        /// <param name="total_fee">付款金额(单位为分)</param>
        /// <param name="otid">订单临时表id</param>
        /// <returns>有错误则返回错误信息,正确,则返回空字符串</returns>
        public string ProcessPaySuccess_wx(string beforeFunName, string out_trade_no, string transaction_id, string result_code, int total_fee, int otid, int wid)
        {
            string  payTmpType  = "【微支付】";
            decimal total_fee_d = (decimal)total_fee / 100;

            BLL.orders orderBll = new BLL.orders();

            string funName = payTmpType + beforeFunName + " ProcessPaySuccess_wx ";


            WXLogs.AddLog(wid, "微支付", funName, "开始执行ProcessPaySuccess_wx方法[otid:" + otid + "]");
            try
            {
                #region 数据同步前
                IList <Model.orders> orderlist = orderBll.GetModelList("id=" + otid + " and order_no='" + out_trade_no + "'");
                if (orderlist == null || orderlist.Count <= 0)
                {
                    WXLogs.AddLog(wid, payTmpType, funName, "订单号【" + out_trade_no + "】订单号不存在", 0);
                    return("订单号不存在");
                }
                //这个暂时不处理
                if (WXLogs.ExistsFlg((out_trade_no + otid)))
                {  //如果已经处理过,则不再处理
                    return("");
                }
                WXLogs.AddFlg(wid, payTmpType, funName, (out_trade_no + otid));//加标志,防止重复提交

                Model.orders orderEntity = orderlist[0];
                if (orderEntity.order_amount > total_fee_d)
                {
                    return("付款的金额(" + total_fee_d + ")小于订单的预付款金额(" + orderEntity.order_amount + ")信息,直接退款");
                }
                orderEntity.notify_id      = "";
                orderEntity.trade_no       = transaction_id;
                orderEntity.pay_info       = result_code;
                orderEntity.order_amount   = total_fee_d;
                orderEntity.payment_time   = DateTime.Now;
                orderEntity.status         = 2;
                orderEntity.payment_status = 2;

                //判断是否需要立即发货
                if (orderEntity.express_status == 0)
                {
                    //立即发货

                    orderEntity.express_status = 2;
                    orderEntity.express_time   = DateTime.Now;


                    //FaHuoProc fahuo = new FaHuoProc();

                    //BLL.wx_payment_wxpay payBll = new BLL.wx_payment_wxpay();
                    //Model.wx_payment_wxpay paymentInfo = payBll.GetModelByWid(wid);
                    //Dictionary<string, object> fahuoDict = fahuo.fahuomgr(paymentInfo, orderEntity);
                    //string errcode = fahuoDict["errcode"].ToString();
                    //string errmsg = fahuoDict["errmsg"].ToString();
                    //orderEntity.fahuoCode = errcode;
                    //orderEntity.fahuoMsg = errmsg;
                    //if (errcode == "0")
                    //{
                    //    orderEntity.express_status = 2;
                    //    orderEntity.express_time = DateTime.Now;
                    //}
                    //else
                    //{
                    //    orderEntity.express_status =1;
                    //}
                }

                bool ret = orderBll.Update(orderEntity);
                //把订单里的商品库存减少

                #region 减少库存
                BLL.wx_shop_product spBll = new BLL.wx_shop_product();
                BLL.orders          oBll  = new BLL.orders();
                //根据订单号得到订单
                Model.orders oModel = oBll.GetModelByNo(orderEntity.order_no);
                //得到所有订购商品
                List <Model.order_goods> ogList = oModel.order_goods;
                //根据订购商品的数量修改库存
                foreach (Model.order_goods item in ogList)
                {
                    Model.wx_shop_product spModel = spBll.GetModel(item.goods_id);
                    spModel.stock = spModel.stock - item.quantity;
                    spBll.Update(spModel);
                }
                #endregion


                if (!ret)
                {
                    WXLogs.AddLog(wid, payTmpType, funName, "订单号【" + out_trade_no + "】支付成功后处理数据失败", 0);
                    return("订单号【" + out_trade_no + "】支付成功后处理数据失败");
                }

                WXLogs.AddLog(payTmpType, funName, "订单号【" + out_trade_no + "】支付成功后,处理数据成功", 1);
                return("");

                #endregion
            }
            catch (Exception ex)
            {
                WXLogs.AddLog(wid, payTmpType, funName, "订单号【" + out_trade_no + "】支付成功后处理数据同步出现错误:" + ex.Message, 0);
                return(null);
            }
        }
Exemplo n.º 5
0
        public void ShopDetailPage()
        {
            BLL.wx_shop_product artDal = new BLL.wx_shop_product();
            int pid = MyCommFun.RequestInt("pid");
            Model.wx_shop_product product = artDal.GetModel(pid);
            if (product != null)
            {
                string skuStr = "[";
                string availSkuStr = "{";
                if (product.skulist != null && product.skulist.Count>0)
                {
                   // string skuStr = "[{ \"pList\": [\"H\", \"H/VVS/32分/14号\"], \"pName\": \"戒指手寸\" }]";
                   // string   availSku = "{ \"戒指手寸:F-G/VVS/33分/12号\": { \"pid\": 12700, \"stockCount\": \"\", \"stockPrice\": \"1000\", \"maketPrice\": \"0\" },  }";

                    skuStr += "{ \"pList\": [";
                    //暂时只支持一种配件
                    for (int i = 0; i < product.skulist.Count; i++)
                    {
                        product.skulist[i].price += product.salePrice;
                        product.skulist[i].price *= 100;
                        if (i != (product.skulist.Count - 1))
                        {
                            skuStr += "\"" + product.skulist[i].attributeValue + "\",";
                            availSkuStr += "\"" + product.skulist[0].attrName + ":" + product.skulist[i].attributeValue + "\": { \"pid\": " + product.skulist[i].id + ", \"stockCount\": \"\", \"stockPrice\": \"" + product.skulist[i].price + "\", \"maketPrice\": \"" + product.marketPrice* 100 + "\" }, ";
                        }
                        else
                        {
                            skuStr += "\"" + product.skulist[i].attributeValue + "\"";
                            availSkuStr += "\"" + product.skulist[0].attrName + ":" + product.skulist[i].attributeValue + "\": { \"pid\": " + product.skulist[i].id + ", \"stockCount\": \"\", \"stockPrice\": \"" + product.skulist[i].price + "\", \"maketPrice\": \"" + product.marketPrice * 100 + "\" }";
                        }
                    }
                    skuStr += "], \"pName\": \"" + product.skulist[0].attrName + "\" }";

                    //MxWeiXinPF.DAL.ShopSKUDal skuDal = new DAL.ShopSKUDal();
                    //IList<Model.ShopSKU> skulist = skuDal.SKUConvert(product.skulist);
                    //this.Document.SetValue("skulist", skulist[0]);
                }
                skuStr += "]";
                availSkuStr += "}";
                if (availSkuStr == "{}")
                {
                    availSkuStr = "{ \"\": { \"pid\": 0, \"stockCount\": \"\", \"stockPrice\": \"" + product .salePrice+ "\", \"maketPrice\": \""+product.marketPrice * 100+"\" } }";
                }
                this.Document.SetValue("skuStr", skuStr);
                this.Document.SetValue("availSkuStr", availSkuStr);
                this.Document.SetValue("model", product);

            }
        }
        /// <summary>
        ///  设置操作
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value);
            BLL.wx_shop_product bll = new BLL.wx_shop_product();
            Model.wx_shop_product model = bll.GetModel(id);
            switch (e.CommandName)
            {
                case "lbtnIslatest"://最新
                    if (model.latest)
                        bll.UpdateField(id, "latest=0");
                    else
                        bll.UpdateField(id, "latest=1");
                    break;
                case "lbtnIshotsale":
                    if (model.hotsale)
                        bll.UpdateField(id, "hotsale=0");
                    else
                        bll.UpdateField(id, "hotsale=1");
                    break;
                case "lbtnIsspecialOffer":
                    if (model.specialOffer)
                        bll.UpdateField(id, "specialOffer=0");
                    else
                        bll.UpdateField(id, "specialOffer=1");
                    break;

            }
            this.RptBind(this.category_id, CombSqlTxt(this.keywords), "sort_id asc,id desc");
        }
Exemplo n.º 7
0
/// <summary>
///
/// </summary>
        public void ShopDetailPage()
        {
            BLL.wx_shop_product artDal = new BLL.wx_shop_product();
            int pid = MyCommFun.RequestInt("pid");

            Model.wx_shop_product product = artDal.GetModel(pid);
            if (product != null)
            {
                string skuStr      = "{\"attr\":[";
                string availSkuStr = "{";
                if (product.skulist != null && product.skulist.Count > 0)
                {
                    //////////////////生成新的list对数据进行分类
                    List <int?> arrlist = new List <int?>();
                    for (int i = 0; i < product.skulist.Count; i++)
                    {
                        arrlist.Add(product.skulist[i].attributeId);
                    }
                    IList <int?> nlist = arrlist.Distinct().ToList();//去除重复值
                    //////////////////////
                    for (int j = 0; j < nlist.Count; j++)
                    {
                        //////////////////////////////////////
                        List <Model.wx_shop_sku> newskulist = new List <Model.wx_shop_sku>();
                        for (int i = 0; i < product.skulist.Count; i++)
                        {
                            if (product.skulist[i].attributeId == nlist[j].Value)
                            {
                                newskulist.Add(product.skulist[i]);
                            }
                        }

                        /////////////////////////////////////
                        string dh = "";
                        if (j == (nlist.Count - 1))
                        {
                            dh = "";
                        }
                        else
                        {
                            dh = ",";
                        }

                        skuStr += "{\"attrname\":\"" + newskulist[j].attrName + "\",\"attrlist\": [";

                        string skuname = "";
                        for (int i = 0; i < newskulist.Count; i++)
                        {
                            string addprice = newskulist[i].price.ToString();
                            newskulist[i].price += product.salePrice;
                            //    newskulist[i].price *= 100;
                            string dhi = "", dhk = ",";
                            if (i != (newskulist.Count - 1))
                            {
                                dhi = ",";
                            }
                            else
                            {
                                dhi = "";                                             //availSkuStr
                            }
                            if (j == (nlist.Count - 1) && i == (newskulist.Count - 1))
                            {
                                dhk = "";
                            }

                            skuStr += "{ \"pid\": " + newskulist[i].id + ", \"aname\": \"" + newskulist[i].attributeValue + "\", \"addprice\": \"" + addprice + "\", \"stockPrice\": \"" + newskulist[i].price + "\", \"maketPrice\": \"" + product.marketPrice + "\" }" + dhi + " ";

                            //   skuStr += "{ \"attrname\": \"" + newskulist[i].attributeValue + "\", \"stockPrice\": \"" + newskulist[i].price + "\", \"maketPrice\": \"" + product.marketPrice * 100 + "\" }" + dhi + "";

                            availSkuStr += "\"" + newskulist[i].attrName + ":" + newskulist[i].attributeValue + "\": { \"pid\": " + newskulist[i].id + ", \"stockCount\": \"\", \"stockPrice\": \"" + newskulist[i].price + "\", \"maketPrice\": \"" + product.marketPrice * 100 + "\" }" + dhk + " ";

                            skuname = newskulist[i].attrName;
                        }
                        skuStr += "]}" + dh;
                    }

                    skuStr      += "]}";
                    availSkuStr += "}";

                    //XCWeiXin.DAL.ShopSKUDal skuDal = new DAL.ShopSKUDal();
                    //IList<Model.ShopSKU> skulist = skuDal.SKUConvert(product.skulist);
                    //this.Document.SetValue("skulist", skulist[0]);
                }
                else
                {
                    skuStr += "]}";
                }

                if (availSkuStr == "{}")
                {
                    availSkuStr = "{ \"\": { \"pid\": 0, \"stockCount\": \"\", \"stockPrice\": \"" + product.salePrice + "\", \"maketPrice\": \"" + product.marketPrice * 100 + "\" } }";
                }
                this.Document.SetValue("skuStr", skuStr);
                this.Document.SetValue("availSkuStr", availSkuStr);
                this.Document.SetValue("model", product);
                //快递信息列表
                BLL.express expressBll = new BLL.express();
                DataSet     dsExpress  = expressBll.GetExpressList100(wid);
                this.Document.SetValue("express", dsExpress);

                //支付信息列表
                BLL.payment pbll  = new BLL.payment();
                DataSet     dsPay = pbll.GetList(0, "  is_lock=0 and wid=" + wid, "  sort_id asc");
                this.Document.SetValue("payment", dsPay);
            }
        }