Beispiel #1
0
        private void GetStoreMarketing(HttpContext context)
        {
            ProductBrowseQuery productBrowseQuery = new ProductBrowseQuery();

            productBrowseQuery.PageIndex = context.Request["pageIndex"].ToInt(0);
            productBrowseQuery.PageSize  = context.Request["pageSize"].ToInt(0);
            int storeId = 0;

            int.TryParse(context.Request["storeId"], out storeId);
            productBrowseQuery.StoreId = storeId;
            int imageId = 0;

            int.TryParse(context.Request["imageId"], out imageId);
            StoreMarketingImagesInfo storeMarketingImages = MarketingImagesHelper.GetStoreMarketingImages(storeId, imageId);

            if (storeMarketingImages != null)
            {
                productBrowseQuery.CanUseProducts = storeMarketingImages.ProductIds;
                if (context.Request["isShowServiceProduct"].ToInt(0) > 0)
                {
                    productBrowseQuery.ProductType = ProductType.PhysicalProduct;
                }
                DbQueryResult storeProductList = StoresHelper.GetStoreProductList(productBrowseQuery);
                string        s = JsonConvert.SerializeObject(storeProductList);
                context.Response.ContentType = "text/json";
                context.Response.Write(s);
            }
        }
Beispiel #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string text  = Globals.StripAllTags(this.txtImageName.Text);
            string text2 = Globals.StripAllTags(this.txtDescription.Text);
            string value = this.hidOldImages.Value;
            int    num   = this.hidImageId.Value.ToInt(0);

            if (text.Trim() == "" || text.Length > 20)
            {
                this.ShowMsg("请输入图库名称,并且图库名称长度不能大于20个字符", false);
            }
            else if (text2.Trim() != "" && text2.Length > 100)
            {
                this.ShowMsg("使用说明长度不能大于100个字符", false);
            }
            else
            {
                MarketingImagesInfo marketingImagesInfo = new MarketingImagesInfo();
                if (num > 0)
                {
                    marketingImagesInfo = MarketingImagesHelper.GetMarketingImagesInfo(num);
                    if (marketingImagesInfo == null)
                    {
                        this.ShowMsg("错误的营销图库ID", false);
                        return;
                    }
                }
                marketingImagesInfo.ImageName   = text;
                marketingImagesInfo.Description = text2;
                if (this.hidOldImages.Value != this.hidUploadImages.Value)
                {
                    marketingImagesInfo.ImageUrl = base.UploadImage(this.hidUploadImages.Value, "depot");
                    this.hidOldImages.Value      = marketingImagesInfo.ImageUrl;
                }
                else
                {
                    marketingImagesInfo.ImageUrl = this.hidOldImages.Value;
                }
                if (marketingImagesInfo.ImageUrl.Trim() == "")
                {
                    this.ShowMsg("请上传图库图片", false);
                }
                else
                {
                    bool flag = false;
                    if ((num <= 0) ? (MarketingImagesHelper.AddMarketingImages(marketingImagesInfo) > 0) : MarketingImagesHelper.UpdateMarketingImages(marketingImagesInfo))
                    {
                        base.CloseWindow(num);
                        this.ShowMsgCloseWindow("营销图库" + ((num > 0) ? "编辑" : "添加") + "成功", true);
                    }
                    else
                    {
                        this.ShowMsg("营销图库" + ((num > 0) ? "编辑" : "添加") + "失败", false);
                    }
                }
            }
        }
        private DataGridViewModel <MarketingImagesInfo> GetDataList(MarketingImagesQuery query)
        {
            DataGridViewModel <MarketingImagesInfo> dataGridViewModel = new DataGridViewModel <MarketingImagesInfo>();

            if (query != null)
            {
                PageModel <MarketingImagesInfo> marketingImages = MarketingImagesHelper.GetMarketingImages(query);
                dataGridViewModel.rows  = marketingImages.Models.ToList();
                dataGridViewModel.total = marketingImages.Total;
            }
            return(dataGridViewModel);
        }
 protected override void AttachChildControls()
 {
     this.imgMarketing = (HtmlImage)this.FindControl("imgMarketing");
     int.TryParse(this.Page.Request.QueryString["storeId"], out this.storeId);
     int.TryParse(this.Page.Request.QueryString["imageId"], out this.imageId);
     if (this.storeId > 0 && this.imageId > 0)
     {
         MarketingImagesInfo marketingImagesInfo = MarketingImagesHelper.GetMarketingImagesInfo(this.imageId);
         if (marketingImagesInfo != null)
         {
             this.imgMarketing.Src = marketingImagesInfo.ImageUrl;
         }
     }
     PageTitle.AddSiteNameTitle("门店营销");
 }
