Пример #1
0
        public static void FittingDisposal(string SparepartId, string FittingsProductId, string FittingsProductCount, out int FittingProductCount, out string fittingProductInfo, out double fittingTotalPrice,out double fittingProductWeight,out double fittingProductIntergal)
        {
            ShowShop.BLL.Product.ProductInfo productbll = new ShowShop.BLL.Product.ProductInfo();
            ShowShop.BLL.Product.ProductSparepart spabll = new ShowShop.BLL.Product.ProductSparepart();
            int favourableType = -1;
            double favourableLimit = 0;
            int productCount = 0;
            string fittingInfo = "";
            double strfittingPrice = 0;
            double productWeight = 0;
            double productIntergal = 0;
            if (!string.IsNullOrEmpty(SparepartId.Trim()) && Convert.ToInt32(SparepartId) > 0)
            {
                ShowShop.Model.Product.ProductSparepart sparModel = spabll.GetModelID(Convert.ToInt32(SparepartId));
                if (sparModel != null)
                {
                    favourableLimit = Convert.ToDouble(sparModel.FavourableLimit.ToString());
                    favourableType = sparModel.FavourableType;
                }
            }

            if (!string.IsNullOrEmpty(FittingsProductId))
            {
                string[] fittingProIdArr = FittingsProductId.Split(',');
                string[] fittingProCountArr = FittingsProductCount.Split(',');
                for (int c = 0; c < fittingProCountArr.Length; c++)
                {
                    if (!string.IsNullOrEmpty(fittingProCountArr[c].Trim()))
                    {
                        productCount += Convert.ToInt32(fittingProCountArr[c]);
                    }
                }
                for (int f = 0; f < fittingProIdArr.Length; f++)
                {
                    if (!string.IsNullOrEmpty(fittingProIdArr[f].Trim()))
                    {
                        DataTable prodt = productbll.GetAppointField("pro_ID,pro_Name,pro_ShopPrice,pro_RatingDiscount,pro_Specifications,pro_Weight,pro_DonateIntegral", " and pro_ID=" + fittingProIdArr[f]);
                        if (prodt.Rows.Count > 0)
                        {
                            productIntergal += Convert.ToDouble(prodt.Rows[0]["pro_DonateIntegral"].ToString());
                            productWeight += Convert.ToDouble(prodt.Rows[0]["pro_Weight"].ToString());
                            double price = Convert.ToDouble(prodt.Rows[0]["pro_ShopPrice"].ToString());
                            string memberPrice = prodt.Rows[0]["pro_RatingDiscount"].ToString();
                            if (!string.IsNullOrEmpty(prodt.Rows[0]["pro_Specifications"].ToString()))
                            {
                                //ShowShop.BLL.Product.ProductSpecification proSpe = new ShowShop.BLL.Product.ProductSpecification();
                                //List<ShowShop.Model.Product.ProductSpecification> proSpeList = proSpe.GetSpecification(Convert.ToInt32(prodt.Rows[0]["pro_ID"].ToString()));
                                //if (proSpeList.Count > 0)
                                //{
                                //    price = Convert.ToDouble(proSpeList[0].SalePrice);
                                //    memberPrice = proSpeList[0].MemberPrice;
                                //}
                            }
                            if (HttpContext.Current.Session["MemberID"] != null && !string.IsNullOrEmpty(memberPrice.Trim()))
                            {
                                price = ShowShop.Common.ProductInfo.DiscountedPrice(int.Parse(HttpContext.Current.Session["MemberID"].ToString()), price, memberPrice);
                            }

                            double fittingPrice = price;
                            if (HttpContext.Current.Session["MemberID"] != null)
                            {
                                fittingPrice = DiscountedPrice(Convert.ToInt32(HttpContext.Current.Session["MemberID"].ToString()), fittingPrice, prodt.Rows[0]["pro_RatingDiscount"].ToString());
                            }

                            if (!string.IsNullOrEmpty(fittingProCountArr[f].Trim()))
                            {
                                fittingPrice = fittingPrice * Convert.ToInt32(fittingProCountArr[f]);
                            }
                            if (favourableType == 0 && favourableLimit > 0)
                            {
                                fittingPrice = fittingPrice * favourableLimit;
                            }
                            else if (favourableType == 1 && favourableLimit > 0)
                            {
                                fittingPrice = fittingPrice - favourableLimit;
                            }
                            strfittingPrice += fittingPrice;
                            fittingInfo += "&nbsp;+&nbsp;" + prodt.Rows[0]["pro_Name"].ToString() + "&nbsp;(" + fittingProCountArr[f] + ")";
                        }
                    }
                }
            }
            fittingProductWeight = productWeight;
            FittingProductCount = productCount;
            fittingTotalPrice = strfittingPrice;
            fittingProductInfo = fittingInfo;
            fittingProductIntergal=productIntergal;
        }
Пример #2
0
 private void del(string StrID)
 {
     ShowShop.BLL.Product.ProductInfo bll = new ShowShop.BLL.Product.ProductInfo();
     ShowShop.BLL.Product.ProductAlbum pabll = new ShowShop.BLL.Product.ProductAlbum();
     ShowShop.BLL.Product.ProductSparepart sbll = new ShowShop.BLL.Product.ProductSparepart();
     DataTable dt = bll.GetPartData(StrID);
     if (dt.Rows.Count > 0)
     {
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             ChangeHope.Common.FileHelper fh = new ChangeHope.Common.FileHelper();
             if (!dt.Rows[i]["pro_Original"].ToString().Contains("http://"))
             {
                 fh.DeleteFile(Server.MapPath("~//" + dt.Rows[i]["pro_Original"].ToString()));
             }
             sbll.DeleteProductSparepart(Convert.ToInt32(dt.Rows[i]["pro_ID"].ToString()));
         }
     }
     bll.Delete(StrID);
     pabll.DelAll(StrID);
     Response.Write("ok");
 }