Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int id = RequestHelper.GetQueryString <int>("Id");
                if (id != int.MinValue)
                {
                    CheckAdminPower("ReadPointProduct", PowerCheckType.Single);
                    pointProduct = PointProductBLL.Read(id);

                    Name.Text     = pointProduct.Name;
                    SubTitle.Text = pointProduct.SubTitle;

                    Point.Text      = pointProduct.Point.ToString();
                    TotalCount.Text = pointProduct.TotalStorageCount.ToString();
                    BeginDate.Text  = pointProduct.BeginDate.ToString("yyyy-MM-dd");
                    EndDate.Text    = pointProduct.EndDate.ToString("yyyy-MM-dd");

                    MarketPrice.Text          = pointProduct.MarketPrice.ToString();
                    Photo.Text                = pointProduct.Photo;
                    Introduction.Value        = pointProduct.Introduction1;
                    Introduction_Mobile.Value = pointProduct.Introduction1_Mobile;

                    productPhotoList = ProductPhotoBLL.ReadList(pointProduct.Id, 0);
                }
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region 获取当前分类
            if (RequestHelper.GetQueryString <string>("Action") == "GetThisClass")
            {
                GetthisClass();
            }
            #endregion


            if (!Page.IsPostBack)
            {
                foreach (ArticleClassInfo articleClass in ArticleClassBLL.ReadNamedList())
                {
                    ClassID.Items.Add(new ListItem(articleClass.Name, articleClass.Id.ToString()));
                }
                RealDate.Text = DateTime.Now.ToString("yyyy-MM-dd");
                int articleID = RequestHelper.GetQueryString <int>("ID");
                if (articleID != int.MinValue)
                {
                    productPhotoList = ProductPhotoBLL.ReadList(articleID, 1);
                    CheckAdminPower("ReadArticle", PowerCheckType.Single);
                    ArticleInfo article = ArticleBLL.Read(articleID);
                    Title.Text = article.Title;
                    string classID = article.ClassId;
                    if (classID != string.Empty)
                    {
                        classID = classID.Substring(1, classID.Length - 2);
                        if (classID.IndexOf('|') > -1)
                        {
                            classID = classID.Substring(classID.LastIndexOf('|') + 1);
                        }
                    }
                    ClassID.Text = classID;

                    int thisClassID = 0;
                    int.TryParse(classID, out thisClassID);
                    thisClass = ArticleClassBLL.Read(thisClassID);

                    IsTop.Text           = article.IsTop.ToString();
                    Author.Text          = article.Author;
                    Resource.Text        = article.Resource;
                    Keywords.Text        = article.Keywords;
                    Url.Text             = article.Url;
                    Photo.Text           = article.Photo;
                    Summary.Text         = article.Summary;
                    Content.Value        = article.Content;
                    MobileContent.Value  = article.AddCol2;
                    RealDate.Text        = article.RealDate.ToString();
                    OrderID.Text         = article.OrderId.ToString();
                    FilePath.Text        = article.FilePath;
                    Content1.Value       = article.Content1;
                    MobileContent1.Value = article.Mobilecontent1;
                    Content2.Value       = article.Content2;
                    MobileContent2.Value = article.Mobilecontent2;
                    //Content3.Value = article.AddCol3;
                }
            }
        }
Ejemplo n.º 3
0
        protected override void PageLoad()
        {
            base.PageLoad();

            int id = RequestHelper.GetQueryString <int>("Id");

            Gift = PointProductBLL.Read(id);

            //产品图片
            ProductPhotoList.Add(new ProductPhotoInfo {
                Name = Gift.Name, ImageUrl = Gift.Photo
            });
            ProductPhotoList.AddRange(ProductPhotoBLL.ReadList(Gift.Id, 0));
        }
