protected void waterImgButton_Click(object sender, EventArgs e) { uploadError.Text = string.Empty; string idTemp = DropDownListClass.Text; if (Convert.ToInt16(idTemp) > 0) { string UpFileReturnStr = xc.UploadFile(waterImgFileUpload, "Img", false); if (UpFileReturnStr.Equals("上传成功")) { DataTable dt = db.getDataTable("select TreeNameImg from NewsTree where Tid=" + idTemp); if (dt.Rows.Count > 0) { string oldImg = dt.Rows[0]["TreeNameImg"].ToString().Trim(); if (!string.IsNullOrEmpty(oldImg as string)) { xc.delFile(oldImg.Substring(5, 8) + "/" + oldImg); } } dt.Dispose(); strValue[0] = Session["NewFile"].ToString(); db.InsertUpdateDB("NewsTree", "@TreeNameImg", strValue, "Tid=" + idTemp + " and TreeType='" + typeClss + "'"); xc.insertMyLog(xc.adminID, "admin", "添加图片分类"); uploadError.Text = "设置成功!"; } else { xc.divError("", "操作失败,请重新操作!", 350, 150, "ClassList.aspx?tClass=" + typeClss, "goto"); } } else { xc.divError("", "请选择具体子分类再进行操作!", 350, 150, "ClassList.aspx?tClass=" + typeClss, "goto"); } }
protected void Button1_Click(object sender, EventArgs e) { string RequestType = flag.Text.ToString().Trim(); string RequestTable = xc.SafeChar(Request["fTable"].Trim()); string UpFileReturnStr; string insertIframeCode = string.Empty; string fileName = uploadfile.FileName; if (RequestType.Equals("Img")) { if (WaterMark.Checked) { UpFileReturnStr = xc.UploadFile(uploadfile, RequestType, true); } else { UpFileReturnStr = xc.UploadFile(uploadfile, RequestType, false); } } else { UpFileReturnStr = xc.UploadFile(uploadfile, RequestType, false); } if (UpFileReturnStr.Equals("上传成功")) { //插入数据库 string insertName = Session["NewFile"].ToString(); string dimStr = "@fileID,@fileFlag,@fileTable,@fileName,@PostDate,@AdminIP,@AdminID"; string[] strValue = new string[7]; strValue[0] = Session["upFileID"].ToString(); //上传图片文件名ID关联" strValue[1] = RequestType; strValue[2] = RequestTable; strValue[3] = insertName; strValue[4] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); strValue[5] = xc.GetIP(); strValue[6] = xc.adminID; if (db.InsertUpdateDB("upFileName", dimStr, strValue, string.Empty).Equals("发布成功")) { UpFileReturnStr += " OK!"; } else { UpFileReturnStr += " NO!"; } switch (RequestType) { case "Img": insertIframeCode = @"<p><img alt='' src='" + xc.UploadFolder + insertName.Substring(5, 8) + "/" + insertName + "' /></p>"; break; case "Flash": insertIframeCode = "<p><object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'><param name='quality' value='high' /><param name='movie' value='" + xc.UploadFolder + insertName.Substring(5, 8) + "/" + insertName + "' /><embed pluginspage='http://www.macromedia.com/go/getflashplayer' quality='high' src='" + xc.UploadFolder + insertName.Substring(5, 8) + "/" + insertName + "' type='application/x-shockwave-flash'></embed></object></p>"; break; default: insertIframeCode = "<a target='_blank' href=" + xc.UploadFolder + insertName.Substring(5, 8) + "/" + insertName + ">" + insertName + "</a>"; break; } insertIframeCode = insertIframeCode + "<p> </p>"; ClientScriptManager cs = Page.ClientScript; cs.RegisterClientScriptBlock(this.GetType(), "ClientScriptBlock", "<script>parent.CKEDITOR.instances.txtContent.insertHtml(\"" + insertIframeCode + "\");</script>"); lblinfo.Text = uploadfile.FileName.ToString() + " " + UpFileReturnStr; if (RequestType.Equals("Img")) { indexPicSet.Items.Add(new ListItem(insertName, insertName)); preImage.Visible = true; //预览图 delPreImg.Visible = true; //删除图片 preImage.ImageUrl = xc.UploadFolder.ToString() + insertName.Substring(5, 8) + "/" + insertName; } } else { lblinfo.Text = UpFileReturnStr; } }
protected void editMoney_Click(object sender, EventArgs e) { string imgFile = adImg.Text.Trim(); string uploadFileStr = string.Empty; if (!imgFile.Equals("Code")) { uploadFileStr = xc.UploadFile(imgUpload, imgFile, false); } string url = adHttp.Text; string newFile = upImg.Value; if (uploadFileStr.Equals("上传成功")) { if (!string.IsNullOrEmpty(newFile as string)) { xc.delFile(newFile.Substring(5, 8) + "/" + newFile); } newFile = Session["NewFile"].ToString().Trim(); } string strDim = "@classID,@adW,@adH,@adImg,@adHttp,@adCode,@starDate,@stopDate,@postDate,@postIP,@adminID"; string[] strValue = new string[11]; strValue[0] = adClass.Text; strValue[1] = adW.Text; strValue[2] = adH.Text; strValue[3] = newFile; strValue[4] = url; switch (imgFile) { case "Img": if (!string.IsNullOrEmpty(url as string)) { strValue[5] = "<a href=\"" + url + "\" target=\"_blank\"><img src=\"http://" + XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "webDomains") + xc.UploadFolder + newFile.Substring(5, 8) + "/" + newFile + "\" style=\"boder:0px;width:" + adW.Text + "px;height:" + adH.Text + "px\" /></a>"; } else { strValue[5] = "<img src=\"" + xc.UploadFolder + newFile.Substring(5, 8) + "/" + newFile + "\" style=\"boder:0px;width:" + adW.Text + "px;height:" + adH.Text + "px\" />"; } break; case "Flash": strValue[5] = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0\" height=\"" + adH.Text + "\" width=\"" + adW.Text + "\"><param name=\"quality\" value=\"high\" /><param name=\"movie\" value=\"" + xc.UploadFolder + newFile.Substring(5, 8) + "/" + newFile + "\" /><embed height=\"" + adH.Text + "\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" quality=\"high\" src=\"" + xc.UploadFolder + newFile.Substring(5, 8) + "/" + newFile + "\" type=\"application/x-shockwave-flash\" width=\"" + adW.Text + "\"></embed></object>"; break; default: strValue[5] = adCode.Text; break; } strValue[6] = pDate.Text; strValue[7] = eDate.Text; strValue[8] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); strValue[9] = xc.GetIP(); strValue[10] = xc.adminID; xc.insertMyLog(xc.adminID, "admin", "修改广告"); xc.divError("", db.InsertUpdateDB("ads", strDim, strValue, "aID=" + xc.SafeNum(Request["id"]).ToString()), 350, 150, "default.aspx", "goto"); }