白猪掌柜的
protected void btn_AddDocConfirm_Click(object sender, EventArgs e) { string DocDescription = txt_DocDescription_Add.Text; int FileSize = 0; int UpdateUserID = Convert.ToInt32(Session["UserID"]); string FileAlias = "User" + UpdateUserID.ToString() + "_"+DateTime.Now.ToLocalTime(); string DocName = ""; string FileType = ""; if (FileUpload_AddDoc.HasFile) { FileSize= FileUpload_AddDoc.PostedFile.ContentLength; DocName = FileUpload_AddDoc.FileName; FileType =System.IO.Path.GetExtension(FileUpload_AddDoc.FileName); } FileAlias = FileAlias + FileType; string CategoryID =ddl_DocCategory_Add.SelectedValue; string UpdateTime = DateTime.Now.ToShortDateString(); string FilePath = Server.MapPath(@"~/Doc/" + FileAlias); FileUpload_AddDoc.SaveAs(FilePath); DataAccess da = new DataAccess(Convert.ToString(Session["ConnectString"])); int newDocID = da.ExecSProc("Document_InUpDel", "SQLInsert", 0, txt_DocName_Add.Text, DocDescription, FilePath, FileSize, FileType, FileAlias, CategoryID, UpdateUserID, UpdateTime); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "closebg() ", true); pl_DocAdd.Visible = false; bindDocuments(); }