protected void savebtn_Click(object sender, EventArgs e) { string currentPrice; if (Convert.ToDateTime(Request.Form[EndDate.UniqueID]) < Convert.ToDateTime(Request.Form[StartDate.UniqueID])) { ErrorMessage.Visible = true; FailureText.Text = "Invalid date range"; } else { currentPrice = Request.Form[txtcurrentPrice.UniqueID]; currentPrice = currentPrice.Replace("$", string.Empty); if (docUpload.HasFile) { fileList = new List <DocumentFile>(); if (docUpload.PostedFiles.Count == 2) { ErrorMessage.Visible = false; foreach (HttpPostedFile file in docUpload.PostedFiles) { //HttpPostedFile file = docUpload.PostedFile; BinaryReader br = new BinaryReader(file.InputStream); byte[] buffer = br.ReadBytes(file.ContentLength); using (BHSCMS_Entities dc = new BHSCMS_Entities()) { DocumentTable d = (from d1 in dc.DocumentTables where d1.ReferenceID == _rfiid && d1.TypeID == 2 select d1).First(); d.Document_Data = buffer; d.Document_Name = file.FileName; d.Content_Type = file.ContentType; d.DateStamp = DateTime.Today; dc.SaveChanges(); PopulateUploadedFiles(); } } } else { ErrorMessage.Visible = true; FailureText.Text = "***2 Files are required to submit the RFI"; } } rfi.UpdateRFI(UserInfoBoxControl.UserID, Request.Form[StartDate.UniqueID], Request.Form[EndDate.UniqueID], Convert.ToDecimal(currentPrice), Request.Form[productDescription.UniqueID].ToString(), _rfiid); UpdateVendorParticipation(); Page.Response.Redirect("ViewRFIList.aspx"); } }
private void PopulateUploadedFiles() { using (BHSCMS_Entities dc = new BHSCMS_Entities()) { List <DocumentTable> allFiles = dc.DocumentTables.Where(a => (a.ReferenceID == rId && a.TypeID == 5 && a.VendorID == vendorID)).ToList(); listFiles.DataSource = allFiles; listFiles.DataBind(); } }
private void PopulateUploadedFiles() { using (BHSCMS_Entities dc = new BHSCMS_Entities()) { List <DocumentTable> allFiles = dc.DocumentTables.Where(a => a.ReferenceID == contractID && a.TypeID == 7).ToList(); listFiles.DataSource = allFiles; listFiles.DataBind(); } }
protected void savebtn_Click(object sender, EventArgs e) { RFI r = new RFI(); // Code for Upload file to database if (docUpload.HasFile) { fileList = new List <DocumentFile>(); if (docUpload.PostedFiles.Count == 2) { ErrorMessage.Visible = false; foreach (HttpPostedFile file in docUpload.PostedFiles) { //HttpPostedFile file = docUpload.PostedFile; BinaryReader br = new BinaryReader(file.InputStream); byte[] buffer = br.ReadBytes(file.ContentLength); using (BHSCMS_Entities dc = new BHSCMS_Entities()) { dc.DocumentTables.Add( new DocumentTable { TypeID = 5, Document_Data = buffer, Document_Name = file.FileName, Content_Type = file.ContentType, ReferenceID = rId, DateStamp = DateTime.Today, VendorID = vendorID }); dc.SaveChanges(); PopulateUploadedFiles(); } } r.UpdateRFIStatus(rId, vendorID);//updates the complete status on VendorRFITable Page.Response.Redirect("VendorRFIList.aspx"); } else { ErrorMessage.Visible = true; FailureText.Text = "***2 Files are required to submit the RFI"; } } }
protected void listFiles_ItemCommand(object source, DataListCommandEventArgs e) { if (e.CommandName == "Download") { int docID = Convert.ToInt32(e.CommandArgument); using (BHSCMS_Entities dc = new BHSCMS_Entities()) { var v = dc.DocumentTables.Where(a => a.DocID == docID).FirstOrDefault(); if (v != null) { byte[] fileData = v.Document_Data; Response.AddHeader("Content-type", v.Content_Type); Response.AddHeader("Content-Disposition", "attachment; filename=" + v.Document_Name); byte[] dataBlock = new byte[0x1000]; long fileSize; int bytesRead; long totalsBytesRead = 0; using (Stream st = new MemoryStream(fileData)) { fileSize = st.Length; while (totalsBytesRead < fileSize) { if (Response.IsClientConnected) { bytesRead = st.Read(dataBlock, 0, dataBlock.Length); Response.OutputStream.Write(dataBlock, 0, bytesRead); Response.Flush(); totalsBytesRead += bytesRead; } } } Response.End(); } } } }
protected void savebtn_Click(object sender, EventArgs e) { // Code for Upload file to database if (docUpload.HasFiles) { fileList = new List <DocumentFile>(); foreach (HttpPostedFile file in docUpload.PostedFiles) { //HttpPostedFile file = docUpload.PostedFile; BinaryReader br = new BinaryReader(file.InputStream); byte[] buffer = br.ReadBytes(file.ContentLength); using (BHSCMS_Entities dc = new BHSCMS_Entities()) { dc.DocumentTables.Add( new DocumentTable { TypeID = 7, Document_Data = buffer, Document_Name = file.FileName, Content_Type = file.ContentType, ReferenceID = contractID, DateStamp = DateTime.Today, VendorID = vendorID }); dc.SaveChanges(); PopulateUploadedFiles(); } } Contract c = new Contract(); c.UpdateContractStatus(contractID, vendorID);//updates the complete status on VendorRFITable Page.Response.Redirect("VendorContractList.aspx"); } }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { int vendorid = Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "VendorID").ToString()); using (BHSCMS_Entities dc = new BHSCMS_Entities()) { List <DocumentTable> allFiles = dc.DocumentTables.Where(a => a.ReferenceID == rId && a.TypeID == 6 && a.VendorID == vendorid).ToList(); DataList datalist = (DataList)e.Row.FindControl("listFiles"); datalist.DataSource = allFiles; datalist.DataBind(); } int userID = Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "UserID"));//gets the userID from the row clicked on grid HyperLink details = (HyperLink)e.Row.FindControl("vendorDetails"); details.NavigateUrl = String.Format("/Dashboard/Account/DetailsVendor.aspx?userid={0}", userID);// } }
protected void CreateUser_Click(object sender, EventArgs e) { // Code for Upload file to database if (docUpload.HasFiles) { fileList = new List <DocumentFile>(); if (docUpload.PostedFiles.Count == 1) { foreach (HttpPostedFile file in docUpload.PostedFiles) { //HttpPostedFile file = docUpload.PostedFile; BinaryReader br = new BinaryReader(file.InputStream); byte[] buffer = br.ReadBytes(file.ContentLength); using (BHSCMS_Entities dc = new BHSCMS_Entities()) { dc.DocumentTables.Add( new DocumentTable { TypeID = 1, Document_Data = buffer, Document_Name = file.FileName, Content_Type = file.ContentType, DateStamp = DateTime.Today, VendorID = v.GetLastVendorIDinserted() + 1 }); dc.SaveChanges(); } } //variables used to create the new vendor #region string company = CompanyName.Text; string phone = PhoneNumber.Text; string fax = FaxNumber.Text; string address1 = Address.Text; string address2 = Address2.Text; string city = City.Text; string state = ddState.SelectedItem.Value; string zipcode = Zipcode.Text; string regDate = DateTime.Today.ToShortDateString(); int taxid = Convert.ToInt32(TaxID.Text); string username = UserName.Text; string password = Password.Text; string priEmail = Email.Text; string secEmail = AltEmail.Text; int roleid = 3;//vendor role is number 3 #endregion if (IsValid && BooleanRegistration() == true) { v.RegisterUser(username, password, priEmail, secEmail, roleid); int userid = v.GetLastUserIDinserted();//gets the user id from the sysusertable v.RegisterVendor(company, userid, phone, fax, address1, address2, city, state, zipcode, 2, regDate, taxid); AddVendorCategories();//inserts categories the vendor sells in the bridge SellTable string emailmessage = "Hello " + CompanyName.Text.Trim() + " !<\br>" + "Thanks for showing interest and registering in <a href='http://www.cob-blobfish.cbpa.louisville.edu'>Baptist Health Supply Chain Solution<a>" + " You can now go and login in the website, however our staff still needs to validate you which can take from 2 to 3 days. Should you have any questions, please do not hesitate to contact us. Thanks for doing business with us<\br>" + "Baptist Health Supply Chain Department"; sendemail(priEmail, emailmessage); ScriptManager.RegisterStartupScript(this, this.GetType(), "Message", "alert('Thank you for Registering!!!');", true); Page.Response.Redirect("../Default.aspx"); } else { ErrorMessage.Text = "Invalid field input or Registration Code is Incorrect."; } } else { reqdocupload.Text = "***Only one tax form is required"; } } }//ends create user method