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.8 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
  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. if (File.Exists(imgPath))
  31. {
  32. context.Response.ContentType = imgPath;
  33. }
  34. else
  35. {
  36. context.Response.ContentType = GetStatic.ReadWebConfig("root", "") + "Images\\na.gif";
  37. }
  38. }
  39. context.Response.WriteFile(context.Response.ContentType);
  40. }
  41. public bool IsReusable
  42. {
  43. get
  44. {
  45. return false;
  46. }
  47. }
  48. }
  49. }