Advertisement
Guest User

Untitled

a guest
Feb 24th, 2020
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. public static int getEmployeeSalaray(Employee e)
  2. {
  3. int eid = Int32.Parse(e.employeeId);
  4. Employee emp = Methods.LoadEmployeeData(eid).Result;
  5. if (e != null)
  6. {
  7. int sum = new Int32();
  8. foreach (Employee.Salary s in emp.salary)
  9. {
  10. int sal = Int32.Parse(s.salary);
  11. sum += sal;
  12. }
  13. return sum;
  14.  
  15. }
  16. else
  17. {
  18. return 0;
  19. }
  20. }
  21. public static void LoadEmploymentDocument(Employee e)
  22. {
  23. int eid = Int32.Parse(e.employeeId);
  24. /* Employee e = Methods.LoadEmployeeData(eid).Result; */
  25. int salary = Methods.getEmployeeSalaray(e);
  26.  
  27. string dok = System.IO.File.ReadAllText("MallAsHtml.html");
  28. var Renderer = new IronPdf.HtmlToPdf();
  29. //var PDF = Renderer.RenderHTMLFileAsPdf("MallAsHtml.html");
  30. var HtmlTemplate = dok;
  31. var HtmlInstance = HtmlTemplate.Replace("[[FIRSTNAME]]", e.firstName).Replace("[[LASTNAME]]", e.lastName).Replace("[[NATIONALID]]", e.nationalId).Replace("[[STARTDATE]]", e.startDate).Replace("[[SALARY]]", salary.ToString());
  32. var Pdf = Renderer.RenderHtmlAsPdf(HtmlInstance);
  33. Pdf.SaveAs(e.employeeId +"_" + e.firstName+".pdf");
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement