You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.9 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. using Common.Helper;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Web;
  7. namespace JMEAgentSystem.WebPages
  8. {
  9. /// <summary>
  10. /// Summary description for GetFileView
  11. /// </summary>
  12. public class GetFileView : IHttpHandler
  13. {
  14. public void ProcessRequest(HttpContext context)
  15. {
  16. var imageName = context.Request.QueryString["fileName"];
  17. var imgPath = GetStatic.GetAppRoot() + @"\Images\na.gif";
  18. if (imageName == "" || imageName == null || imageName.Split('_').Length < 6)
  19. {
  20. context.Response.WriteFile(imgPath);
  21. }
  22. else
  23. {
  24. var registerDate = context.Request.QueryString["registerDate"];
  25. var customerId = context.Request.QueryString["customerId"];
  26. var membershipNo = context.Request.QueryString["membershipNo"];
  27. var fileName = context.Request.QueryString["fileName"];
  28. DateTime txnDate = Convert.ToDateTime(registerDate);
  29. //imgPath = GetStatic.GetCustomerFilePath() + "CustomerDocument\\" + registerDate.Replace("-", "\\") + "\\" + membershipNo + "\\" + fileName;
  30. imgPath = Path.Combine(GetStatic.GetCustomerFilePath(), "CustomerDocument", registerDate.Replace("-", "/"), membershipNo, fileName);
  31. if (File.Exists(imgPath))
  32. {
  33. context.Response.ContentType = imgPath;
  34. }
  35. else
  36. {
  37. context.Response.ContentType = GetStatic.ReadWebConfig("root", "") + "Images\\na.gif";
  38. }
  39. }
  40. context.Response.WriteFile(context.Response.ContentType);
  41. }
  42. public bool IsReusable
  43. {
  44. get
  45. {
  46. return false;
  47. }
  48. }
  49. }
  50. }