Beispiel #1
0
 private void ImageTypeEdit_Click(object sender, System.EventArgs e)
 {
     System.Collections.Generic.Dictionary <int, string> dictionary = new System.Collections.Generic.Dictionary <int, string>();
     for (int i = 0; i < this.ImageTypeList.Rows.Count; i++)
     {
         System.Web.UI.WebControls.GridViewRow gridViewRow = this.ImageTypeList.Rows[i];
         string text = ((System.Web.UI.WebControls.TextBox)gridViewRow.Cells[1].FindControl("ImageTypeName")).Text;
         if (text.Length > 20)
         {
             this.ShowMsg("分类长度限在20个字符以内", false);
             return;
         }
         int key = System.Convert.ToInt32(this.ImageTypeList.DataKeys[i].Value);
         dictionary.Add(key, Globals.HtmlEncode(text.ToString()));
     }
     try
     {
         int num = GalleryHelper.UpdatePhotoCategories(dictionary);
         if (num > 0)
         {
             this.ShowMsg("保存成功!", true);
         }
         else
         {
             this.ShowMsg("保存失败!", false);
         }
     }
     catch
     {
         this.ShowMsg("保存失败!", false);
     }
 }
Beispiel #2
0
        private void ImageTypeEdit_Click(object sender, EventArgs e)
        {
            Dictionary <int, string> photoCategorys = new Dictionary <int, string>();

            for (int i = 0; i < this.ImageTypeList.Rows.Count; i++)
            {
                GridViewRow row  = this.ImageTypeList.Rows[i];
                string      text = ((TextBox)row.Cells[1].FindControl("ImageTypeName")).Text;
                if (text.Length > 20)
                {
                    this.ShowMsg("分类长度限在20个字符以内", false);
                    return;
                }
                int key = Convert.ToInt32(this.ImageTypeList.DataKeys[i].Value);
                photoCategorys.Add(key, Globals.HtmlEncode(text.ToString()));
            }
            try
            {
                if (GalleryHelper.UpdatePhotoCategories(photoCategorys) > 0)
                {
                    this.ShowMsg("保存成功!", true);
                }
                else
                {
                    this.ShowMsg("保存失败!", false);
                }
            }
            catch
            {
                this.ShowMsg("保存失败!", false);
            }
        }
        public string RenameFolder(HttpContext context)
        {
            Dictionary <int, string> photoCategorys = new Dictionary <int, string>();

            photoCategorys.Add(Convert.ToInt32(context.Request.Form["category_img_id"]), context.Request.Form["name"]);
            if (GalleryHelper.UpdatePhotoCategories(photoCategorys) > 0)
            {
                return("{\"status\":1,\"msg\":\"\"}");
            }
            return("{\"status\":0,\"msg\":\"请选择一个分类\"}");
        }
 public string RenameFolder(System.Web.HttpContext context)
 {
     if (GalleryHelper.UpdatePhotoCategories(new System.Collections.Generic.Dictionary <int, string>
     {
         {
             System.Convert.ToInt32(context.Request.Form["category_img_id"]),
             context.Request.Form["name"]
         }
     }) > 0)
     {
         return("{\"status\":1,\"msg\":\"\"}");
     }
     return("{\"status\":0,\"msg\":\"请选择一个分类\"}");
 }
Beispiel #5
0
        public void Edit(HttpContext context)
        {
            int    value     = base.GetIntParam(context, "id", false).Value;
            string parameter = base.GetParameter(context, "name", true);
            bool   flag      = true;

            if (value > 0)
            {
                flag = false;
            }
            if (string.IsNullOrWhiteSpace(parameter))
            {
                throw new HidistroAshxException("分类名称不能为空");
            }
            if (parameter.Length > 20)
            {
                throw new HidistroAshxException("分类名称长度限在20个字符以内");
            }
            if (flag)
            {
                if (GalleryHelper.AddPhotoCategory(Globals.HtmlEncode(parameter), 0) > 0)
                {
                    base.ReturnSuccessResult(context, "添加成功", 0, true);
                    return;
                }
                throw new HidistroAshxException("操作失败");
            }
            Dictionary <int, string> dictionary = new Dictionary <int, string>();

            dictionary.Add(value, parameter);
            if (GalleryHelper.UpdatePhotoCategories(dictionary) > 0)
            {
                base.ReturnSuccessResult(context, "修改成功", 0, true);
                return;
            }
            throw new HidistroAshxException("操作失败");
        }