Esempio n. 1
0
    protected void BtnAdd_Click(object sender, EventArgs e)
    {
        Guid     guid     = Guid.NewGuid();
        DateTime dateTime = default(DateTime);

        dateTime = DateTime.Now;
        Hashtable hashtable = new Hashtable();

        hashtable.Add("FileID", SqlStringConstructor.GetQuotedString(guid.ToString()));
        hashtable.Add("Title", SqlStringConstructor.GetQuotedString(this.txtTitle.Text));
        hashtable.Add("SendCorpName", SqlStringConstructor.GetQuotedString(this.txtSendCorpName.Text));
        hashtable.Add("ReceiveType", SqlStringConstructor.GetQuotedString(this.txtReceiveType.SelectedValue));
        hashtable.Add("ReceiveDate", SqlStringConstructor.GetQuotedString(this.txtReceiveDate.Text));
        hashtable.Add("Remark", SqlStringConstructor.GetQuotedString(this.txtRemark.Text));
        hashtable.Add("IsPigeonhole", SqlStringConstructor.GetQuotedString("0"));
        hashtable.Add("UserCode", SqlStringConstructor.GetQuotedString(this.UserCode));
        hashtable.Add("RecordDate", SqlStringConstructor.GetQuotedString(dateTime.ToString()));
        hashtable.Add("CorpCode", SqlStringConstructor.GetQuotedString(this.CorpCode));
        if (this.FileUpload1.HasFile)
        {
            HttpPostedFile postedFile = this.FileUpload1.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.FileID == Guid.Empty)
        {
            if (DocumentAction.AddReceiveFileInfo(hashtable))
            {
                this.JS.Text = "alert('保存成功!');window.returnValue=true;window.close();";
                return;
            }
            this.JS.Text = "alert('保存失败!');";
            return;
        }
        else
        {
            string where = " where FileID = '" + this.FileID.ToString() + " '";
            if (DocumentAction.UpdReceiveFileInfo(hashtable, where))
            {
                this.JS.Text = "alert('保存成功!');window.returnValue=true;window.close();";
                return;
            }
            this.JS.Text = "alert('保存失败!');";
            return;
        }
    }