protected void uploadF_Click(object sender, EventArgs e) { //read and create loan if (File.Exists(Server.MapPath(" ") + FileUpload1.FileName) == true && (FileUpload1.FileName != string.Empty)) { File.Delete(Server.MapPath(" ") + FileUpload1.FileName); } FileUpload1.SaveAs(Server.MapPath(" ") + FileUpload1.FileName); string fileName = Server.HtmlEncode(FileUpload1.FileName); // Get the extension of the uploaded file. string extension = System.IO.Path.GetExtension(fileName); // Allow only files with .doc or .xls extensions // to be uploaded. if (extension == ".pdf") { List <string> l = new List <string>(); StringBuilder text = new StringBuilder(); if (File.Exists(Server.MapPath(" ") + FileUpload1.FileName)) { PdfReader pdfReader = new PdfReader(Server.MapPath(" ") + FileUpload1.FileName); AllLoansFunction a = new AllLoansFunction(); a.CreateLoanByFile(pdfReader, uid); pdfReader.Close(); } File.Delete(Server.MapPath(" ") + FileUpload1.FileName); } //save the upload file in the system for our employees string filename = Path.GetFileName(FileUpload1.PostedFile.FileName); string contentType = FileUpload1.PostedFile.ContentType; try { UploadDocdfunction inter = new UploadDocdfunction(); inter.createDoc(uid, filename, contentType, "Source Loan 2", FileUpload1); Loans2Function loan2 = new Loans2Function(); loan2.uploadAndCreate(uid); Waiting.Visible = true; } catch (Exception ex) { Error.Text = "Sorry Our System Work Only With Experian Document. You Can Fill In The Information Yourself"; } Response.Redirect(Request.Url.AbsoluteUri); }
protected void downloadDoc_Click(object sender, EventArgs e) { try { AllLoansFunction a = new AllLoansFunction(); iTextSharp.text.Document pdfDoc = new iTextSharp.text.Document(PageSize.A4, 25, 10, 25, 10); PdfWriter pdfWriter = PdfWriter.GetInstance(pdfDoc, Response.OutputStream); a.LoansString(cid, "2", pdfDoc); pdfWriter.CloseStream = false; pdfDoc.Close(); Response.Buffer = true; Response.ContentType = "application/pdf"; Response.AddHeader("content-disposition", "attachment;filename=Loans Report.pdf"); Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Write(pdfDoc); Response.End(); } catch (Exception ex) { Response.Write(ex.Message); } }
protected void Step2_Click(object sender, EventArgs e) { if (mp == "1app") { WantUpload.Visible = true; } else { if (mp == "2napp") { Session["Value"] = uid + "@Client"; Response.Redirect("~/LoansFolder/Loans2Form.aspx"); } else { try { AllLoansFunction a = new AllLoansFunction(); iTextSharp.text.Document pdfDoc = new iTextSharp.text.Document(PageSize.A4, 25, 10, 25, 10); PdfWriter pdfWriter = PdfWriter.GetInstance(pdfDoc, Response.OutputStream); a.LoansString(uid, "2", pdfDoc); pdfWriter.CloseStream = false; pdfDoc.Close(); Response.Buffer = true; Response.ContentType = "application/pdf"; Response.AddHeader("content-disposition", "attachment;filename=Loans Report.pdf"); Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Write(pdfDoc); Response.End(); } catch (Exception ex) { Response.Write(ex.Message); } } } }
public void SubmitLoan1(Loans1 l1, string clientId) { Loans1 l = new Loans1(); AllLoansFunction allLF = new AllLoansFunction(); if (allLF.ClientHasLoan(clientId)) { l = new Loans1(FindLoan1ByClient(clientId)); l1.Id = l.Id; l = new Loans1(l1); } else { l = new Loans1(l1); l.Id = -1; } ClientC client = new ClientC(); if (client.FindIfClientHasLoan(l.ClientId)) { throw new Exception("You Are In The Middle Of A Loan Application Process"); } if (l.BusinessName == "") { throw new Exception("The Business Legal Name Field Is Empty"); } if (l.Pcontact == "") { throw new Exception("The Pirmary Contact Field Is Empty"); } if (l.TaxID == "") { throw new Exception("The Tax ID Field Is Empty"); } if (l.SS == "") { throw new Exception("The Social Security Field Is Empty"); } if (l.Tel == "") { throw new Exception("The Telephone Field Is Empty"); } if (l.Mail == "") { throw new Exception("The Email Address Field Is Empty"); } if (l.Street == "") { throw new Exception("The Street Address Field Is Empty"); } if (l.City == "") { throw new Exception("The City Field Is Empty"); } if (l.State == "") { throw new Exception("The State Field Is Empty"); } if (l.Zip == "") { throw new Exception("The Zip Field Is Empty"); } if (l.DateBE == "") { throw new Exception("The Date Business Established Field Is Empty"); } if (l.StateoOI == "") { throw new Exception("The State of Incorporatin Field Is Empty"); } if (l.EmployeesNum == "") { throw new Exception("The Number of Employees After Financing Field Is Empty"); } if (l.Id == -1) { CreatLoans1(l); } else { UpdateLoan1(l); } }