protected void btnAdd_Click(object sender, EventArgs e) { HttpPostedFile files = fuQualify.PostedFile; if (files.ContentLength <= 0 || !files.FileName.EndsWith(".rar")) { mbMsg.ShowMsg("必须上传相关附件且只能是.rar文件!", System.Drawing.Color.Red); } else { mbMsg.HideMsg(); CompanyQualification q = new CompanyQualification(); int comId = int.Parse(Request.QueryString["ID"]); q.CompanyID = comId; q.CreateTime = DateTime.Now; q.CreateUser = Profile.AccountInfo.UserID; q.QualificationDesc = txtDesc.Text.Trim(); q.QualificationName = txtName.Text; q.QualificationStatus = ComponentStatus.Enabled; q.UpdateTime = DateTime.Now; q.UpdateUser = Profile.AccountInfo.UserID; q.QualificationFile = files.FileName; CompanyQualifications.AddFile(q, files.InputStream); mbMsg.ShowMsg("成功新增一份资质文件!", System.Drawing.Color.Navy); txtName.Text = string.Empty; txtDesc.Text = string.Empty; BindQualify(); } }
protected void Button9_Click(object sender, EventArgs e) { CompanyQualification qualification = new CompanyQualification(); qualification.CompanyID = 1; qualification.QualificationDesc = "Qualification Desc"; qualification.QualificationName = System.IO.Path.GetFileName(FileUpload1.FileName); CompanyQualifications.AddFile(qualification, FileUpload1.PostedFile.InputStream); }