StudentServicesController.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using EMIS.CommonLogic.Students;
  2. using System;
  3. using System.Net;
  4. using System.Net.Http;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Web;
  8. using System.Web.Mvc;
  9. using EMIS.ViewModel;
  10. using EMIS.ViewModel.SystemView;
  11. using EMIS.CommonLogic.SystemServices;
  12. using EMIS.ViewModel.Students;
  13. using EMIS.Utility.FormValidate;
  14. namespace EMIS.Web.ServiceControllers.StudentManage
  15. {
  16. public class StudentServicesController: Controller
  17. {
  18. public IStudentsServices StudentsServices { get; set; }
  19. public IUserServices userServices { get; set; }
  20. public IStudentRecordServices studentRecordServices { get; set; }
  21. public ActionResult GetStudentViewByLoginID(string loginID)
  22. {
  23. return Json(StudentsServices.GetStudentViewByLoginID(loginID), JsonRequestBehavior.AllowGet);
  24. }
  25. public ActionResult GetStudentViewByUserID(Guid userID)
  26. {
  27. return Json(StudentsServices.GetStudentfileView(userID), JsonRequestBehavior.AllowGet);
  28. }
  29. public ActionResult GetStudentViewByIDNum(string idNum)
  30. {
  31. return Json(StudentsServices.GetStudentViewByIDNum(idNum), JsonRequestBehavior.AllowGet);
  32. }
  33. //public ActionResult GetStudentChangeFeilds(Guid? UserID)
  34. //{
  35. // return Json(studentRecordServices.GetStudentChangeFeilds(UserID.Value), JsonRequestBehavior.AllowGet);
  36. //}
  37. //public ActionResult StudentChangeSave(RegistView Model, Guid? UserID)
  38. //{
  39. // try
  40. // {
  41. // userServices.StudentRegist(Model);
  42. // return Json(new ReturnMessage { IsSuccess = true, Message = "保存成功" });
  43. // }
  44. // catch (Exception ex)
  45. // {
  46. // return Json(new ReturnMessage { IsSuccess = false, Message = "保存失败,原因:" + ex.Message });
  47. // }
  48. //}
  49. public ActionResult SaveStudentChange(StudentsView Model, Guid UserID)
  50. {
  51. try
  52. {
  53. HttpContext.User = new CustomPrincipal() { UserID = UserID };
  54. StudentsServices.Save(Model);
  55. return Json(new ReturnMessage { IsSuccess = true, Message = "保存成功" });
  56. }
  57. catch (Exception ex)
  58. {
  59. return Json(new ReturnMessage { IsSuccess = false, Message = "保存失败,原因:" + ex.Message });
  60. }
  61. }
  62. }
  63. }