Пример #1
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (IsPageValid())
            {
                try
                {
                    ContractInfo contract = new ContractInfo();
                    contract.BeginDate = txtBeginDate.Text.ToString();
                    contract.SignName  = ddlAuto.SelectedItem.Text.ToString();
                    if (UpFile.HasFile)
                    {
                        this.UpFile.PostedFile.SaveAs(Server.MapPath("~/Files/Contract/" + UpFile.FileName));
                        ContractFileInfo cf = new ContractFileInfo();
                        cf.PhyFileName      = UpFile.PostedFile.FileName;
                        cf.ContractFileName = UpFile.FileName.ToString();
                        cf.Save();
                        contract.ContractFileId = Convert.ToInt32(cf.ContractFileId);
                    }

                    contract.SignName     = ddlAuto.SelectedItem.Text.ToString();
                    contract.ContractName = txtContractName.Text.ToString();
                    contract.ContractNum  = txtContractNum.Text.ToString();
                    contract.MoneySum     = txtMoney.Text.ToString();
                    contract.Save();
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('添加成功!');</script>");
                }
                catch (Exception Ex)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('添加失败:" + Ex.Message + "');", true);
                }
            }
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int fileid                = Int32.Parse(Request.QueryString["fileid"]);//获取文件的ID
            ContractFileInfo file     = new ContractFileInfo(fileid);
            string           fileName = file.ContractFileName;

            DownLoads(fileName);
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int fileid                = Int32.Parse(Request.QueryString["fileid"]);//获取文件的ID
            ContractFileInfo file     = new ContractFileInfo(fileid);
            string           fileName = file.ContractFileName;

            //获取桌面路径
            //string DeskPath = Convert.ToString(System.Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles));
            string DeskPath = Server.MapPath("~\\Files\\File");

            DownLoads(DeskPath, fileName);
        }
Пример #4
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (IsPageValid())
     {
         try
         {
             ContractApplyInfo CA = new ContractApplyInfo();
             ContractFileInfo  cf = new ContractFileInfo();
             if (UpFile.HasFile)
             {
                 this.UpFile.PostedFile.SaveAs(Server.MapPath("~/Files/Contract/" + UpFile.FileName));
                 // cf.PhyFileName = UpFile.PostedFile.FileName;
                 cf.ContractFileName = UpFile.FileName.ToString();
                 cf.Save();
                 CA.ContractFileId = Convert.ToInt32(cf.ContractFileId);
             }
             CA.BeginDate    = txtBeginDate.Text.ToString();
             CA.SignName     = ddlAuto.SelectedItem.Text.ToString();
             CA.ContractName = txtContractName.Text.ToString();
             CA.ContractNum  = txtContractNum.Text.ToString();
             CA.SheetNum     = txtSheetNum.Text.ToString();
             CA.Today        = DateTime.Now.ToString("yyyyMMdd").Substring(2);
             CA.BeginDate    = txtBeginDate.Text.ToString();
             CA.ApplyDate    = txtApplyDate.Text.ToString();
             CA.ContractDes  = txtContractDes.Text.ToString();
             CA.BigMoney     = txtBigMoney.Text.ToString();
             CA.SmallMoney   = txtSmallMoney.Text.ToString();
             CA.UseStampType = rblSignType.SelectedItem.Text.ToString();
             CA.IsMoney      = 0;
             if (ckbIsMoney.Checked)
             {
                 CA.IsMoney = 1;
             }
             CA.ApplyName  = lblEmployee.Text.ToString();
             CA.DepartName = lblDepart.Text.ToString();
             CA.State      = 0;
             CA.Save();
             Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('保存成功!');</script>");
         }
         catch (Exception Ex)
         {
             ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('保存失败:" + Ex.Message + "');", true);
         }
     }
 }