Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string str = base.Request.Form["task"];

            if (!string.IsNullOrEmpty(str))
            {
                string         str2  = "未定义操作";
                string         str3  = base.Request.Form["ShareDesc"];
                string         str4  = base.Request.Form["image1"];
                string         str5  = base.Request.Form["image2"];
                string         str6  = base.Request.Form["image3"];
                string         str7  = base.Request.Form["image4"];
                string         str8  = base.Request.Form["image5"];
                string         str9  = base.Request.Form["image6"];
                string         str10 = base.Request.Form["image7"];
                string         str11 = base.Request.Form["image8"];
                string         str12 = base.Request.Form["image9"];
                string         str13 = base.Request.Form["ID"];
                NineImgsesItem info  = new NineImgsesItem
                {
                    CreatTime = DateTime.Now,
                    ShareDesc = str3,
                    image1    = str4,
                    image2    = str5,
                    image3    = str6,
                    image4    = str7,
                    image5    = str8,
                    image6    = str9,
                    image7    = str10,
                    image8    = str11,
                    image9    = str12
                };
                int result = 0;
                int.TryParse(str13, out result);
                string str15 = str;
                if (str15 != null)
                {
                    if (!(str15 == "del"))
                    {
                        if (str15 == "read")
                        {
                            if (result == 0)
                            {
                                str2 = "falid:参数不正确";
                            }
                            else
                            {
                                NineImgsesItem nineImgse = ShareMaterialBrowser.GetNineImgse(result);
                                if (nineImgse != null)
                                {
                                    IsoDateTimeConverter converter = new IsoDateTimeConverter
                                    {
                                        DateTimeFormat = "yyyy-MM-dd HH:mm:ss"
                                    };
                                    str2 = JsonConvert.SerializeObject(nineImgse, new JsonConverter[] { converter });
                                }
                                else
                                {
                                    str2 = "falid:素材已删除";
                                }
                            }
                        }
                        else if (str15 == "edit")
                        {
                            if (result == 0)
                            {
                                str2 = "ID参数不正确";
                            }
                            else
                            {
                                info.id = result;
                                if (ShareMaterialBrowser.UpdateNineImgses(info))
                                {
                                    str2 = "success";
                                }
                                else
                                {
                                    str2 = "修改失败!";
                                }
                            }
                        }
                        else if (str15 == "add")
                        {
                            if (ShareMaterialBrowser.AddNineImgses(info) > 0)
                            {
                                str2 = "success";
                            }
                            else
                            {
                                str2 = "保存失败!";
                            }
                        }
                    }
                    else if (result == 0)
                    {
                        str2 = "falid:参数不正确";
                    }
                    else if (ShareMaterialBrowser.DeleteNineImgses(result))
                    {
                        str2 = "success";
                    }
                    else
                    {
                        str2 = "falid:删除失败";
                    }
                }
                base.Response.Write(str2);
                base.Response.End();
            }
            string s = base.Request.QueryString["ID"];

            this.nid = 0;
            if (int.TryParse(s, out this.nid))
            {
                this.EditType.Text = "编辑";
            }
            else
            {
                this.EditType.Text = "新增";
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string text = base.Request.Form["task"];

            if (!string.IsNullOrEmpty(text))
            {
                string         s              = "未定义操作";
                string         shareDesc      = base.Request.Form["ShareDesc"];
                string         image          = base.Request.Form["image1"];
                string         image2         = base.Request.Form["image2"];
                string         image3         = base.Request.Form["image3"];
                string         image4         = base.Request.Form["image4"];
                string         image5         = base.Request.Form["image5"];
                string         image6         = base.Request.Form["image6"];
                string         image7         = base.Request.Form["image7"];
                string         image8         = base.Request.Form["image8"];
                string         image9         = base.Request.Form["image9"];
                string         s2             = base.Request.Form["ID"];
                NineImgsesItem nineImgsesItem = new NineImgsesItem();
                nineImgsesItem.CreatTime = System.DateTime.Now;
                nineImgsesItem.ShareDesc = shareDesc;
                nineImgsesItem.image1    = image;
                nineImgsesItem.image2    = image2;
                nineImgsesItem.image3    = image3;
                nineImgsesItem.image4    = image4;
                nineImgsesItem.image5    = image5;
                nineImgsesItem.image6    = image6;
                nineImgsesItem.image7    = image7;
                nineImgsesItem.image8    = image8;
                nineImgsesItem.image9    = image9;
                int num = 0;
                int.TryParse(s2, out num);
                string a;
                if ((a = text) != null)
                {
                    if (!(a == "del"))
                    {
                        if (!(a == "read"))
                        {
                            if (!(a == "edit"))
                            {
                                if (a == "add")
                                {
                                    if (ShareMaterialBrowser.AddNineImgses(nineImgsesItem) > 0)
                                    {
                                        s = "success";
                                    }
                                    else
                                    {
                                        s = "保存失败!";
                                    }
                                }
                            }
                            else if (num == 0)
                            {
                                s = "ID参数不正确";
                            }
                            else
                            {
                                nineImgsesItem.id = num;
                                if (ShareMaterialBrowser.UpdateNineImgses(nineImgsesItem))
                                {
                                    s = "success";
                                }
                                else
                                {
                                    s = "修改失败!";
                                }
                            }
                        }
                        else if (num == 0)
                        {
                            s = "falid:参数不正确";
                        }
                        else
                        {
                            NineImgsesItem nineImgse = ShareMaterialBrowser.GetNineImgse(num);
                            if (nineImgse != null)
                            {
                                s = JsonConvert.SerializeObject(nineImgse, new JsonConverter[]
                                {
                                    new IsoDateTimeConverter
                                    {
                                        DateTimeFormat = "yyyy-MM-dd HH:mm:ss"
                                    }
                                });
                            }
                            else
                            {
                                s = "falid:素材已删除";
                            }
                        }
                    }
                    else if (num == 0)
                    {
                        s = "falid:参数不正确";
                    }
                    else if (ShareMaterialBrowser.DeleteNineImgses(num))
                    {
                        s = "success";
                    }
                    else
                    {
                        s = "falid:删除失败";
                    }
                }
                base.Response.Write(s);
                base.Response.End();
            }
            string s3 = base.Request.QueryString["ID"];

            this.nid = 0;
            if (int.TryParse(s3, out this.nid))
            {
                this.EditType.Text = "编辑";
                return;
            }
            this.EditType.Text = "新增";
        }