Esempio n. 1
0
    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;
        }
    }