private void HandleOrder(int id)
        {
            ShowShop.BLL.Order.Orders ordersbll = new ShowShop.BLL.Order.Orders();
            ShowShop.Model.Order.Orders ordersModel = ordersbll.GetModel(id);
            if (ordersModel != null)
            {
                ShowShop.BLL.Order.OrderProduct orderProductbll = new ShowShop.BLL.Order.OrderProduct();
                DataTable orderProductDT = orderProductbll.GetListOrderProduct(id.ToString());

                ShowShop.BLL.Member.MemberAccount memberaccountbll = new ShowShop.BLL.Member.MemberAccount();
                ShowShop.Model.Member.MemberAccount memberaccounModel = memberaccountbll.GetModel(ordersModel.UserId);

             //   ShowShop.BLL.Product.ProductSpecification spebll = new ShowShop.BLL.Product.ProductSpecification();
                decimal DonateIntegral = 0;
                if (orderProductDT.Rows.Count > 0)
                {
                    ShowShop.BLL.Product.ProductInfo productinfoBll = new ShowShop.BLL.Product.ProductInfo();
                    for (int i = 0; i < orderProductDT.Rows.Count; i++)
                    {
                        ShowShop.Model.Product.ProductInfo productInfoModel = productinfoBll.GetModel(Convert.ToInt32(orderProductDT.Rows[i]["ProId"].ToString()));
                        if (productInfoModel != null)
                        {
                           // DonateIntegral += Convert.ToDecimal(productInfoModel.pro_DonateIntegral);
                           // productinfoBll.Amend(productInfoModel.pro_ID, "pro_SaleNum", productInfoModel.pro_SaleNum + Convert.ToInt32(orderProductDT.Rows[i]["ProNum"].ToString()));
                            if (!string.IsNullOrEmpty(orderProductDT.Rows[i]["Specification"].ToString()))
                            {
                              //  List<ShowShop.Model.Product.ProductSpecification> spcList = spebll.GetSpecification(" and ProductId=" + orderProductDT.Rows[i]["ProId"].ToString() + " and Specifications='" + orderProductDT.Rows[i]["Specification"].ToString() + "'");
                              //  if (spcList.Count > 0)
                              //  {
                                  //  spebll.Amend(spcList[0].Id, "ProductStock", Convert.ToInt32(spcList[0].ProductStock) - Convert.ToInt32(orderProductDT.Rows[i]["ProNum"].ToString()));
                              //  }
                            }
                            else
                            {
                                //if (Convert.ToInt32(productInfoModel.pro_Stock) >= Convert.ToInt32(orderProductDT.Rows[i]["ProNum"].ToString()))
                                {
                                   // productinfoBll.Amend(productInfoModel.pro_ID, "pro_Stock", Convert.ToInt32(productInfoModel.pro_Stock) - Convert.ToInt32(orderProductDT.Rows[i]["ProNum"].ToString()));
                                }

                            }
                        }
                    }
                    //购买商品赠送积分
                    if (memberaccounModel != null)
                    {
                        if (DonateIntegral > 0)
                        {
                            if (memberaccountbll.Amend(memberaccounModel.UID, "Points", memberaccounModel.Points + DonateIntegral) > 0)
                            {
                                ShowShop.BLL.Member.Integral integralBll = new ShowShop.BLL.Member.Integral();
                                ShowShop.Model.Member.Integral integral = new ShowShop.Model.Member.Integral();
                                integral.Userid = memberaccounModel.UID;
                                integral.OrderId = ordersModel.OrderId;
                                integral.IntegralClass = 1;
                                integral.IntegralNum = memberaccounModel.Points + DonateIntegral;
                                integral.GainDate = Convert.ToDateTime(System.DateTime.Now);
                                integral.NoteDate = Convert.ToDateTime(System.DateTime.Now);
                                integral.NoteName = "系统";
                                integral.Remark = "购买商品后赠送的积分";
                                integral.IntegralStatus = 0;
                                integral.Origin = "订单";
                                integralBll.Add(integral);
                            }
                        }

                    }
                }
            }
        }
Example #2
0
 protected void IntegralInfo(string UID)
 {
     ChangeHope.WebPage.Table table = new ChangeHope.WebPage.Table();
     ShowShop.BLL.Member.Integral bll = new ShowShop.BLL.Member.Integral();
     ChangeHope.DataBase.DataByPage dataPage = bll.GetList(" 1=1 and userId=" + UID + "");
     //第一步先添加表头
     table.AddHeadCol("", "来源内容");
     table.AddHeadCol("", "获得积分");
     table.AddHeadCol("", "获得时间");
     table.AddHeadCol("", "处理者");
     table.AddHeadCol("", "备注");
     table.AddRow();
     //添加表的内容
     if (dataPage.DataReader != null)
     {
         while (dataPage.DataReader.Read())
         {
             string remark = ChangeHope.Common.StringHelper.SubStringAndAppend(dataPage.DataReader["remark"].ToString(), 100, "...");
             table.AddCol(dataPage.DataReader["origin"].ToString());
             table.AddCol(dataPage.DataReader["integral"].ToString());
             table.AddCol(dataPage.DataReader["gainDate"].ToString());
             table.AddCol(dataPage.DataReader["noteName"].ToString());
             table.AddCol(remark);
             table.AddRow();
         }
     }
     string view = table.GetTable() + dataPage.PageToolBar;
     dataPage.Dispose();
     dataPage = null;
     this.LitIntegral.Text = view;
 }