コード例 #1
0
        /// <summary>
        /// 设置订单为印制中锁定对应印品防止修改
        /// </summary>
        /// <param name="ordercode"></param>
        /// <param name="adminname"></param>
        /// <returns></returns>
        public static BaseResponse SetOrderMaking(string ordercode, string adminname, bool isMaking)
        {
            BaseResponse br = new BaseResponse();

            br.IsSuccess = false;
            try
            {
                Inpinke_Order o_model    = DBOrderBLL.GetOrderByCode(ordercode);
                int           bookStatus = isMaking ? (int)BookStatus.Making : (int)BookStatus.Create;
                if (o_model.Inpinke_Order_Products != null)
                {
                    foreach (Inpinke_Order_Product p in o_model.Inpinke_Order_Products)
                    {
                        //把印品设置为印刷中,防止编辑
                        if (p.BookID != 0 && p.Inpinke_Book != null)
                        {
                            p.Inpinke_Book.BookStauts = bookStatus;
                            p.Inpinke_Book.SaveWhenSubmit(InpinkeDataContext.Instance);
                        }
                    }
                }
                o_model.SaveWhenSubmit(InpinkeDataContext.Instance);
                InpinkeDataContext.Instance.Submit();
                br.IsSuccess = true;
                br.Message   = "订单处理成功";
            }
            catch (Exception ex)
            {
                Logger.Error(string.Format("SetOrderMaking OrderCode:{0}, Error:{1}", ordercode, ex.ToString()));
                br.IsSuccess = false;
                br.Message   = "订单处理失败,请稍后再试";
            }
            return(br);
        }
コード例 #2
0
        /// <summary>
        /// 订单支付成功相关操作
        /// </summary>
        /// <param name="ordercode"></param>
        /// <returns></returns>
        public static BaseResponse OrderPaySuccess(string ordercode, decimal totalfee, string buyerinfo)
        {
            BaseResponse br = new BaseResponse();

            br.IsSuccess = false;
            try
            {
                Inpinke_Order o_model = DBOrderBLL.GetOrderByCode(ordercode);
                if (o_model.OrderStatus == (int)OrderStatus.Create)
                {
                    o_model.OrderStatus = (int)OrderStatus.WaitSend;
                    o_model.PayTime     = DateTime.Now;
                    o_model.PayMethod   = (int)PayMethod.Alipay;
                    o_model.TotalFee    = totalfee;
                    o_model.BuyerInfo   = buyerinfo;
                    if (o_model.Inpinke_Order_Products != null)
                    {
                        foreach (Inpinke_Order_Product p in o_model.Inpinke_Order_Products)
                        {
                            //把印品设置为印刷中,防止编辑
                            if (p.BookID != 0 && p.Inpinke_Book != null)
                            {
                                p.Inpinke_Book.BookStauts = (int)BookStatus.Making;
                                p.Inpinke_Book.SaveWhenSubmit(InpinkeDataContext.Instance);
                            }
                        }
                    }
                    o_model.SaveWhenSubmit(InpinkeDataContext.Instance);
                    InpinkeDataContext.Instance.Submit();
                    br.IsSuccess = true;
                    br.Message   = "订单处理成功";
                }
                else
                {
                    br.IsSuccess = false;
                    br.Message   = "订单状态异常";
                    Logger.Info(string.Format("OrderPaySuccess:" + br.Message + "。订单号:" + o_model.OrderCode));
                }
            }
            catch (Exception ex)
            {
                Logger.Error(string.Format("OrderPaySuccess OrderCode:{0}, Error:{1}", ordercode, ex.ToString()));
                br.IsSuccess = false;
                br.Message   = "订单处理失败,请稍后再试";
            }
            return(br);
        }