Beispiel #5
0
        private void bindImageInfo(int imageId)
        {
            MarketingImagesInfo marketingImagesInfo = MarketingImagesHelper.GetMarketingImagesInfo(imageId);

            if (marketingImagesInfo == null)
            {
                this.hidImageId.Value = "0";
            }
            else
            {
                this.btnSave.Text        = "保存";
                this.txtDescription.Text = marketingImagesInfo.Description;
                this.txtImageName.Text   = marketingImagesInfo.ImageName;
                this.hidOldImages.Value  = marketingImagesInfo.ImageUrl;
            }
        }
Beispiel #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         int imageId = base.Request.QueryString["ImageId"].ToInt(0);
         int storeId = HiContext.Current.Manager.StoreId;
         MarketingImagesInfo marketingImagesInfo = MarketingImagesHelper.GetMarketingImagesInfo(imageId);
         if (marketingImagesInfo != null)
         {
             StoreMarketingImagesInfo      storeMarketingImages = MarketingImagesHelper.GetStoreMarketingImages(storeId, imageId);
             IList <StoreProductBaseModel> list = null;
             if (storeMarketingImages != null)
             {
                 string safeIDList = Globals.GetSafeIDList(storeMarketingImages.ProductIds, ',', true);
                 if (safeIDList != "")
                 {
                     list = StoresHelper.GetStoreProductBaseInfo(storeMarketingImages.ProductIds, storeId);
                 }
             }
             if (list == null)
             {
                 list = new List <StoreProductBaseModel>();
             }
             StringBuilder stringBuilder = new StringBuilder();
             for (int i = 0; i < list.Count; i++)
             {
                 if (stringBuilder.Length > 0)
                 {
                     stringBuilder.Insert(0, list[i].ProductId + "|||" + list[i].ProductName + ",,,");
                 }
                 else
                 {
                     stringBuilder.Append(list[i].ProductId + "|||" + list[i].ProductName);
                 }
             }
             this.hidSelectProducts.Value = stringBuilder.ToString();
             this.txtImageName.Value      = marketingImagesInfo.ImageName;
             this.txtDescription.Value    = marketingImagesInfo.Description;
             this.txtImageName.Disabled   = true;
             this.txtDescription.Disabled = true;
         }
     }
     catch (Exception ex)
     {
         base.Response.Write(ex.Message);
     }
 }
        public void Delete(HttpContext context)
        {
            string text = context.Request.Form["ids"];

            if (string.IsNullOrEmpty(text))
            {
                throw new HidistroAshxException("请选择要删除的数据");
            }
            string[] array = text.Split(',');
            foreach (string obj in array)
            {
                MarketingImagesInfo marketingImagesInfo = MarketingImagesHelper.GetMarketingImagesInfo(obj.ToInt(0));
                if (marketingImagesInfo != null)
                {
                    string text2 = marketingImagesInfo.ImageUrl.ToNullString().ToLower();
                    if (!text2.StartsWith("http://") && !text2.StartsWith("https://") && File.Exists(context.Server.MapPath(marketingImagesInfo.ImageUrl)))
                    {
                        File.Delete(context.Server.MapPath(marketingImagesInfo.ImageUrl));
                    }
                    MarketingImagesHelper.DeleteMarketingImages(obj.ToInt(0));
                }
            }
            base.ReturnSuccessResult(context, "删除成功!", 0, true);
        }
