Пример #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (UpFile.HasFile)
            {
                this.UpFile.PostedFile.SaveAs(Server.MapPath("~/Files/File/" + UpFile.FileName));
                FileOfApplyInfo ffa = new FileOfApplyInfo();
                ffa.FileOfName   = UpFile.FileName.ToString();
                ffa.PhysicalName = UpFile.PostedFile.FileName.ToString();
                ffa.Save();

                FileApplyInfo fa = new FileApplyInfo();
                fa.ApplyName     = lblEm.Text.ToString();
                fa.ApplyTime     = txtTime.Text.ToString();
                fa.DepartName    = Session["DepartName"].ToString();
                fa.DepartView    = txtSectionView.Text.ToString();
                fa.FileDes       = txtFileDes.Text.ToString();
                fa.FilesName     = txtFileName.Text.ToString();
                fa.FileType      = txtFileType.Text.ToString();
                fa.State         = 0;
                fa.FileOfApplyId = ffa.FileOfApplyId;
                fa.Save();
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('新增成功,确认无误后需要您进一步提交!');</script>");
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('请上传文件!');</script>");
            }
        }
Пример #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (UpFile.HasFile)
            {
                FileApplyInfo fa = new FileApplyInfo(Convert.ToInt32(Request["FileApplyId"].ToString()));

                FileOfApplyInfo ffa = new FileOfApplyInfo(Convert.ToInt32(fa.FileOfApplyId));
                ffa.FileOfName   = UpFile.FileName.ToString();
                ffa.PhysicalName = UpFile.PostedFile.FileName.ToString();
                ffa.Save();

                fa.ApplyTime  = txtTime.Text.ToString();
                fa.DepartView = txtSectionView.Text.ToString();
                fa.FileDes    = txtFileDes.Text.ToString();
                fa.FilesName  = txtFileName.Text.ToString();
                fa.FileType   = txtFileType.Text.ToString();
                fa.Save();
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('保存成功,确认无误后需要您进一步提交!');</script>");
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('请重新修改文件名并上传!');</script>");
            }
        }