protected void delClass_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(DropDownListClass.Text.Trim() as string)) { string ClassID = DropDownListClass.Text.Trim(); string strREADsql = "select TreeID,treeDel,TreeName,TreeNameImg from NewsTree where Tid=" + ClassID + " and TidNums=0 and TreeType='" + typeClss + "'"; DataTable dt = db.getDataTable(strREADsql); if (dt.Rows.Count > 0) { if (Convert.ToInt64(dt.Rows[0]["treeDel"]) > 0) { xc.divError("", "该分类为前台固定分类,不允许删除!", 350, 150, "ClassList.aspx?tClass=" + typeClss, "goto"); } else { long updateID = Convert.ToInt64(dt.Rows[0]["TreeID"].ToString()); xc.insertMyLog(xc.adminID, "admin", "删除分类:" + dt.Rows[0]["TreeName"].ToString()); string oldImg = dt.Rows[0]["TreeNameImg"].ToString().Trim(); if (!string.IsNullOrEmpty(oldImg as string)) { string DelFilePath = oldImg.Substring(5, 8) + "/" + oldImg; xc.delFile(DelFilePath); } if (db.DelDB("NewsTree", "Tid", ClassID, string.Empty, false, string.Empty).Equals("删除成功")) { if (updateID > 0) //更新子分类数 { string strSqlSelect = "select TidNums from NewsTree where Tid=" + updateID + " and TreeType='" + typeClss + "'"; int tidNums = Convert.ToInt32(db.getDataTable(strSqlSelect).Rows[0]["TidNums"]) - 1; strValue[0] = tidNums.ToString(); db.InsertUpdateDB("NewsTree", "@TidNums", strValue, "Tid=" + updateID + " and TreeType='" + typeClss + "'"); } xc.divError("", "删除分类成功,建议清理数据一次!", 350, 150, "ClassList.aspx?tClass=" + typeClss, "goto"); } else { xc.divError("", "删除分类失败!", 350, 150, "ClassList.aspx?tClass=" + typeClss, "goto"); } } } else { xc.divError("", "请从子分类最底层删除分类!", 350, 150, "ClassList.aspx?tClass=" + typeClss, "goto"); } dt.Dispose(); } else { xc.divError("", "请选择相关分类再进行操作!", 350, 150, "ClassList.aspx?tClass=" + typeClss, "goto"); } }
protected void delPreImg_Click(object sender, EventArgs e) { string picName = indexPicSet.Text.Trim(); if (string.IsNullOrEmpty(picName as string)) { lblinfo.Text = "请选择相关图片后再点击删除按钮!"; } else { this.indexPicSet.Items.Remove(new ListItem(picName, picName)); Session.Add("upPreFile", string.Empty); //清空预选图 xc.delFile(picName); lblinfo.Text = db.DelDB("upFileName", "fileName", picName, string.Empty, false, string.Empty); } }
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"); }