protected void Page_Load(object sender, EventArgs e) { int id = Convert.ToInt32(Request["id"]); 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(); editmetaa = mm.GetByID(id); //xet meta ko ton tai if (editmetaa.Id == 0) { Response.Write("Meta doesn't exist. Please try again."); return; } { editmetaa.Id = id; editmetaa.Name = name; editmetaa.Title = title; editmetaa.Description = desc; editmetaa.IconURL = iconurl; editmetaa.GroupCode = grounpcode; editmetaa.GroupName = grounpname; // luu vao database mm.Save(); Response.Write(1); } }
protected void Page_Load(object sender, EventArgs e) { var id = Convert.ToInt32(Request["id"]); MetaManager MM = new MetaManager(); MetaTBx meta = MM.GetByID(id); meta.Status = -1; MM.Save(); Response.Write(1); }
protected void Page_Load(object sender, EventArgs e) { try { int id = Convert.ToInt32(Request["id"]); string name = Request["name"]; string title = Request["title"]; string desc = Request["desc"]; string groupname = Request["groupname"]; string groupcode = Request["groupcode"]; MetaManager mm = new MetaManager(); editmetaa = mm.GetByID(id); editmetaa.Name = name; editmetaa.Title = title; editmetaa.Description = desc; editmetaa.GroupCode = groupcode; editmetaa.GroupName = groupname; string base64 = Request["base64"]; mm.Save(); if (!string.IsNullOrEmpty(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/editimage_" + editmetaa.Id + ".jpg")); } Response.Write(JsonConvert.SerializeObject(new { success = 1 })); } catch (Exception ex) { Response.Write(JsonConvert.SerializeObject(new { success = -1, error = ex })); } }
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 })); } }