protected void btn_ServerClick(object sender, EventArgs e) { Img img = new Img(); img.savePathName = "files"; string path = img.saveImage(""); if (img.error == "") { AlbumInfo info = new AlbumInfo(); info.album_name = path; info.imgUrl = path; info.showHome = false; info.linkUrl = ""; AlbumDal al = new AlbumDal(); int id = al.add(info); StringBuilder sb = new StringBuilder(); sb.Append("<span style='font-size:12px;BACKGROUND: #F7F7F7;'>上传成功!"); sb.Append("<a href=\"javascript:;\" onClick=\"parent.addContent(iname);\">插入</a> "); sb.Append("<a href=\"javascript:history.back();\">继续上传</a></span>"); sb.Append("<script language=\"JavaScript\">"); sb.Append("var iname=\""+gform("up_name")+"\";"); sb.Append("parent.document.getElementById(iname).value=\"" + path + "\";</script>;"); die(sb.ToString()); } else { Response.Write(img.error+" <a href=\"javascript:history.back()\">返回</a>"); Response.End(); } }
//保存 protected void Submit1_ServerClick(object sender, EventArgs e) { ArticleDal ar = new ArticleDal(); ar.classId = classId.Text; ar.title = ArticleTitle.Value.ToString(); ar.content = content.Value.ToString(); //保存图片 string imgPath; Img img = new Img(); img.savePathName = "article"; imgPath = img.saveImage(filePath.Value); string err; if (img.error != "") { showMessage(img.error); return; } ar.imgPath = imgPath; if (app == "edit") { ar.edit(id); err = "修改成功"; showMessage(err); } else { ar.add(); err = "添加成功"; showMessage(err, "gl_manage.aspx?classid=" + classid); } }
protected void btn_ServerClick(object sender, EventArgs e) { Img img = new Img(); img.savePathName = "album"; string path = img.saveImage(""); if (img.error == "") { AlbumInfo info = new AlbumInfo(); info.album_name = path; info.imgUrl = path; if (showHome.Checked) info.showHome = true; else info.showHome = false; info.linkUrl = linkUrl.Value; AlbumDal al = new AlbumDal(); int id = al.add(info); showMessage("上传成功<br/>图片地址:<a href=\"" + path + "\" target=\"_blank\">" + path + "</a>"); } else { showMessage(img.error); } }
protected void btn_ServerClick(object sender, EventArgs e) { Img img = new Img(); int id = 0; gnum(ref id, "id"); img.savePathName = "adver"; string path = img.saveImage(""); if (img.error == "") { AdverInfo info = new AdverInfo(); info.imgurl = path; info.linkurl = linkUrl.Value; AdverDal al = new AdverDal(); al.edit(info,id); showMessage("保存成功"); } else { showMessage(img.error); } }
protected void save_ServerClick(object sender, EventArgs e) { string TypeName = ProductTypeName.Value.ToString(); string err; if (TypeName != "") { ProductTypeInfo info = new ProductTypeInfo(); ProductTypeDal ad = new ProductTypeDal(); Img img = new Img(); img.savePathName = "producttype"; if (action == "edit") { string delimg = pform("delimg"); if (delimg == "1") { img.dropimg(imgUrl.Value); info.imgUrl = ""; } else { info.imgUrl = img.saveImage(imgUrl.Value); } if (img.error != "") showMessage(img.error); info.typeName = ProductTypeName.Value; info.orderId = int.Parse(orderId.Value); info.id = getId("id"); info.content = pform("content"); ad.Update(info); err = "修改成功"; } else { info.typeName = TypeName; info.orderId = int.Parse(orderId.Value); info.imgUrl = img.saveImage(""); info.content = pform("content"); if (img.error != "") showMessage(img.error); int id = 0; gnum(ref id, "id"); info.parentId = id; ad.AddType(info); err = "添加成功"; } showMessage(err, "pro_type.aspx"); } else { labelErr.Text = "<font color=red>不能为空</font>"; } }
//保存 protected void Submit1_ServerClick(object sender, EventArgs e) { ProductInfo proinfo = new ProductInfo(); proinfo.productName = ProductName.Value.ToString(); proinfo.title1 = title1.Value.ToString(); proinfo.title2 = "";//title2.Value.ToString(); proinfo.TypeId = Int32.Parse(typeId.Text); proinfo.content = content.Value.ToString(); proinfo.content1 = content1.Value.ToString(); proinfo.content2 = content2.Value.ToString(); proinfo.content3 = content3.Value.ToString(); Img im = new Img(); im.savePathName = "products"; proinfo.productImgUrl = im.saveImage(filePath.Value); if (string.IsNullOrEmpty(im.error)) { ProductDal dal = new ProductDal(); if (app == "edit") { proinfo.Id = id; dal.updateProduct(proinfo); editProduct(id); } else { dal.createProduct(proinfo); } showMessage("保存成功", "manage.aspx"); } else { showMessage("出现了错误:"+im.error); } }
protected void btn_ServerClick(object sender, EventArgs e) { LinksDal li = new LinksDal(); LinkInfo info = new LinkInfo(); info.linkName = linkName.Value; info.linkUrl = linkUrl.Value; Img img = new Img(); img.savePathName = "links"; string delimg = pform("delimg"); if (delimg == "1") { img.dropimg(imgUrl.Value); info.imgUrl = ""; } else { info.imgUrl = img.saveImage(imgUrl.Value); if (info.imgUrl == "1") { img.dropimg(imgUrl.Value); } } if (img.error != "") showMessage(img.error); if (id.ToString() == "0") { li.addnew(info); showMessage("添加成功"); } else { info.id = id; li.edit(info); showMessage("修改成功"); Response.End(); } }