protected void ImageBtn_Click(object sender, ImageClickEventArgs e) { com.jwsoft.pm.entpm.action.FileUpload fileUpload = new com.jwsoft.pm.entpm.action.FileUpload(); string value = this.hdnFilePath.Value; if (fileUpload.Delete(value)) { this.tr_add.Visible = true; this.tr_edit.Visible = false; Hashtable hashtable = new Hashtable(); hashtable.Add("OriginalName", SqlStringConstructor.GetQuotedString("")); hashtable.Add("FilePath", SqlStringConstructor.GetQuotedString("")); string where = " where TempletID = '" + this.TemplateID + " '"; if (DocumentAction.UpdDocTemplate(hashtable, where)) { this.JS.Text = "alert('模板文件删除成功!');"; return; } this.JS.Text = "alert('模板文件删除失败!');"; } }
protected void BtnAdd_Click(object sender, EventArgs e) { Hashtable hashtable = new Hashtable(); hashtable.Add("ClassID", this.ClassID.ToString()); hashtable.Add("TempletName", SqlStringConstructor.GetQuotedString(this.txtTemplatName.Text)); hashtable.Add("UserCode", SqlStringConstructor.GetQuotedString(this.hdnUserCode.Value)); hashtable.Add("UploadTime", SqlStringConstructor.GetQuotedString(this.DBoxUploadTime.Text)); hashtable.Add("Remark", SqlStringConstructor.GetQuotedString(this.txtRemark.Text)); if (this.txtFilePath.HasFile) { HttpPostedFile postedFile = this.txtFilePath.PostedFile; com.jwsoft.pm.entpm.action.FileUpload fileUpload = new com.jwsoft.pm.entpm.action.FileUpload(); string[] array = fileUpload.Upload(postedFile, 1); hashtable.Add("OriginalName", SqlStringConstructor.GetQuotedString(array[0])); hashtable.Add("FilePath", SqlStringConstructor.GetQuotedString(array[1])); } if (this.TemplateID == 0) { if (DocumentAction.AddDocTemplate(hashtable)) { this.JS.Text = "alert('保存成功!');window.returnValue=true;window.close();"; return; } this.JS.Text = "alert('保存失败!');"; return; } else { string where = " where TempletID = '" + this.TemplateID + " '"; if (DocumentAction.UpdDocTemplate(hashtable, where)) { this.JS.Text = "alert('保存成功!');window.returnValue=true;window.close();"; return; } this.JS.Text = "alert('保存失败!');"; return; } }