Beispiel #8
0
 public override void OnLoad(HttpContext context)
 {
     base.OnLoad(context);
     if (context.Request["flag"] == "Select")
     {
         int storeId = base.CurrentManager.StoreId;
         int num     = context.Request["pageIndex"].ToInt(0);
         if (num <= 0)
         {
             num = 1;
         }
         int num2 = context.Request["pageSize"].ToInt(0);
         if (num2 < 1)
         {
             num2 = 10;
         }
         MarketingImagesQuery marketingImagesQuery = new MarketingImagesQuery();
         marketingImagesQuery.PageIndex = num;
         marketingImagesQuery.PageSize  = num2;
         marketingImagesQuery.SortOrder = SortAction.Desc;
         marketingImagesQuery.SortBy    = "ImageId";
         PageModel <MarketingImagesInfo> marketingImages = MarketingImagesHelper.GetMarketingImages(marketingImagesQuery);
         string s = JsonConvert.SerializeObject(new
         {
             Result = new
             {
                 RecordCount = marketingImages.Total,
                 List        = from i in marketingImages.Models
                               select new
                 {
                     ImageId     = i.ImageId,
                     ImageName   = i.ImageName,
                     ImageUrl    = this.GetImageFullPath(i.ImageUrl),
                     Description = i.Description
                 }
             }
         });
         context.Response.Write(s);
         context.Response.End();
     }
     if (context.Request["flag"] == "Mdy")
     {
         int    storeId2 = base.CurrentManager.StoreId;
         int    imageId  = context.Request["ImageId"].ToInt(0);
         string idList   = context.Request["ProductIds"].ToNullString();
         MarketingImagesInfo marketingImagesInfo = MarketingImagesHelper.GetMarketingImagesInfo(imageId);
         if (marketingImagesInfo == null)
         {
             context.Response.Write(this.GetErrorJosn(701, ((Enum)(object)ApiErrorCode.ImageIdNotExists_Error).ToDescription()));
         }
         else
         {
             idList = Globals.GetSafeIDList(idList, ',', true);
             if (string.IsNullOrEmpty(idList))
             {
                 context.Response.Write(this.GetErrorJosn(101, ((Enum)(object)ApiErrorCode.Paramter_Error).ToDescription()));
             }
             else
             {
                 StoreMarketingImagesInfo storeMarketingImagesInfo = MarketingImagesHelper.GetStoreMarketingImages(storeId2, imageId);
                 string text = "";
                 if (storeMarketingImagesInfo != null)
                 {
                     string safeIDList = Globals.GetSafeIDList(storeMarketingImagesInfo.ProductIds, ',', true);
                     if (safeIDList != "")
                     {
                         string[] array = idList.Split(',');
                         foreach (string str in array)
                         {
                             if (!("," + safeIDList + ",").Contains("," + str + ","))
                             {
                                 text = text + str + ",";
                             }
                         }
                     }
                 }
                 else
                 {
                     storeMarketingImagesInfo         = new StoreMarketingImagesInfo();
                     storeMarketingImagesInfo.StoreId = storeId2;
                     storeMarketingImagesInfo.ImageId = imageId;
                 }
                 if (!string.IsNullOrEmpty(text))
                 {
                     StoreMarketingImagesInfo storeMarketingImagesInfo2 = storeMarketingImagesInfo;
                     storeMarketingImagesInfo2.ProductIds += ("," + text).TrimEnd(',');
                 }
                 else
                 {
                     storeMarketingImagesInfo.ProductIds = idList.TrimEnd(',');
                 }
                 MarketingImagesHelper.UpdateStoreMarketingImages(storeMarketingImagesInfo);
                 string s2 = JsonConvert.SerializeObject(new
                 {
                     Result = new
                     {
                         Success = new
                         {
                             Status = true,
                             Msg    = string.Empty
                         }
                     }
                 });
                 context.Response.Write(s2);
                 context.Response.End();
             }
         }
     }
 }