HomeController.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using EmisTerminal.EIF;
  7. using System.Threading;
  8. using System.Runtime.InteropServices;
  9. namespace EmisTerminal.Controllers
  10. {
  11. public class HomeController : Controller
  12. {
  13. public ActionResult screensaver()
  14. {
  15. return View();
  16. }
  17. public ActionResult screensaverTwo()
  18. {
  19. return View();
  20. }
  21. public ActionResult Index()
  22. {
  23. return View();
  24. }
  25. public ActionResult IDCertView()
  26. {
  27. return View();
  28. }
  29. public ActionResult Preview(Guid userID, string idNum)
  30. {
  31. return View();
  32. }
  33. public ActionResult PrintView(Guid userID, string idNum)
  34. {
  35. return View();
  36. }
  37. public ActionResult Message(string message)
  38. {
  39. ViewBag.Message = message;
  40. return View();
  41. }
  42. [HttpPost]
  43. public ActionResult Check()
  44. {
  45. return Json(IDCert.Check());
  46. }
  47. [HttpPost]
  48. public ActionResult StopCheck()
  49. {
  50. IDCert.isStop = true;
  51. return Json(new ResultMessage<String> { IsSuccess = true, Message = "成功" });
  52. }
  53. [HttpPost]
  54. public ActionResult Print(string pdfFile, Guid userID)
  55. {
  56. try
  57. {
  58. Report.PrintFile(pdfFile, userID);
  59. return RedirectToAction("Message", new { message = "打印完成,请取走您的成绩单。" });
  60. }
  61. catch (Exception ex)
  62. {
  63. return RedirectToAction("Message", new { message = "打印失败:" + ex.Message + "请联系管理员。" });
  64. }
  65. return Json(new ResultMessage<String> { IsSuccess = true, Message = "成功" });
  66. }
  67. [HttpPost]
  68. public ActionResult GetPreview(Guid userID, string idNum)
  69. {
  70. var fileName = Report.GenerateStudentScore(userID, idNum);
  71. return Json(new ResultMessage<String> { IsSuccess = true, Message = "成功", Data = Url.Content(fileName) });
  72. }
  73. }
  74. }