private void AddIdentifyInfo_Click(object sender, EventArgs e) { #region 添加鉴定记录 if (this.CheckCookie()) { string fileName = uploadfile.UpdateFile(); if (fileName.Trim() == "") { base.RegisterStartupScript("PAGE", "alert('没有选择鉴定图片');window.location.href='forum_identifymanage.aspx';"); } if (Identifys.AddIdentify(name.Text, fileName)) { DNTCache.GetCacheService().RemoveObject("/Forum/TopicIdentifys"); DNTCache.GetCacheService().RemoveObject("/Forum/TopicIndentifysJsArray"); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "鉴定文件添加", name.Text); base.RegisterStartupScript("PAGE", "window.location.href='forum_identifymanage.aspx';"); } else { base.RegisterStartupScript("PAGE", "alert('插入失败,可能名称与原有的相同');window.location.href='forum_identifymanage.aspx';"); } } #endregion }
//private void UpDateInfo(string active,string other) //{ // AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, active, other); //} public void SubmitButton_Click(object sender, EventArgs e) { #region 保存新建主题鉴定 bool ok = true; for (int i = 1; i <= fileList.Count; i++) { if (DNTRequest.GetFormString("id" + i) != "") { try { if (!Identifys.AddIdentify(DNTRequest.GetString("name" + i), DNTRequest.GetString("file" + i))) { ok = false; } } catch { base.RegisterStartupScript("", "<script>alert('出现错误,可能名称超出长度!');window.location.href='forum_identifymanage.aspx';</script>"); } } } AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "鉴定文件增加", ""); if (!ok) { base.RegisterStartupScript("", "<script>alert('某些记录未能插入,因为与数据库中原有的名称相同');window.location.href='forum_identifymanage.aspx';</script>"); } else { base.RegisterStartupScript("", "<script>window.location.href='forum_identifymanage.aspx';</script>"); } #endregion }
private void AddIdentifyInfo_Click(object sender, EventArgs e) { #region 添加鉴定记录 if (this.CheckCookie()) { if (uploadfile.FileName.Trim() == "" || uploadfilesmall.FileName.Trim() == "") { base.RegisterStartupScript("PAGE", "alert('没有选择鉴定图片');window.location.href='forum_addidentify.aspx';"); return; } string fileName = uploadfile.UpdateFile(); string fileNameSmall = uploadfilesmall.UpdateFile(); if (fileName.Trim() == "") { base.RegisterStartupScript("PAGE", "alert('没有选择鉴定大图片');window.location.href='forum_addidentify.aspx';"); return; } if (fileNameSmall.Trim() == "") { base.RegisterStartupScript("PAGE", "alert('没有选择鉴定小图片');window.location.href='forum_addidentify.aspx';"); return; } if (Identifys.AddIdentify(name.Text, fileName)) { string[] fileNameArray = fileName.Split('.'); string newFileNameSmall = string.Format("{0}_small.{1}", fileNameArray[0], fileNameArray[1]); Directory.Move(Server.MapPath("../../images/identify/") + fileNameSmall, Server.MapPath("../../images/identify/") + newFileNameSmall); DNTCache.GetCacheService().RemoveObject("/Forum/TopicIdentifys"); DNTCache.GetCacheService().RemoveObject("/Forum/TopicIndentifysJsArray"); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "鉴定文件添加", name.Text); base.RegisterStartupScript("PAGE", "window.location.href='forum_identifymanage.aspx';"); } else { base.RegisterStartupScript("PAGE", "alert('插入失败,可能名称与原有的相同');window.location.href='forum_identifymanage.aspx';"); } } #endregion }