Ejemplo n.º 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (companyID < 0)
     {
         companyID = CompanyBLL.SystemCompanyId;
     }
     if (!this.Page.IsPostBack)
     {
         this.BindClassBrandAttributeClassStandardType();
         this.ProductClass.DataSource = ProductClassBLL.ReadProductClassUnlimitClass();
         this.productID = RequestHelper.GetQueryString <int>("ID");
         if (this.productID != -2147483648)
         {
             base.CheckAdminPower("ReadProduct", PowerCheckType.Single);
             ProductInfo product = ProductBLL.ReadProduct(this.productID);
             companyID      = product.CompanyID;
             companyName    = CompanyBLL.ReadCompany(product.CompanyID).CompanyName;
             this.Name.Text = product.Name;
             this.Name.Attributes.Add("style", "color:" + product.Color);
             this.color = product.Color;
             //this.FontStyle.Text = product.FontStyle;
             this.ProductNumber.Text       = product.ProductNumber;
             this.ProductClass.ClassIDList = product.ClassID;
             this.Keywords.Text            = product.Keywords;
             brandIDStr                 = product.BrandID;
             this.MarketPrice.Text      = product.MarketPrice.ToString();
             this.Photo.Text            = product.Photo;
             this.Summary.Text          = product.Summary;
             this.Introduction.Value    = product.Introduction;
             this.IsSpecial.Text        = product.IsSpecial.ToString();
             this.IsNew.Text            = product.IsNew.ToString();
             this.IsHot.Text            = product.IsHot.ToString();
             this.IsSale.Text           = product.IsSale.ToString();
             this.IsTop.Text            = product.IsTop.ToString();
             this.Remark.Text           = product.Remark;
             this.AllowComment.Text     = product.AllowComment.ToString();
             this.AttributeClassID.Text = product.AttributeClassID.ToString();
             this.StandardType.Text     = product.StandardType.ToString();
             this.sendCount             = product.SendCount;
             this.Sort.Text             = product.Sort.ToString();
             this.Editor.Text           = product.Editor;
             this.BindRelation(product);
             this.BindTestSetting(product);
             this.productPhotoList = ProductPhotoBLL.ReadProductPhotoByProduct(this.productID);
         }
         this.BindSystemTestSetting();
         this.userGradeList = UserGradeBLL.JoinUserGrade(this.productID);
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// 页面加载
        /// </summary>
        protected override void PageLoad()
        {
            base.PageLoad();
            //singleUnlimitClass.DataSource = RegionBLL.ReadRegionUnlimitClass();
            var regionList = RegionBLL.ReadRegionUnlimitClass();

            regionList.RemoveAll(k => k.FatherID == 0 || (k.FatherID == 1 && k.ClassID != 27));
            regionList.ForEach(k => { if (k.FatherID == 1)
                                      {
                                          k.FatherID = 0;
                                      }
                               });
            singleUnlimitClass.DataSource = regionList;
            //singleUnlimitClass.ClassID = "|27|";
            //singleUnlimitClass.Prefix = "湖南";

            SearchCondition();
            LoadHotProductList();
            artId = RequestHelper.GetQueryString <int>("ID");
            if (artId <= 0)
            {
                artId = 1;
            }
            thisArticle = ArticleBLL.Read(artId);

            switch (thisArticle.ClassId)
            {
            case "|58|54|": topNav = 2;
                break;

            case "|58|55|": topNav = 3;
                break;

            case "|58|56|": topNav = 4;
                break;

            case "|58|57|": topNav = 5;
                break;

            default:
                break;
            }
            proPhotoList = ProductPhotoBLL.ReadList(artId, 1);
            if (RequestHelper.GetQueryString <string>("Action") == "UseMessage")
            {
                UseMessage();
            }
        }
Ejemplo n.º 6
0
        protected void AddProductPhoto(int productId)
        {
            string productPhotoList = RequestHelper.GetForm <string>("ProductPhoto");

            if (!string.IsNullOrEmpty(productPhotoList))
            {
                foreach (string temp in productPhotoList.Split(','))
                {
                    ProductPhotoInfo productPhoto = new ProductPhotoInfo();
                    productPhoto.ProductId = productId;
                    productPhoto.Name      = temp.Split('|')[0];
                    productPhoto.ImageUrl  = temp.Split('|')[1].Replace("75-75", "Original");
                    ProductPhotoBLL.Add(productPhoto);
                }
            }
        }
Ejemplo n.º 7
0
        protected void AddProductPhoto(int productID)
        {
            string form = RequestHelper.GetForm <string>("ProductPhoto");

            if (form != string.Empty)
            {
                foreach (string str2 in form.Split(new char[] { ',' }))
                {
                    ProductPhotoInfo productPhoto = new ProductPhotoInfo();
                    productPhoto.ProductID = productID;
                    productPhoto.Name      = str2.Split(new char[] { '|' })[0];
                    productPhoto.Photo     = str2.Split(new char[] { '|' })[1];
                    ProductPhotoBLL.AddProductPhoto(productPhoto);
                }
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 添加产品图片
        /// </summary>
        /// <param name="productID"></param>
        protected void AddProductPhoto(int productID)
        {
            string productPhotoList = RequestHelper.GetForm <string>("ProductPhoto");

            if (productPhotoList != string.Empty)
            {
                foreach (string temp in productPhotoList.Split(','))
                {
                    ProductPhotoInfo productPhoto = new ProductPhotoInfo();
                    productPhoto.ProductId = productID;
                    productPhoto.Name      = temp.Split('|')[0];
                    productPhoto.ImageUrl  = temp.Split('|')[1];
                    ProductPhotoBLL.Add(productPhoto);
                }
            }
        }
Ejemplo n.º 9
0
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            int productId = RequestHelper.GetQueryString <int>("Id");

            PointProductInfo pointProductSubmit = PointProductBLL.Read(productId);

            pointProductSubmit.Id                = productId;
            pointProductSubmit.Name              = Name.Text;
            pointProductSubmit.SubTitle          = SubTitle.Text;
            pointProductSubmit.Point             = Convert.ToInt32(Point.Text);
            pointProductSubmit.TotalStorageCount = Convert.ToInt32(TotalCount.Text);
            pointProductSubmit.BeginDate         = Convert.ToDateTime(BeginDate.Text);
            pointProductSubmit.EndDate           = Convert.ToDateTime(EndDate.Text);

            pointProductSubmit.MarketPrice          = Convert.ToDecimal(MarketPrice.Text);
            pointProductSubmit.Photo                = Photo.Text;
            pointProductSubmit.Introduction1        = Introduction.Value;
            pointProductSubmit.Introduction1_Mobile = Introduction_Mobile.Value;
            pointProductSubmit.IsSale               = RequestHelper.GetForm <int>("IsSale");
            pointProductSubmit.AddDate              = RequestHelper.DateNow;

            string alertMessage = ShopLanguage.ReadLanguage("AddOK");

            if (pointProductSubmit.Id <= 0)
            {
                CheckAdminPower("AddPointProduct", PowerCheckType.Single);

                int id = PointProductBLL.Add(pointProductSubmit);
                if (id > 0)
                {
                    AddProductPhoto(id);
                }
                AdminLogBLL.Add(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("PointProduct"), id);
            }
            else
            {
                CheckAdminPower("UpdatePointProduct", PowerCheckType.Single);

                ProductPhotoBLL.DeleteList(productId, 0);
                AddProductPhoto(productId);
                PointProductBLL.Update(pointProductSubmit);
                AdminLogBLL.Add(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("PointProduct"), pointProductSubmit.Id);
                alertMessage = ShopLanguage.ReadLanguage("UpdateOK");
            }
            ScriptHelper.Alert(alertMessage, RequestHelper.RawUrl);
        }
Ejemplo n.º 10
0
        protected override void PageLoad()
        {
            base.PageLoad();

            int id = RequestHelper.GetQueryString <int>("id");

            product = ProductBLL.Read(id);
            if (product.IsSale == (int)BoolType.False)
            {
                ScriptHelper.AlertFront("该产品未上市,不能查看");
            }
            //如果为移动端单独设置了内容,则取移动端内容
            if (!string.IsNullOrEmpty(product.Introduction1_Mobile))
            {
                product.Introduction1 = product.Introduction1_Mobile;
            }
            if (!string.IsNullOrEmpty(product.Introduction2_Mobile))
            {
                product.Introduction2 = product.Introduction2_Mobile;
            }
            if (!string.IsNullOrEmpty(product.Introduction3_Mobile))
            {
                product.Introduction3 = product.Introduction3_Mobile;
            }

            //更新查看数量
            Dictionary <string, object> dict = new Dictionary <string, object>();

            dict.Add("ViewCount", product.ViewCount + 1);
            ProductBLL.UpdatePart(ProductInfo.TABLENAME, dict, id);

            if (product.BrandId > 0)
            {
                productBrand = ProductBrandBLL.Read(product.BrandId);
            }
            productPhotoList = ProductPhotoBLL.ReadList(id, 0);
            attributeRecords = ProductTypeAttributeRecordBLL.ReadList(id);
            standardRecords  = ProductTypeStandardRecordBLL.ReadList(id);

            //搜索优化
            Title       = product.Name;
            Keywords    = string.IsNullOrEmpty(product.Keywords) ? product.Name : product.Keywords;
            Description = string.IsNullOrEmpty(product.Summary) ? StringHelper.Substring(StringHelper.KillHTML(product.Introduction1), 200) : product.Summary;
        }
Ejemplo n.º 11
0
        protected override void PageLoad()
        {
            base.PageLoad();

            int id = RequestHelper.GetQueryString <int>("Id");

            gift = PointProductBLL.Read(id);
            //如果暂未开始或者已经结束
            if (gift.EndDate.Date < DateTime.Now.Date || gift.BeginDate.Date > DateTime.Now.Date)
            {
                ResponseHelper.Redirect("/pointproduct.html");
            }

            //产品图片
            photoList.Add(new ProductPhotoInfo {
                Name = gift.Name, ImageUrl = gift.Photo
            });
            photoList.AddRange(ProductPhotoBLL.ReadList(gift.Id, 0));

            Title = gift.Name + " - 积分商品兑换";
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 页面加载
        /// </summary>
        protected override void PageLoad()
        {
            base.PageLoad();
            int id = RequestHelper.GetQueryString <int>("ID");

            if (id <= 0)
            {
                ScriptHelper.AlertFront("该产品未上市,不能查看");
            }
            product = ProductBLL.Read(id);
            if (product.IsSale == (int)BoolType.False || product.IsDelete == 1)
            {
                ScriptHelper.Alert("该产品未上市,不能查看");
            }
            //产品图片
            ProductPhotoInfo productPhoto = new ProductPhotoInfo();

            productPhoto.Name     = product.Name;
            productPhoto.ImageUrl = product.Photo;
            productPhotoList.Add(productPhoto);
            productPhotoList.AddRange(ProductPhotoBLL.ReadList(id, 0));
        }
Ejemplo n.º 13
0
        protected override void PageLoad()
        {
            base.PageLoad();
            int queryString = RequestHelper.GetQueryString <int>("ID");

            this.product = ProductBLL.ReadProduct(queryString);
            if (this.product.IsSale == 0)
            {
                ScriptHelper.Alert("该产品未上市,不能查看");
            }
            ProductBLL.ChangeProductViewCount(queryString, 1);
            ProductPhotoInfo item = new ProductPhotoInfo();

            item.Name  = this.product.Name;
            item.Photo = this.product.Photo;
            this.productPhotoList.Add(item);
            this.productPhotoList.AddRange(ProductPhotoBLL.ReadProductPhotoByProduct(queryString));

            this.attributeRecordList = AttributeRecordBLL.ReadAttributeRecordByProduct(queryString);

            TeacherSearchInfo teacherSearch = new TeacherSearchInfo();

            teacherSearch.InProductID = product.ID.ToString();
            ITeacherBLL teacherBLL = new TeacherBLL();

            teacherList = teacherBLL.ReadList(teacherSearch);

            if (ShopConfig.ReadConfigInfo().ProductStorageType == 1)
            {
                this.leftStorageCount = this.product.TotalStorageCount - this.product.OrderCount;
            }
            else
            {
                this.leftStorageCount = this.product.ImportVirtualStorageCount;
            }
            base.Title       = this.product.Name;
            base.Keywords    = (this.product.Keywords == string.Empty) ? this.product.Name : this.product.Keywords;
            base.Description = (this.product.Summary == string.Empty) ? StringHelper.Substring(StringHelper.KillHTML(this.product.Introduction), 200) : this.product.Summary;
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 页面加载
        /// </summary>
        protected override void PageLoad()
        {
            base.PageLoad();

            int count = int.MinValue;

            topNav = 2;
            int id = RequestHelper.GetQueryString <int>("ID");

            if (id <= 0)
            {
                ScriptHelper.AlertFront("该产品未上市,不能查看");
            }
            string fromwhere = RequestHelper.GetQueryString <string>("fw");

            product = ProductBLL.Read(id);
            if (product.IsSale == (int)BoolType.False || product.IsDelete == 1)
            {
                if (fromwhere.ToLower() != "admin")
                {
                    ScriptHelper.AlertFront("该产品未上市,不能查看");
                }
                else
                {
                    if (Cookies.Admin.GetAdminID(true) == 0)//用户未登录
                    {
                        ScriptHelper.AlertFront("该产品未上市,不能查看");
                    }
                }
            }

            navList = ProductClassBLL.ProductClassNameList(product.ClassId);
            //更新查看数量
            if (CookiesHelper.ReadCookie("productview" + product.Id + "") == null)
            {
                ProductBLL.ChangeViewCount(id, 1);
                CookiesHelper.AddCookie("productview" + product.Id + "", product.Id.ToString());
            }
            ProductCommentSearchInfo proCommSear = new ProductCommentSearchInfo();

            proComm = ProductCommentBLL.SearchProductCommentList(proCommSear = new ProductCommentSearchInfo {
                ProductId = product.Id
            });

            //会员等级
            userGradeList = UserGradeBLL.ReadList();
            //产品价格
            int hotCount = 0;

            currentMemberPrice = ProductBLL.GetCurrentPrice(product.SalePrice, base.GradeID);
            hotProductList     = ProductBLL.SearchList(1, 7, new ProductSearchInfo {
                IsHot = (int)BoolType.True, IsSale = (int)BoolType.True, IsDelete = (int)BoolType.False, NotInProductId = product.Id.ToString()
            }, ref hotCount);
            ishot = ProductBLL.SearchList(1, 7, new ProductSearchInfo {
                IsHot = (int)BoolType.True, IsSale = (int)BoolType.True, IsTop = (int)BoolType.True, IsDelete = (int)BoolType.False, NotInProductId = product.Id.ToString()
            }, ref hotCount);
            proishot = ProductBLL.SearchList(1, 3, new ProductSearchInfo {
                IsSale = (int)BoolType.True, IsTop = (int)BoolType.True, IsDelete = (int)BoolType.False, NotInProductId = product.Id.ToString()
            }, ref hotCount);

            //产品图片
            ProductPhotoInfo productPhoto = new ProductPhotoInfo();

            productPhoto.Name     = product.Name;
            productPhoto.ImageUrl = product.Photo;
            productPhotoList.Add(productPhoto);
            productPhotoList.AddRange(ProductPhotoBLL.ReadList(id, 0));
            // 关联产品,配件,浏览过的商品
            strHistoryProduct = Server.UrlDecode(CookiesHelper.ReadCookieValue("HistoryProduct"));
            string tempStrProductID = product.RelationProduct + "," + product.Accessory + "," + strHistoryProduct;

            tempStrProductID = tempStrProductID.Replace(",,", ",");
            if (tempStrProductID.StartsWith(","))
            {
                tempStrProductID = tempStrProductID.Substring(1);
            }
            if (tempStrProductID.EndsWith(","))
            {
                tempStrProductID = tempStrProductID.Substring(0, tempStrProductID.Length - 1);
            }
            ProductSearchInfo productSearch = new ProductSearchInfo();

            productSearch.InProductId = tempStrProductID;
            tempProductList           = ProductBLL.SearchList(productSearch);

            //属性
            attributeRecordList = ProductTypeAttributeRecordBLL.ReadList(id);

            //产品文章
            if (product.RelationArticle != string.Empty)
            {
                ArticleSearchInfo articleSearch = new ArticleSearchInfo();
                articleSearch.InArticleId = product.RelationArticle;
                productArticleList        = ArticleBLL.SearchList(articleSearch);
            }
            //产品规格
            standardRecordList = ProductTypeStandardRecordBLL.ReadListByProduct(product.Id, product.StandardType);
            if (standardRecordList.Count > 0)
            {
                string[] standardIDArray = standardRecordList[0].StandardIdList.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                for (int i = 0; i < standardIDArray.Length; i++)
                {
                    int standardID = Convert.ToInt32(standardIDArray[i]);
                    ProductTypeStandardInfo standard = ProductTypeStandardBLL.Read(standardID);
                    string[] valueArray = standard.ValueList.Split(';');
                    string   valueList  = string.Empty;
                    for (int k = 0; k < valueArray.Length; k++)
                    {
                        foreach (ProductTypeStandardRecordInfo standardRecord in standardRecordList)
                        {
                            string[] tempValueArray = standardRecord.ValueList.Split(';');
                            if (valueArray[k] == tempValueArray[i])
                            {
                                valueList += valueArray[k] + ";";
                                break;
                            }
                        }
                    }
                    if (valueList != string.Empty)
                    {
                        valueList = valueList.Substring(0, valueList.Length - 1);
                    }
                    standard.ValueList = valueList;
                    standardList.Add(standard);
                }
                //规格值
                foreach (ProductTypeStandardRecordInfo standardRecord in standardRecordList)
                {
                    standardRecordValueList += standardRecord.ProductId + ";" + standardRecord.ValueList + "|";
                }
            }
            //计算剩余库存量

            leftStorageCount = product.TotalStorageCount - product.OrderCount;

            //搜索优化
            Title       = (product.SubTitle == string.Empty) ? product.Name : product.SubTitle;
            Keywords    = (product.Keywords == string.Empty) ? product.Name : product.Keywords;
            Description = (product.Summary == string.Empty) ? StringHelper.Substring(StringHelper.KillHTML(product.Introduction1), 200) : product.Summary;
        }
Ejemplo n.º 15
0
        public ActionResult UploadImage()
        {
            string filePath = "/Upload/ProductPhoto/Original/" + RequestHelper.DateNow.ToString("yyyyMM") + "/";

            if (FileHelper.SafeFullDirectoryName(filePath))
            {
                try
                {
                    //上传文件
                    UploadHelper upload = new UploadHelper();
                    upload.Path           = "/Upload/ProductPhoto/Original/" + RequestHelper.DateNow.ToString("yyyyMM") + "/";
                    upload.FileType       = ShopConfig.ReadConfigInfo().UploadFile;
                    upload.FileNameType   = FileNameType.Guid;
                    upload.MaxWidth       = ShopConfig.ReadConfigInfo().AllImageWidth;  //整站图片压缩开启后的压缩宽度
                    upload.AllImageIsNail = ShopConfig.ReadConfigInfo().AllImageIsNail; //整站图片压缩开关
                    int needNail = RequestHelper.GetQueryString <int>("NeedNail");
                    if (needNail <= 0)
                    {
                        upload.AllImageIsNail = 0;                                       //如果页面传值不压缩图片,以页面传值为准;
                    }
                    int curMaxWidth = RequestHelper.GetQueryString <int>("CurMaxWidth"); //页面传值最大宽度
                    if (curMaxWidth > 0)
                    {
                        upload.AllImageIsNail = 1;
                        upload.MaxWidth       = curMaxWidth;//如果有页面传值设置图片最大宽度,以页面传值为准
                    }
                    FileInfo file      = null;
                    int      waterType = ShopConfig.ReadConfigInfo().WaterType;

                    //前台上传图片不打水印直接保存
                    file = upload.SaveAs();

                    //生成处理
                    string originalFile = upload.Path + file.Name;
                    string otherFile    = string.Empty;
                    string makeFile     = string.Empty;

                    Dictionary <int, int> dic = new Dictionary <int, int>();

                    if (!dic.ContainsKey(75))
                    {
                        dic.Add(75, 75);                      //后台商品图集默认使用尺寸(如果不存在则手动添加)
                    }
                    foreach (KeyValuePair <int, int> de in dic)
                    {
                        makeFile   = originalFile.Replace("Original", de.Key + "-" + de.Value);
                        otherFile += makeFile + "|";
                        ImageHelper.MakeThumbnailImage(ServerHelper.MapPath(originalFile), ServerHelper.MapPath(makeFile), Convert.ToInt32(de.Key), Convert.ToInt32(de.Value), ThumbnailType.AllFix);
                    }
                    otherFile = otherFile.Substring(0, otherFile.Length - 1);
                    int proStyle = RequestHelper.GetForm <int>("proStyle");
                    if (proStyle < 0)
                    {
                        proStyle = 0;
                    }

                    int pcid = RequestHelper.GetForm <int>("pcid");
                    ProductPhotoInfo productPhoto = new ProductPhotoInfo();
                    productPhoto.ProductId = pcid;
                    productPhoto.ImageUrl  = originalFile;
                    productPhoto.ProStyle  = proStyle;
                    productPhoto.OrderId   = 0;

                    ProductPhotoBLL.Add(productPhoto);
                    return(Content("ok|" + originalFile.Replace("Original", "75-75")));
                }
                catch (Exception ex)
                {
                    return(Content(ex.Message));
                }
            }
            else
            {
                return(Content(ShopLanguage.ReadLanguage("ErrorPathName")));
            }
        }
Ejemplo n.º 16
0
        public ActionResult Detail(int id)
        {
            int userGrade = UserGradeBLL.ReadByMoney(0).Id;
            int uid       = RequestHelper.GetForm <int>("uid");
            var user      = UserBLL.ReadUserMore(uid);

            if (user.Id > 0)
            {
                userGrade     = UserGradeBLL.ReadByMoney(user.MoneyUsed).Id;
                user.UserName = HttpUtility.UrlDecode(user.UserName, System.Text.Encoding.UTF8);
            }

            if (id <= 0)
            {
                return(Json(new { ok = false, error = "该产品未上市" }));
            }
            string      fromwhere = RequestHelper.GetQueryString <string>("fw");
            ProductInfo product   = ProductBLL.Read(id);

            if (product.IsSale == (int)BoolType.False || product.IsDelete == 1)
            {
                return(Json(new { ok = false, error = "该产品未上市" }));
            }
            #region 如果商品没有小程序码 则生成并保存
            if (string.IsNullOrWhiteSpace(product.Qrcode))
            {
                string product_miniProramCode = string.Empty;
                CreateMiniProgramCode(product.Id, ref product_miniProramCode, product.Qrcode);
                if (!string.IsNullOrWhiteSpace(product_miniProramCode))
                {//如果调用接口成功生成小程序码(因为只有发布后才能使用此微信接口)
                    Dictionary <string, object> dict = new Dictionary <string, object>();
                    dict.Add("[Qrcode]", product_miniProramCode);
                    ProductBLL.UpdatePart("[Product]", dict, product.Id);
                    product.Qrcode = product_miniProramCode;
                }
            }
            #endregion
            //更新查看数量
            if (CookiesHelper.ReadCookie("productview" + product.Id + "") == null)
            {
                ProductBLL.ChangeViewCount(id, 1);
                CookiesHelper.AddCookie("productview" + product.Id + "", product.Id.ToString());
            }
            ProductCommentSearchInfo proCommSear = new ProductCommentSearchInfo();
            var proComm = ProductCommentBLL.SearchProductCommentList(proCommSear = new ProductCommentSearchInfo {
                ProductId = product.Id, Status = (int)CommentStatus.Show
            });
            var procomlist = new List <VirtualProductCommend>();
            foreach (var item in proComm)
            {
                VirtualProductCommend vpc = new VirtualProductCommend()
                {
                    id         = item.Id,
                    name       = HttpUtility.UrlDecode(item.UserName, Encoding.UTF8),
                    avator     = ShopCommon.ShowImage(UserBLL.Read(item.UserId).Photo),
                    lv         = item.Rank,
                    date       = item.PostDate,
                    content    = item.Content,
                    imglist    = ProductPhotoBLL.ReadList(item.Id, 3),
                    adminreply = item.AdminReplyContent,
                    replydate  = item.AdminReplyDate
                };
                procomlist.Add(vpc);
            }

            //产品价格
            int hotCount           = 0;
            var currentMemberPrice = ProductBLL.GetCurrentPrice(product.SalePrice, userGrade);
            var prorecommend       = ProductBLL.SearchList(1, 8, new ProductSearchInfo {
                IsSale = (int)BoolType.True, IsTop = (int)BoolType.True, IsDelete = (int)BoolType.False, NotInProductId = product.Id.ToString()
            }, ref hotCount);
            var prorelist = new List <ProductVirtualModel>();
            foreach (var item in prorecommend)
            {
                var vp = new ProductVirtualModel()
                {
                    id          = item.Id,
                    name        = item.Name,
                    img         = ShopCommon.ShowImage(item.Photo.Replace("Original", "150-150")),
                    imgbig      = ShopCommon.ShowImage(item.Photo.Replace("Original", "350-350")),
                    imgorg      = ShopCommon.ShowImage(item.Photo),
                    price       = ProductBLL.GetCurrentPrice(item.SalePrice, userGrade),
                    marketprice = item.MarketPrice,
                    click       = item.ViewCount,
                    like        = item.LikeNum,
                    totalstore  = item.StandardType == (int)ProductStandardType.Single ? ProductTypeStandardRecordBLL.GetSumStorageByProduct(item.Id) : item.TotalStorageCount,
                    //ordercount = item.OrderCount
                    //是否启用不限库存,分别计算销量
                    ordercount = item.UnlimitedStorage == 1 ? OrderBLL.GetProductOrderCountDaily(item.Id, item.StandardType, DateTime.Now) : item.OrderCount
                };
                prorelist.Add(vp);
            }
            //产品图片
            List <ProductPhotoInfo> productPhotoList = new List <ProductPhotoInfo>();
            ProductPhotoInfo        productPhoto     = new ProductPhotoInfo();
            productPhoto.Name     = product.Name;
            productPhoto.ImageUrl = product.Photo;
            productPhotoList.Add(productPhoto);
            productPhotoList.AddRange(ProductPhotoBLL.ReadList(id, 0));
            productPhotoList.ForEach(k => k.ImageUrl = k.ImageUrl.Replace("75-75", "Original"));
            //属性
            var attributeRecordList = ProductTypeAttributeRecordBLL.ReadList(id);

            #region 产品规格
            List <ProductTypeStandardInfo> standardList = new List <ProductTypeStandardInfo>();
            string  standardRecordValueList             = "|";
            var     standardRecordList = ProductTypeStandardRecordBLL.ReadListByProduct(product.Id, product.StandardType);
            decimal maxPrice           = product.SalePrice;
            if (standardRecordList.Count > 0)
            {
                string[] standardIDArray = standardRecordList[0].StandardIdList.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                for (int i = 0; i < standardIDArray.Length; i++)
                {
                    int standardID = Convert.ToInt32(standardIDArray[i]);
                    ProductTypeStandardInfo standard = ProductTypeStandardBLL.Read(standardID);
                    string[] valueArray = standard.ValueList.Split(';');
                    string   valueList  = string.Empty;
                    for (int k = 0; k < valueArray.Length; k++)
                    {
                        foreach (ProductTypeStandardRecordInfo standardRecord in standardRecordList)
                        {
                            if (standardRecord.MarketPrice > maxPrice)
                            {
                                maxPrice = standardRecord.MarketPrice;
                            }
                            string[] tempValueArray = standardRecord.ValueList.Split(';');
                            if (valueArray[k] == tempValueArray[i])
                            {
                                valueList += valueArray[k] + ";";
                                break;
                            }
                        }
                    }
                    if (valueList != string.Empty)
                    {
                        valueList = valueList.Substring(0, valueList.Length - 1);
                    }
                    standard.ValueList = valueList;
                    standardList.Add(standard);
                }
                //规格值
                foreach (ProductTypeStandardRecordInfo standardRecord in standardRecordList)
                {
                    standardRecordValueList += standardRecord.ProductId + ";" + standardRecord.ValueList + "|";
                }
            }
            #endregion
            #region 正在开的团(进行中,排除本人开的团)
            GroupBuySearchInfo gpsearch = new GroupBuySearchInfo
            {
                ProductId = product.Id,
                //NotLeader = user.Id,
                Status = (int)GroupBuyStatus.Going
            };
            List <GroupBuyInfo> gpList = GroupBuyBLL.SearchList(gpsearch);
            gpList.ForEach(k => k.groupSignList = GroupSignBLL.ReadListByGroupId(k.Id));
            gpList.ForEach(k => k.GroupUserName = System.Web.HttpUtility.UrlDecode(k.GroupUserName, Encoding.UTF8));
            #endregion
            return(Json(new
            {
                ok = true,
                product = new
                {
                    id = product.Id,
                    img = ShopCommon.ShowImage(product.Photo.Replace("Original", "350-350")),
                    imgorg = ShopCommon.ShowImage(product.Photo),
                    title = product.Name,
                    summary = product.Summary,
                    price = currentMemberPrice,
                    marketprice = product.MarketPrice,
                    intro = string.IsNullOrEmpty(product.Introduction1_Mobile) ? product.Introduction1 : product.Introduction1_Mobile,
                    remark = product.Remark,
                    totalstore = product.StandardType == (int)ProductStandardType.Single ? ProductTypeStandardRecordBLL.GetSumStorageByProduct(product.Id) : product.TotalStorageCount,
                    ordercount = product.UnlimitedStorage == 1 ? OrderBLL.GetProductOrderCountDaily(product.Id, product.StandardType, DateTime.Now) : product.OrderCount,
                    unlimitedstorage = product.UnlimitedStorage,
                    virtualordercount = product.VirtualOrderCount,
                    usevirtualorder = product.UseVirtualOrder,
                    opengroup = product.OpenGroup,
                    groupprice = product.GroupPrice,
                    groupquantity = product.GroupQuantity,
                    qrcode = product.Qrcode,
                    groupphoto = string.IsNullOrWhiteSpace(product.GroupPhoto) ? product.Photo : product.GroupPhoto
                },
                standardList = standardList,
                standardRecordValueList = standardRecordValueList,
                attributeRecordList = attributeRecordList,
                productPhotoList = productPhotoList,
                prorecommend = prorelist,
                proComm = procomlist,
                maxPrice = maxPrice,
                groupList = gpList
            }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 17
0
        protected override void PageLoad()
        {
            base.PageLoad();

            string action = RequestHelper.GetQueryString <string>("Action");

            switch (action)
            {
            case "GetStandardPrice":
                GetStandardPrice();
                break;

            case "Like":
                Like();
                break;

            case "Collect":
                Collect();
                break;
            }

            int id = RequestHelper.GetQueryString <int>("id");

            product = ProductBLL.Read(id);
            if (product.IsSale == (int)BoolType.False)
            {
                ScriptHelper.AlertFront("该产品未上市,不能查看");
            }

            //更新查看数量
            Dictionary <string, object> dict = new Dictionary <string, object>();

            dict.Add("ViewCount", product.ViewCount + 1);
            ProductBLL.UpdatePart(ProductInfo.TABLENAME, dict, id);

            if (product.BrandId > 0)
            {
                productBrand = ProductBrandBLL.Read(product.BrandId);
            }
            if (product.ShopId > 0)
            {
                shop = UserBLL.Read(product.ShopId);
            }
            productPhotoList = ProductPhotoBLL.ReadList(id, 0);
            attributeRecords = ProductTypeAttributeRecordBLL.ReadList(id);
            standardRecords  = ProductTypeStandardRecordBLL.ReadList(id);
            //导航路径
            listPaths = ProductClassBLL.ReadNavigationPath(product.ClassId);
            listPaths.ForEach(k => paths += string.Format(k[0], k[1], k[2]));

            //排行榜
            //按销量倒序
            int count = 0;

            topProductList = ProductBLL.SearchList(1, 6, new ProductSearchInfo {
                ClassId = product.ClassId, IsSale = (int)BoolType.True, ProductOrderType = "SendCount", OrderType = OrderType.Desc
            }, ref count);

            //同类推荐
            classProductList = ProductBLL.SearchList(1, 3, new ProductSearchInfo {
                ClassId = product.ClassId, IsSale = (int)BoolType.True, IsTop = (int)BoolType.True
            }, ref count);

            //搜索优化
            Title       = product.Name;
            Keywords    = string.IsNullOrEmpty(product.Keywords) ? product.Name : product.Keywords;
            Description = string.IsNullOrEmpty(product.Summary) ? StringHelper.Substring(StringHelper.KillHTML(product.Introduction1), 200) : product.Summary;
        }
Ejemplo n.º 18
0
        protected override void PageLoad()
        {
            base.PageLoad();
            int queryString = RequestHelper.GetQueryString <int>("ID");

            this.product = ProductBLL.ReadProduct(queryString);
            if (this.product.IsSale == 0)
            {
                ScriptHelper.Alert("该产品未上市,不能查看");
            }
            ProductBLL.ChangeProductViewCount(queryString, 1);
            this.userGradeList      = UserGradeBLL.ReadUserGradeCacheList();
            this.memberPriceList    = MemberPriceBLL.ReadMemberPriceByProduct(queryString);
            this.currentMemberPrice = (this.product.MarketPrice * UserGradeBLL.ReadUserGradeCache(base.GradeID).Discount) / 100M;
            foreach (MemberPriceInfo info in this.memberPriceList)
            {
                if (info.GradeID == base.GradeID)
                {
                    this.currentMemberPrice = info.Price;
                    break;
                }
            }
            this.currentMemberPrice = Math.Round(this.currentMemberPrice, 2);
            ProductPhotoInfo item = new ProductPhotoInfo();

            item.Name  = this.product.Name;
            item.Photo = this.product.Photo;
            this.productPhotoList.Add(item);
            this.productPhotoList.AddRange(ProductPhotoBLL.ReadProductPhotoByProduct(queryString));
            this.strHistoryProduct = base.Server.UrlDecode(CookiesHelper.ReadCookieValue("HistoryProduct"));
            string strProductID = (this.product.RelationProduct + "," + this.product.Accessory + "," + this.strHistoryProduct).Replace(",,", ",");

            if (strProductID.StartsWith(","))
            {
                strProductID = strProductID.Substring(1);
            }
            if (strProductID.EndsWith(","))
            {
                strProductID = strProductID.Substring(0, strProductID.Length - 1);
            }
            ProductSearchInfo productSearch = new ProductSearchInfo();

            productSearch.InProductID = strProductID;
            this.tempProductList      = ProductBLL.SearchProductList(productSearch);
            if (strProductID != string.Empty)
            {
                this.tempMemberPriceList = MemberPriceBLL.ReadMemberPriceByProductGrade(strProductID, base.GradeID);
            }
            this.attributeRecordList = AttributeRecordBLL.ReadAttributeRecordByProduct(queryString);
            TagsSearchInfo tags = new TagsSearchInfo();

            tags.ProductID       = queryString;
            this.productTagsList = TagsBLL.SearchTagsList(tags);
            if (this.product.RelationArticle != string.Empty)
            {
                ArticleSearchInfo articleSearch = new ArticleSearchInfo();
                articleSearch.InArticleID = this.product.RelationArticle;
                this.productArticleList   = ArticleBLL.SearchArticleList(articleSearch);
            }
            this.standardRecordList = StandardRecordBLL.ReadStandardRecordByProduct(this.product.ID, this.product.StandardType);
            if ((this.standardRecordList.Count > 0) && (this.product.StandardType == 1))
            {
                string[] strArray = this.standardRecordList[0].StandardIDList.Split(new char[] { ',' });
                for (int i = 0; i < strArray.Length; i++)
                {
                    StandardInfo info6     = StandardBLL.ReadStandardCache(Convert.ToInt32(strArray[i]));
                    string[]     strArray2 = info6.ValueList.Split(new char[] { ',' });
                    string[]     strArray3 = info6.PhotoList.Split(new char[] { ',' });
                    string       str2      = string.Empty;
                    string       str3      = string.Empty;
                    for (int j = 0; j < strArray2.Length; j++)
                    {
                        foreach (StandardRecordInfo info7 in this.standardRecordList)
                        {
                            string[] strArray4 = info7.ValueList.Split(new char[] { ',' });
                            if (strArray2[j] == strArray4[i])
                            {
                                str2 = str2 + strArray2[j] + ",";
                                str3 = str3 + strArray3[j] + ",";
                                goto Label_043B;
                            }
                        }
                        Label_043B :;
                    }
                    if (str2 != string.Empty)
                    {
                        str2 = str2.Substring(0, str2.Length - 1);
                        str3 = str3.Substring(0, str3.Length - 1);
                    }
                    info6.ValueList = str2;
                    info6.PhotoList = str3;
                    this.standardList.Add(info6);
                }
                foreach (StandardRecordInfo info7 in this.standardRecordList)
                {
                    object standardRecordValueList = this.standardRecordValueList;
                    this.standardRecordValueList = string.Concat(new object[] { standardRecordValueList, info7.ProductID, ",", info7.ValueList, "|" });
                }
            }
            if (ShopConfig.ReadConfigInfo().ProductStorageType == 1)
            {
                this.leftStorageCount = this.product.TotalStorageCount - this.product.OrderCount;
            }
            else
            {
                this.leftStorageCount = this.product.ImportVirtualStorageCount;
            }
            base.Title       = this.product.Name;
            base.Keywords    = (this.product.Keywords == string.Empty) ? this.product.Name : this.product.Keywords;
            base.Description = (this.product.Summary == string.Empty) ? StringHelper.Substring(StringHelper.KillHTML(this.product.Introduction), 200) : this.product.Summary;
        }
Ejemplo n.º 19
0
        ///   <summary>
        ///   从图片中截取部分生成新图
        ///   </summary>
        ///   <param   name="sFromFilePath">原始图片</param>
        ///   <param   name="saveFilePath">生成新图</param>
        ///   <param   name="width">截取图片宽度</param>
        ///   <param   name="height">截取图片高度</param>
        ///   <param   name="spaceX">截图图片X坐标</param>
        ///   <param   name="spaceY">截取图片Y坐标</param>
        public void CaptureImage(string sFromFilePath, string saveFilePath, int width, int height, int spaceX, int spaceY, string tarimg, string targetID)
        {
            //载入底图
            System.Drawing.Image  fromImage = System.Drawing.Image.FromFile(sFromFilePath);
            System.Drawing.Bitmap bitmap    = new System.Drawing.Bitmap(width, height);
            //创建作图区域
            System.Drawing.Graphics graphic = System.Drawing.Graphics.FromImage(bitmap);
            //截取原图相应区域写入作图区
            graphic.DrawImage(fromImage, new System.Drawing.Rectangle(0, 0, width, height), new System.Drawing.Rectangle(spaceX, spaceY, width, height), System.Drawing.GraphicsUnit.Pixel);
            //从作图区生成新图
            System.Drawing.Image saveImage = System.Drawing.Image.FromHbitmap(bitmap.GetHbitmap());
            //保存图象
            saveImage.Save(saveFilePath, ImageFormat.Jpeg);
            bitmap.Dispose();
            graphic.Dispose();
            saveImage.Dispose();
            fromImage.Dispose();

            //string delTarget = tarimg.Replace("nail.", ".");
            //FileHelper.DeleteFile(new List<string> { delTarget });//删除原图
            FileHelper.DeleteFile(new List <string> {
                tarimg
            });                                                //删除原图

            string delTarget = saveFilePath.Replace(Server.MapPath("/"), "");

            //FileInfo fileInfo = new FileInfo(saveFilePath);
            //fileInfo.MoveTo(sFromFilePath);

            if (makeNail == 1)//是否需要生成缩略图
            {
                string makeFile = string.Empty;
                //if (targetType == 0)
                //{
                Dictionary <int, int> dic = new Dictionary <int, int>();
                if (tableID == ProductBLL.TableID)
                {
                    foreach (var phototype in PhotoSizeBLL.SearchList((int)PhotoType.Product))
                    {
                        dic.Add(phototype.Width, phototype.Height);
                    }
                    if (!dic.ContainsKey(90))
                    {
                        dic.Add(90, 90);                          //后台商品列表默认使用尺寸(如果不存在则手动添加)
                    }
                }
                else if (tableID == ProductBrandBLL.TableID)
                {
                    dic.Add(88, 31);
                }
                else if (tableID == ThemeActivityBLL.TableID)
                {
                    dic.Add(300, 150);
                }
                else if (tableID == ArticleBLL.TableID)
                {
                    dic.Add(90, 90);    //后台列表缩略图
                    dic.Add(200, 150);  //前台列表缩略图
                }
                else if (tableID == ProductPhotoBLL.TableID)
                {
                    foreach (var phototype in PhotoSizeBLL.SearchList((int)PhotoType.ProductPhoto))
                    {
                        dic.Add(phototype.Width, phototype.Height);
                    }
                    if (!dic.ContainsKey(75))
                    {
                        dic.Add(75, 75);                          //后台商品图集默认使用尺寸(如果不存在则手动添加)
                    }
                }
                if (dic.Count > 0)
                {
                    foreach (KeyValuePair <int, int> kv in dic)
                    {
                        //string nailStr = delTarget.Replace("Original", kv.Key.ToString() + "-" + kv.Value.ToString());
                        string nailStr = tarimg.Replace("Original", kv.Key.ToString() + "-" + kv.Value.ToString());

                        FileHelper.DeleteFile(new List <string> {
                            nailStr
                        });                                                     //删除原有缩略图
                        //makeFile = nailStr;
                        makeFile = delTarget.Replace("Original", kv.Key.ToString() + "-" + kv.Value.ToString());
                        ImageHelper.MakeThumbnailImage(ServerHelper.MapPath(delTarget), ServerHelper.MapPath(makeFile), kv.Key, kv.Value, ThumbnailType.InBox);
                    }
                }
                //}
                //else
                //{

                //    Hashtable ht = new Hashtable();
                //    if (tableID == ProductPhotoBLL.TableID)
                //    {
                //        foreach (var phototype in PhotoSizeBLL.SearchList((int)PhotoType.ProductPhoto))
                //        {
                //            ht.Add(phototype.Width, phototype.Height);
                //        }
                //        if (!ht.ContainsKey(75)) ht.Add(75, 75);//后台商品图集默认使用尺寸(如果不存在则手动添加)
                //    }
                //    else
                //    {
                //        ht.Add("75", "75");
                //        ht.Add("350", "350");
                //    }
                //    foreach (DictionaryEntry de in ht)
                //    {
                //        string nailStr = delTarget.Replace("Original", de.Key + "-" + de.Value);
                //        FileHelper.DeleteFile(new List<string> { nailStr });//删除原有缩略图
                //        makeFile = nailStr;
                //        ImageHelper.MakeThumbnailImage(ServerHelper.MapPath(delTarget), ServerHelper.MapPath(makeFile), Convert.ToInt32(de.Key), Convert.ToInt32(de.Value), ThumbnailType.InBox);
                //    }
                //}
            }
            //parent.layer.close(index);
            string strp_img2 = saveFilePath.Substring(saveFilePath.LastIndexOf('/'), saveFilePath.Length - saveFilePath.LastIndexOf('/'));

            if (targetType == 1)//产品多图
            {
                if (ProductID <= 0)
                {//添加
                    //Response.Write("<script>alert('裁剪成功');var index = parent.layer.getFrameIndex(window.name); parent.$('#" + targetID + ">img').attr('src','" + delTarget + "'); parent.layer.close(index);</script>");
                    string _str = "<script type='text/javascript' src='/Admin/Js/jquery-1.7.2.min.js'></script><script>alert('裁剪成功');var index = parent.layer.getFrameIndex(window.name);window.parent.editProductPhoto('" + targetID + "', '" + delTarget + "', '" + ProductPhotoID + "');parent.layer.close(index);</script>";
                    //Response.Write("<script>alert('裁剪成功');var index = parent.layer.getFrameIndex(window.name);window.parent.o('" + targetID + "').firstChild.src='" + delTarget + "';window.parent.o('" + targetID + "').getElementsByName('ProductPhoto')[0].value='" + _name + "|" + delTarget + "' ; parent.layer.close(index);</script>");
                    Response.Write("<script type='text/javascript' src='/Admin/Js/jquery-1.7.2.min.js'></script><script>alert('裁剪成功');var index = parent.layer.getFrameIndex(window.name);window.parent.editProductPhoto('" + targetID + "', '" + delTarget + "', '" + ProductPhotoID + "');parent.layer.close(index);</script>");
                }
                else
                {
                    ProductPhotoInfo productPhoto = ProductPhotoBLL.Read(ProductPhotoID, ProStyle);
                    productPhoto.ImageUrl = delTarget;
                    ProductPhotoBLL.Update(productPhoto);
                    string _str = "<script type='text/javascript' src='/Admin/Js/jquery-1.7.2.min.js'></script><script>alert('裁剪成功');var index = parent.layer.getFrameIndex(window.name);window.parent.editProductPhoto('" + targetID + "', '" + delTarget + "', '" + ProductPhotoID + "');parent.layer.close(index);</script>";

                    //Response.Write("<script type='text/javascript' src='/Admin/Js/jquery-1.7.2.min.js'></script><script>alert('裁剪成功');var index = parent.layer.getFrameIndex(window.name);window.parent.o('" + targetID + "').firstChild.src='" + delTarget + "';$('#" + targetID + "').find('.cut').attr('href','javascript:loadCut(\"" + delTarget + "\",\"" + targetID + "\",\"" + ProductPhotoID + "\")');parent.layer.close(index);</script>");
                    Response.Write("<script type='text/javascript' src='/Admin/Js/jquery-1.7.2.min.js'></script><script>alert('裁剪成功');var index = parent.layer.getFrameIndex(window.name);window.parent.editProductPhoto('" + targetID + "', '" + delTarget + "', '" + ProductPhotoID + "');parent.layer.close(index);</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('裁剪成功');var index = parent.layer.getFrameIndex(window.name);window.parent.o('" + targetID + "').value='" + delTarget + "';window.parent.o('firstPhoto').src='" + delTarget + "';parent.layer.close(index); </script>");
            }
        }
Ejemplo n.º 20
0
        protected void ImportProducts(object sender, EventArgs e)
        {
            string categoryId    = ProductClass.ClassID;
            int    saleStatus    = Convert.ToInt32(IsSale.SelectedValue);
            string selectedValue = dropFiles.SelectedValue;

            selectedValue = Path.Combine(_dataPath, selectedValue);

            if (!File.Exists(selectedValue))
            {
                ScriptHelper.Alert("选择的数据包文件有问题!");
            }
            else
            {
                PrepareDataFiles(new object[] { selectedValue });
                string    path        = Path.Combine(_dataPath, Path.GetFileNameWithoutExtension(selectedValue));
                DataTable productData = (DataTable)ProductBLL.ParseProductData(new object[] { path })[0];
                if ((productData != null) && (productData.Rows.Count > 0))
                {
                    foreach (DataRow row in productData.Rows)
                    {
                        ProductInfo product = new ProductInfo
                        {
                            ClassId       = categoryId,
                            Name          = (string)row["ProductName"],
                            ProductNumber = (string)row["SKU"],
                            BrandId       = 0
                        };
                        if (row["Description"] != DBNull.Value)
                        {
                            product.Introduction1 = (string)row["Description"];
                        }
                        product.AddDate           = DateTime.Now;
                        product.IsSale            = saleStatus;
                        product.MarketPrice       = (decimal)row["SalePrice"];
                        product.TotalStorageCount = (int)row["Stock"];

                        product.Spelling  = ChineseCharacterHelper.GetFirstLetter((string)row["ProductName"]);
                        product.SendPoint = 0;
                        product.Weight    = 0;
                        product.IsSpecial = 0;
                        product.IsNew     = 0;
                        product.IsHot     = 0;
                        if (row["Has_ShowCase"] != DBNull.Value)
                        {
                            product.IsTop = Convert.ToInt32(row["Has_ShowCase"]);
                        }
                        product.AllowComment = 0;
                        product.LowerCount   = 0;
                        product.UpperCount   = 0;
                        product.StandardType = 0;
                        product.AddDate      = RequestHelper.DateNow;

                        product.OrderId   = 0;
                        product.SalePrice = (decimal)row["SalePrice"];

                        if (row["ImageUrl1"] != DBNull.Value)
                        {
                            product.Photo = (string)row["ImageUrl1"];
                        }

                        int proID = ProductBLL.Add(product);
                        #region 生成缩略图和产品相册图
                        if (!(string.IsNullOrEmpty(product.Photo) || (product.Photo.Length <= 0)))
                        {
                            UploadImage(product.Photo, PhotoType.Product);
                        }

                        if (row["ImageUrl2"] != DBNull.Value)
                        {
                            ProductPhotoInfo tempPhoto = new ProductPhotoInfo()
                            {
                                ProductId = proID,
                                Name      = "ImageUrl2",
                                ImageUrl  = (string)row["ImageUrl2"],
                                AddDate   = DateTime.Now
                            };
                            ProductPhotoBLL.Add(tempPhoto);
                            UploadImage(tempPhoto.ImageUrl, PhotoType.ProductPhoto);
                        }
                        if (row["ImageUrl3"] != DBNull.Value)
                        {
                            ProductPhotoInfo tempPhoto = new ProductPhotoInfo()
                            {
                                ProductId = proID,
                                Name      = "ImageUrl3",
                                ImageUrl  = (string)row["ImageUrl3"],
                                AddDate   = DateTime.Now
                            };
                            ProductPhotoBLL.Add(tempPhoto);
                            UploadImage(tempPhoto.ImageUrl, PhotoType.ProductPhoto);
                        }
                        if (row["ImageUrl4"] != DBNull.Value)
                        {
                            ProductPhotoInfo tempPhoto = new ProductPhotoInfo()
                            {
                                ProductId = proID,
                                Name      = "ImageUrl4",
                                ImageUrl  = (string)row["ImageUrl4"],
                                AddDate   = DateTime.Now
                            };
                            ProductPhotoBLL.Add(tempPhoto);
                            UploadImage(tempPhoto.ImageUrl, PhotoType.ProductPhoto);
                        }
                        if (row["ImageUrl5"] != DBNull.Value)
                        {
                            ProductPhotoInfo tempPhoto = new ProductPhotoInfo()
                            {
                                ProductId = proID,
                                Name      = "ImageUrl5",
                                ImageUrl  = (string)row["ImageUrl5"],
                                AddDate   = DateTime.Now
                            };
                            ProductPhotoBLL.Add(tempPhoto);
                            UploadImage(tempPhoto.ImageUrl, PhotoType.ProductPhoto);
                        }
                        #endregion
                    }

                    File.Delete(selectedValue);
                    Directory.Delete(path, true);
                    BindFiles();
                    ScriptHelper.Alert("此次商品批量导入操作已成功!", RequestHelper.RawUrl);
                }
            }
        }
Ejemplo n.º 21
0
        private string GetProductCSV()
        {
            StringBuilder builder = new StringBuilder();
            string        format  = "\"{0}\"\t{1}\t\"{2}\"\t{3}\t\"{4}\"\t\"{5}\"\t{6}\t{7}\t{8}\t{9}\t{10}\t{11}\t{12}\t{13}\t{14}\t{15}\t{16}\t{17}\t{18}\t\"{19}\"\t\"{20}\"\t\"{21}\"\t{22}\t{23}\t\"{24}\"\t{25}\t\"{26}\"\t{27}\t\"{28}\"\t\"{29}\"\t\"{30}\"\t\"{31}\"\t\"{32}\"\t\"{33}\"\t\"{34}\"\t{35}\t{36}\t{37}\t{38}\t\"{39}\"\t{40}\t{41}\t\"{42}\"\r\n";

            builder.Append("version 1.00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n");
            builder.Append("title\tcid\tseller_cids\tstuff_status\tlocation_state\tlocation_city\titem_type\tprice\tauction_increment\tnum\tvalid_thru\tfreight_payer\tpost_fee\tems_fee");
            builder.Append("\texpress_fee\thas_invoice\thas_warranty\tapprove_status\thas_showcase\tlist_time\tdescription\tcateProps\tpostage_id\thas_discount\tmodified\tupload_fail_msg");
            builder.Append("\tpicture_status\tauction_point\tpicture\tvideo\tskuProps\tinputPids\tinputValues\touter_id\tpropAlias\tauto_fill\tnum_id\tlocal_cid\tnavigation_type\tuser_name\tsyncStatus\tsubtitle\twireless_desc\r\n");
            builder.Append("宝贝名称\t宝贝类目\t店铺类目\t新旧程度\t省\t城市\t出售方式\t宝贝价格\t加价幅度\t宝贝数量\t有效期\t运费承担\t平邮\tEMS\t快递\t发票\t保修\t放入仓库\t橱窗推荐\t开始时间\t宝贝描述");
            builder.Append("\t宝贝属性\t邮费模版ID\t会员打折\t修改时间\t上传状态\t图片状态\t返点比例\t新图片\t视频\t销售属性组合\t用户输入ID串\t用户输入名-值对\t商家编码\t销售属性别名\t代充类型\t数字ID\t本地ID");
            builder.Append("\t宝贝分类\t账户名称\t宝贝状态\t宝贝卖点(摘要)\t无线详情(手机详情描述)\r\n");
            foreach (var item in ExportList)
            {
                string str2 = string.Empty;; //pc端详情描述,最少5字符,最多25000字符

                if (item.Introduction1.Length >= 5)
                {
                    str2 = this.Trim(StringHelper.Substring(item.Introduction1, 24900, false)).Replace(string.Format("src=\"{0}/upload/attached/image", this.ApplicationPath), string.Format("src=\"{0}/upload/attached/image", this._url));
                }


                //手机端详情描述----不能直接调用本站的
                //string mobileContent = string.IsNullOrEmpty(item.Introduction1_Mobile) ? item.Introduction1 : item.Introduction1_Mobile;
                string mobileContent = string.Empty;
                mobileContent = this.Trim(mobileContent).Replace(string.Format("src=\"{0}/upload/attached/image", this.ApplicationPath), string.Format("src=\"{0}/upload/attached/image", this._url));

                string str3 = string.Empty; //摘要
                if (!string.IsNullOrEmpty(item.Summary))
                {
                    str3 = this.Trim(Convert.ToString(item.Summary).Trim());
                    //if (!string.IsNullOrEmpty(str3) && (str3.Length > 0))
                    //{
                    //    str2 = str3 + "<br/>" + str2;
                    //}
                }
                str2          = str2.Replace("\r\n", "").Replace("\r", "").Replace("\n", "").Replace("\"", "\"\"");
                mobileContent = mobileContent.Replace("\r\n", "").Replace("\r", "").Replace("\n", "").Replace("\"", "\"\"");
                string str4 = string.Empty;
                if (!string.IsNullOrEmpty(item.Photo))
                {
                    str4 = str4 + this.CopyImage(item.Photo, 1);
                }
                int phi = 2;
                foreach (var productPhoto in ProductPhotoBLL.ReadList(item.Id, 0).Take(4))
                {
                    if (!string.IsNullOrEmpty(productPhoto.ImageUrl))
                    {
                        str4 = str4 + this.CopyImage(productPhoto.ImageUrl.Replace("75-75", "Original"), phi);
                        phi++;
                    }
                }
                //if (row["ImageUrl2"] != DBNull.Value)
                //{
                //    str4 = str4 + this.CopyImage((string)row["ImageUrl2"], 2);
                //}
                //if (row["ImageUrl3"] != DBNull.Value)
                //{
                //    str4 = str4 + this.CopyImage((string)row["ImageUrl3"], 3);
                //}
                //if (row["ImageUrl4"] != DBNull.Value)
                //{
                //    str4 = str4 + this.CopyImage((string)row["ImageUrl4"], 4);
                //}
                //if (row["ImageUrl5"] != DBNull.Value)
                //{
                //    str4 = str4 + this.CopyImage((string)row["ImageUrl5"], 5);
                //}
                //DataRow[] rowArray = this._exportData.Tables["skus"].Select("ProductId=" + row["ProductId"].ToString(), "SalePrice desc");
                string str5  = "0";
                int    num   = 0;
                string str6  = "1";
                string str7  = "0";
                string str8  = "0";
                string str9  = "0";
                string str10 = "";
                string str11 = "";//分类ID
                string str12 = "";
                string str13 = item.ProductCode;
                string str14 = "";
                string str15 = "";
                string str16 = "";
                string str17 = "";
                string str18 = "";
                string str19 = "";
                string str20 = "";
                string str21 = "";
                string str22 = "";
                string str23 = "";
                string str24 = "";
                string str25 = "";
                //DataRow[] rowArray2 = this._exportData.Tables["TaobaoSku"].Select("ProductId=" + row["Productid"].ToString());
                //if (rowArray2.Length > 0)
                //{
                //    if (this._includeStock)
                //    {
                //        if ((rowArray2[0]["SkuQuantities"] != null) && (rowArray2[0]["SkuQuantities"].ToString() != ""))
                //        {
                //            string[] strArray = null;
                //            if (rowArray2[0]["SkuQuantities"].ToString().Contains(","))
                //            {
                //                strArray = rowArray2[0]["SkuQuantities"].ToString().Split(new char[] { ',' });
                //            }
                //            else
                //            {
                //                strArray = new string[] { rowArray2[0]["SkuQuantities"].ToString() };
                //            }
                //            foreach (string str26 in strArray)
                //            {
                //                num += Convert.ToInt32(str26);
                //            }
                //        }
                //        else
                //        {
                //            num += Convert.ToInt32(rowArray2[0]["Num"]);
                //        }
                //    }
                //str20 = Convert.ToString(rowArray2[0]["LocationState"]);
                //str21 = Convert.ToString(rowArray2[0]["LocationCity"]);
                //str22 = (Convert.ToString(rowArray2[0]["HasInvoice"]).ToLower() == "true") ? "1" : "0";
                //str23 = (Convert.ToString(rowArray2[0]["HasWarranty"]).ToLower() == "true") ? "1" : "0";
                //str24 = (Convert.ToString(rowArray2[0]["HasDiscount"]).ToLower() == "true") ? "1" : "0";
                //str25 = (rowArray2[0]["StuffStatus"].ToString() == "new") ? "1" : "0";
                str20 = _province;
                str21 = _city;
                str22 = "0";
                str23 = "0";
                str24 = "0";
                str25 = "1";
                //if (Convert.ToString(rowArray2[0]["FreightPayer"]) == "buyer")
                //{
                //    str6 = "2";
                //    str7 = Convert.ToString(rowArray2[0]["PostFee"]);
                //    str8 = Convert.ToString(rowArray2[0]["ExpressFee"]);
                //    str9 = Convert.ToString(rowArray2[0]["EMSFee"]);
                //}
                //str11 = Convert.ToString(rowArray2[0]["Cid"]);
                //str14 = Convert.ToString(rowArray2[0]["PropertyAlias"]);
                //str10 = Convert.ToString(rowArray2[0]["inputpids"]);
                //str12 = Convert.ToString(rowArray2[0]["inputstr"]);
                //str17 = Convert.ToString(rowArray2[0]["SkuQuantities"]);
                //str18 = Convert.ToString(rowArray2[0]["skuPrices"]);
                //str16 = Convert.ToString(rowArray2[0]["SkuProperties"]);
                //str19 = Convert.ToString(rowArray2[0]["SkuOuterIds"]);
                //if (!string.IsNullOrEmpty(str17))
                //{
                //    string[] strArray2 = str17.Split(new char[] { ',' });
                //    string[] strArray3 = str18.Split(new char[] { ',' });
                //    string[] strArray4 = str19.Split(new char[] { ',' });
                //    string[] strArray5 = str16.Split(new char[] { ',' });
                //    for (int i = 0; i < strArray2.Length; i++)
                //    {
                //        string str27 = str15;
                //        str15 = str27 + strArray3[i] + ":" + strArray2[i] + ":" + strArray4[i] + ":" + strArray5[i] + ";";
                //    }
                //}
                //}
                //else if (this._includeStock && (rowArray.Length > 0))
                //{
                //    foreach (DataRow row2 in rowArray)
                //    {
                //        num += (int)row2["Stock"];
                //    }
                //}
                //计算剩余库存量
                int leftStorageCount = 0;
                if (item.StandardType != 1)
                {
                    if (ShopConfig.ReadConfigInfo().ProductStorageType == (int)ProductStorageType.SelfStorageSystem)
                    {
                        leftStorageCount = item.TotalStorageCount - item.OrderCount;
                    }
                    else
                    {
                        leftStorageCount = item.ImportVirtualStorageCount;
                    }
                }
                else
                {
                    List <ProductTypeStandardRecordInfo> standRecordList = ProductTypeStandardRecordBLL.ReadListByProduct(item.Id, 1);
                    if (standRecordList.Count > 0)
                    {
                        leftStorageCount = standRecordList[0].Storage;                           //取第一种规格的库存
                    }
                }
                str5 = leftStorageCount.ToString(); //库存数量
                string spostage_id = "0";           //邮费模板ID
                //if (rowArray.Length > 0)
                //{
                builder.AppendFormat(format, new object[] {
                    this.Trim(item.Name), str11, "", str25, str20, str21, "1", item.SalePrice, "", str5, "14", str6, str7, str9, str8, str22,
                    str23, "0", "0", "", str2, str14, spostage_id, str24, DateTime.Now, "100", "", "0", str4, string.Empty, str15, str10,
                    str12, str13, string.Empty, "0", "0", "0", "1", "", "1", str3, mobileContent
                });
                //}
            }
            return(builder.Remove(builder.Length - 2, 2).ToString());
        }
Ejemplo n.º 22
0
        /// <summary>
        /// 页面加载方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                BindClassBrandAttributeClassStandardType();
                BrandID.Items.Insert(0, new ListItem("请选择", "0"));
                RelationBrandID.Items.Insert(0, new ListItem("请选择", "0"));
                AccessoryBrandID.Items.Insert(0, new ListItem("请选择", "0"));

                string classId = RequestHelper.GetQueryString <string>("classId");
                productID = RequestHelper.GetQueryString <int>("ID");
                _brandId  = RequestHelper.GetQueryString <int>("BrandId");
                //ProductClass.DataSource = ProductClassBLL.ReadUnlimitClassList();
                if (productID <= 0)             //添加商品
                {
                    DraftButton.Visible = true; //添加商品可保存草稿
                    if (string.IsNullOrEmpty(classId))
                    {
                        Response.Redirect("/admin/productaddinit.aspx");
                    }
                    else
                    {
                        LastClassID = ProductClassBLL.GetLastClassID(classId);
                        proTypeID   = ProductClassBLL.GetProductClassType(LastClassID);
                        ProductTypeInfo aci = ProductTypeBLL.Read(proTypeID);
                        if (aci.Id > 0)
                        {
                            string[] strArray = aci.BrandIds.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                            int[]    intArray;

                            intArray         = Array.ConvertAll <string, int>(strArray, s => int.Parse(s));
                            productBrandList = ProductBrandBLL.ReadList(intArray);
                        }

                        if (productBrandList.Count > 0)
                        {
                            BrandID.DataSource     = productBrandList;
                            BrandID.DataTextField  = "Name";
                            BrandID.DataValueField = "ID";
                            BrandID.DataBind();
                            BrandID.Items.Insert(0, new ListItem("请选择", "0"));
                            if (_brandId > 0)
                            {
                                BrandID.Text = _brandId.ToString();
                            }

                            RelationBrandID.DataSource     = productBrandList;
                            RelationBrandID.DataTextField  = "Name";
                            RelationBrandID.DataValueField = "ID";
                            RelationBrandID.DataBind();
                            RelationBrandID.Items.Insert(0, new ListItem("请选择", "0"));

                            AccessoryBrandID.DataSource     = productBrandList;
                            AccessoryBrandID.DataTextField  = "Name";
                            AccessoryBrandID.DataValueField = "ID";
                            AccessoryBrandID.DataBind();
                            AccessoryBrandID.Items.Insert(0, new ListItem("请选择", "0"));
                        }
                        //商品分类对应的属性列表
                        attributeList = ProductTypeAttributeBLL.ReadList(proTypeID);
                        //商品类型对应的规格列表
                        standardList = ProductTypeStandardBLL.ReadList(proTypeID);
                        //添加商品时自动查找所属分类的售后服务
                        Remark.Value = GetProductClassRemark(classId);
                    }
                }
                else//修改商品
                {
                    CheckAdminPower("ReadProduct", PowerCheckType.Single);
                    DraftButton.Visible = false;//修改商品不可保存草稿
                    ProductInfo product = ProductBLL.Read(productID);
                    pageProduct = product;
                    //如果修改了分类则标识isupdate
                    if (!string.IsNullOrEmpty(classId) && product.ClassId != classId)
                    {
                        isUpdate = 1;
                    }

                    YejiRatio.Text = product.YejiRatio;

                    Name.Text      = product.Name;
                    SellPoint.Text = product.SellPoint;
                    Name.Attributes.Add("style", "color:" + product.Color);
                    color              = product.Color;
                    FontStyle.Text     = product.FontStyle;
                    ProductNumber.Text = product.ProductNumber;
                    //ProductClass.ClassID = product.ClassId;
                    Keywords.Text          = product.Keywords;
                    MarketPrice.Text       = product.MarketPrice.ToString();
                    SendPoint.Text         = product.SendPoint.ToString();
                    Photo.Text             = product.Photo;
                    Summary.Text           = product.Summary;
                    Introduction.Value     = product.Introduction1;
                    Weight.Text            = product.Weight.ToString();
                    GroupPrice.Text        = product.GroupPrice.ToString();
                    GroupQuantity.Text     = product.GroupQuantity.ToString();
                    GroupPhoto.Text        = product.GroupPhoto;
                    VirtualOrderCount.Text = product.VirtualOrderCount.ToString();

                    if (Convert.ToBoolean(product.IsSpecial))
                    {
                        IsSpecial.Checked = true;
                    }
                    if (Convert.ToBoolean(product.IsNew))
                    {
                        IsNew.Checked = true;
                    }
                    if (Convert.ToBoolean(product.IsHot))
                    {
                        IsHot.Checked = true;
                    }
                    if (Convert.ToBoolean(product.IsSale))
                    {
                        IsSale.Checked = true;
                    }
                    else
                    {
                        IsSale.Checked = false;
                    }
                    if (Convert.ToBoolean(product.IsTop))
                    {
                        IsTop.Checked = true;
                    }
                    if (Convert.ToBoolean(product.AllowComment))
                    {
                        AllowComment.Checked = true;
                    }
                    else
                    {
                        AllowComment.Checked = false;
                    }
                    TotalStorageCount.Text = product.TotalStorageCount.ToString();

                    LastClassID    = ProductClassBLL.GetLastClassID(product.ClassId);
                    this.proTypeID = ProductClassBLL.GetProductClassType(LastClassID);
                    //商品分类对应的属性列表
                    //attributeList = ProductTypeAttributeBLL.JoinAttribute(ProductClassBLL.Read(ProductClassBLL.GetLastClassID(product.ClassId)).ProductTypeId, productID);
                    attributeList        = ProductTypeAttributeBLL.JoinAttribute(this.proTypeID, productID);
                    Repeater1.DataSource = attributeList;
                    Repeater1.DataBind();
                    //商品类型对应的规格列表
                    standardList       = ProductTypeStandardBLL.ReadList(this.proTypeID);
                    standardRecordList = ProductTypeStandardRecordBLL.ReadListByProduct(product.Id, product.StandardType);
                    if (product.StandardType == 1)
                    {
                        if (standardRecordList.Count > 0)
                        {
                            TotalStorageCount.ReadOnly = true;
                        }
                    }
                    if (string.IsNullOrEmpty(classId))
                    {
                        LastClassID = ProductClassBLL.GetLastClassID(product.ClassId);
                    }
                    else
                    {
                        LastClassID = ProductClassBLL.GetLastClassID(classId);
                    }
                    int             proTypeID = ProductClassBLL.GetProductClassType(LastClassID);
                    ProductTypeInfo aci       = ProductTypeBLL.Read(proTypeID);
                    if (aci.Id > 0)
                    {
                        string[] strArray = aci.BrandIds.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                        int[]    intArray;

                        intArray         = Array.ConvertAll <string, int>(strArray, s => int.Parse(s));
                        productBrandList = ProductBrandBLL.ReadList(intArray);
                    }

                    if (productBrandList.Count > 0)
                    {
                        BrandID.DataSource     = productBrandList;
                        BrandID.DataTextField  = "Name";
                        BrandID.DataValueField = "ID";
                        BrandID.DataBind();
                        BrandID.Items.Insert(0, new ListItem("请选择", "0"));

                        RelationBrandID.DataSource     = productBrandList;
                        RelationBrandID.DataTextField  = "Name";
                        RelationBrandID.DataValueField = "ID";
                        RelationBrandID.DataBind();
                        RelationBrandID.Items.Insert(0, new ListItem("请选择", "0"));

                        AccessoryBrandID.DataSource     = productBrandList;
                        AccessoryBrandID.DataTextField  = "Name";
                        AccessoryBrandID.DataValueField = "ID";
                        AccessoryBrandID.DataBind();
                        AccessoryBrandID.Items.Insert(0, new ListItem("请选择", "0"));
                    }
                    if (_brandId > 0)
                    {
                        BrandID.Text = _brandId.ToString();
                    }
                    else
                    {
                        BrandID.Text = product.BrandId.ToString();
                    }

                    sendCount    = product.SendCount;
                    OrderID.Text = product.OrderId.ToString();

                    SalePrice.Text            = product.SalePrice.ToString();
                    Units.Text                = product.Unit;
                    Introduction_Mobile.Value = product.Introduction1_Mobile;
                    Sub_Title.Text            = product.SubTitle;
                    LowerCount.Text           = product.LowerCount.ToString();

                    Remark.Value = product.Remark;

                    BindRelation(product);
                    productPhotoList = ProductPhotoBLL.ReadList(productID, 0);
                }
                //userGradeList = UserGradeBLL.JoinUserGrade(productID);
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        /// 页面加载
        /// </summary>
        protected override void PageLoad()
        {
            base.PageLoad();

            int count = int.MinValue;

            int id = RequestHelper.GetQueryString <int>("ID");

            if (id <= 0)
            {
                ScriptHelper.AlertFront("该产品未上市,不能查看");
            }
            string fromwhere = RequestHelper.GetQueryString <string>("fw");

            product = ProductBLL.Read(id);
            if (product.IsSale == (int)BoolType.False || product.IsDelete == 1)
            {
                if (fromwhere.ToLower() != "admin")
                {
                    ScriptHelper.Alert("该产品未上市,不能查看");
                }
                else
                {
                    if (Cookies.Admin.GetAdminID(true) == 0)//用户未登录
                    {
                        ScriptHelper.Alert("该产品未上市,不能查看");
                    }
                }
            }

            navList = ProductClassBLL.ProductClassNameList(product.ClassId);
            //更新查看数量
            ProductBLL.ChangeViewCount(id, 1);
            //会员等级
            userGradeList = UserGradeBLL.ReadList();

            //产品图片
            ProductPhotoInfo productPhoto = new ProductPhotoInfo();

            productPhoto.Name     = product.Name;
            productPhoto.ImageUrl = product.Photo.Replace("Original", "75-75");
            productPhotoList.Add(productPhoto);
            productPhotoList.AddRange(ProductPhotoBLL.ReadList(id, 0));
            // 关联产品,配件,浏览过的商品
            strHistoryProduct = Server.UrlDecode(CookiesHelper.ReadCookieValue("HistoryProduct"));
            string tempStrProductID = product.RelationProduct + "," + product.Accessory + "," + strHistoryProduct;

            tempStrProductID = tempStrProductID.Replace(",,", ",");
            if (tempStrProductID.StartsWith(","))
            {
                tempStrProductID = tempStrProductID.Substring(1);
            }
            if (tempStrProductID.EndsWith(","))
            {
                tempStrProductID = tempStrProductID.Substring(0, tempStrProductID.Length - 1);
            }

            ProductSearchInfo productSearch = new ProductSearchInfo();

            productSearch.InProductId = tempStrProductID;
            productSearch.IsDelete    = (int)BoolType.False;
            tempProductList           = ProductBLL.SearchList(productSearch);
            //产品规格
            standardRecordList = ProductTypeStandardRecordBLL.ReadListByProduct(product.Id, product.StandardType);
            if (standardRecordList.Count > 0)
            {
                string[] standardIDArray = standardRecordList[0].StandardIdList.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                for (int i = 0; i < standardIDArray.Length; i++)
                {
                    int standardID = Convert.ToInt32(standardIDArray[i]);
                    ProductTypeStandardInfo standard = ProductTypeStandardBLL.Read(standardID);
                    string[] valueArray = standard.ValueList.Split(';');
                    string   valueList  = string.Empty;
                    for (int k = 0; k < valueArray.Length; k++)
                    {
                        foreach (ProductTypeStandardRecordInfo standardRecord in standardRecordList)
                        {
                            string[] tempValueArray = standardRecord.ValueList.Split(';');
                            if (valueArray[k] == tempValueArray[i])
                            {
                                valueList += valueArray[k] + ";";
                                break;
                            }
                        }
                    }
                    if (valueList != string.Empty)
                    {
                        valueList = valueList.Substring(0, valueList.Length - 1);
                    }
                    standard.ValueList = valueList;
                    standardList.Add(standard);
                }
                //规格值
                foreach (ProductTypeStandardRecordInfo standardRecord in standardRecordList)
                {
                    standardRecordValueList += standardRecord.ProductId + ";" + standardRecord.ValueList + "|";
                }
            }
            //计算剩余库存量
            if (ShopConfig.ReadConfigInfo().ProductStorageType == (int)ProductStorageType.SelfStorageSystem)
            {
                leftStorageCount = product.TotalStorageCount - product.OrderCount;
            }
            else
            {
                leftStorageCount = product.ImportVirtualStorageCount;
            }
            //搜索优化
            Title       = product.Name;
            Keywords    = (product.Keywords == string.Empty) ? product.Name : product.Keywords;
            Description = (product.Summary == string.Empty) ? StringHelper.Substring(StringHelper.KillHTML(product.Introduction1), 200) : product.Summary;
        }