Пример #1
0
        protected void btnAddTag(object sender, EventArgs e)
        {
            StoreTagInfo storeTagInfo = new StoreTagInfo
            {
                TagName = this.txtTagName.Text.Trim()
            };

            if (this.hidOldImages.Value != this.hidUploadImages.Value)
            {
                storeTagInfo.TagImgSrc  = base.UploadImage(this.hidUploadImages.Value, "depot");
                this.hidOldImages.Value = storeTagInfo.TagImgSrc;
            }
            else
            {
                storeTagInfo.TagImgSrc = this.hidOldImages.Value;
            }
            if (!string.IsNullOrEmpty(this.hidTagId.Value))
            {
                storeTagInfo.TagId = int.Parse(this.hidTagId.Value);
                StoreTagInfo tagInfo = StoreTagHelper.GetTagInfo(storeTagInfo.TagId);
                storeTagInfo.DisplaySequence = tagInfo.DisplaySequence;
                this.ShowResultData(StoreTagHelper.EditTag(storeTagInfo));
            }
            else
            {
                this.ShowResultData(StoreTagHelper.AddTag(storeTagInfo));
            }
        }
Пример #2
0
        public static int EditTag(StoreTagInfo info)
        {
            if (string.IsNullOrEmpty(info.TagName) || string.IsNullOrEmpty(info.TagImgSrc))
            {
                return(0);
            }
            StoreTagDao storeTagDao = new StoreTagDao();

            if (!storeTagDao.NameValidate(info.TagName, info.TagId))
            {
                return(-1);
            }
            return(new StoreTagDao().Update(info, null) ? 1 : 2);
        }
Пример #3
0
        private void bindTagInfo(int tagId)
        {
            this.btnAdd.Text = "保存";
            StoreTagInfo tagInfo = StoreTagHelper.GetTagInfo(tagId);

            if (tagInfo != null)
            {
                this.hidTagId.Value     = tagInfo.TagId.ToString();
                this.txtTagName.Text    = tagInfo.TagName;
                this.hidOldImages.Value = tagInfo.TagImgSrc;
            }
            else
            {
                this.ShowMsg("数据读取有误", false);
                this.btnAdd.Enabled = false;
            }
        }
Пример #4
0
 protected override void AttachChildControls()
 {
     base.CheckOpenMultStore();
     this.literlitNoMatchSwitchal = (Literal)this.FindControl("litNoMatchSwitch");
     this.litTag = (Literal)this.FindControl("litTag");
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["TagId"]))
     {
         StoreTagInfo storeTagInfo = (from t in StoreListHelper.GetTagsList()
                                      where t.TagId == this.Page.Request.QueryString["TagId"].ToInt(0)
                                      select t).FirstOrDefault();
         if (storeTagInfo != null)
         {
             this.litTag.Text = (from t in StoreListHelper.GetTagsList()
                                 where t.TagId == this.Page.Request.QueryString["TagId"].ToInt(0)
                                 select t).FirstOrDefault().TagName;
         }
     }
 }
Пример #5
0
        public static int AddTag(StoreTagInfo info)
        {
            if (string.IsNullOrEmpty(info.TagName) || string.IsNullOrEmpty(info.TagImgSrc))
            {
                return(0);
            }
            StoreTagDao storeTagDao = new StoreTagDao();

            if (!storeTagDao.NameValidate(info.TagName, info.TagId))
            {
                return(-1);
            }
            if (storeTagDao.CountTags() >= 8)
            {
                return(-2);
            }
            info.DisplaySequence = storeTagDao.GetMaxDisplaySequence <StoreTagInfo>();
            return((new StoreTagDao().Add(info, null) > 0) ? 1 : 2);
        }