예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try

        {
            string      name      = Request["name"];
            string      title     = Request["title"];
            string      desc      = Request["desc"];
            string      groupname = Request["groupname"];
            string      groupcode = Request["groupcode"];
            MetaManager MM        = new MetaManager();
            MetaTBx     meta      = new MetaTBx();
            meta.Title       = title;
            meta.Description = desc;
            meta.GroupCode   = groupcode;
            meta.GroupName   = groupname;
            meta.Name        = name;
            meta.Status      = 1;
            MM.AddNew(meta);
            meta.IconURL = "/upload/imagemeta/image_" + meta.Id + ".jpg";
            MM.Save();
            string       base64     = Request["base64"];
            byte[]       imageBytes = Convert.FromBase64String(base64);
            MemoryStream ms         = new MemoryStream(imageBytes, 0, imageBytes.Length);
            ms.Write(imageBytes, 0, imageBytes.Length);
            System.Drawing.Image image = System.Drawing.Image.FromStream(ms, true);

            image.Save(Server.MapPath("~/upload/imagemeta/image_" + meta.Id + ".jpg"));
            Response.Write(JsonConvert.SerializeObject(new
            {
                success = 1
            }));
        }
        catch (Exception ex)
        {
            Response.Write(JsonConvert.SerializeObject(new
            {
                success = -1,
                error   = ex
            }));
        }
    }
예제 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string      name       = Request["name"];
        string      title      = Request["title"];
        string      desc       = Request["desc"];
        string      iconurl    = Request["iconurl"];
        string      grounpname = Request["grounpname"];
        string      grounpcode = Request["grounpcode"];
        MetaManager MM         = new MetaManager();
        MetaTBx     addmeta    = new MetaTBx();

        addmeta.Name        = name;
        addmeta.Title       = title;
        addmeta.Description = desc;
        addmeta.IconURL     = iconurl;
        addmeta.GroupCode   = grounpcode;
        addmeta.GroupName   = grounpname;
        addmeta.Status      = 1;
        MM.AddNew(addmeta);
        Response.Write(1);
    }