|
- using Learun.Application.Base.SystemModule;
- using Learun.Application.TwoDevelopment.EducationalAdministration;
- using Learun.Util;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using Learun.Application.Organization;
- using System.IO;
-
- namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
- {
- public class StuEnrollPhoneController : Controller
- {
- private EmpInfoIBLL empInfoIBLL = new EmpInfoBLL();
- private StuEnrollIBLL stuEnrollIBLL = new StuEnrollBLL();
-
- #region 视图
- public ActionResult Link()
- {
- return View();
- }
-
- public ActionResult Form()
- {
- return View();
- }
-
- public ActionResult Search(int type)
- {
- if (type == 1)
- {
-
- ViewBag.Title = "查询考试地点及时间";
- }
- if (type == 2)
- {
-
- ViewBag.Title = "查询录取结果";
- }
- return View();
- }
-
- public ActionResult SearchResult()
- {
- return View();
- }
-
- /// <summary>
- /// 招生简章
- /// </summary>
- /// <returns></returns>
- public ActionResult StuRecruitmentBrochure()
- {
- return View();
- }
-
- #endregion
-
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetEmpInfoEntityByEmpNo(string empNo)
- {
- var EmpInfoData = empInfoIBLL.GetEmpInfoEntityByEmpNo(empNo);
- EmpInfoData.resume = WebHelper.HtmlDecode(EmpInfoData.resume);
- return Success(EmpInfoData);
- }
-
- /// <summary>
- /// 报名
- /// </summary>
- /// <param name="keyValue">主键</param>
- /// <param name="EmpNo">招生老师</param>
- /// <param name="strEntity"></param>
- /// <returns></returns>
- [HttpPost]
- [AjaxOnly]
- public ActionResult SaveForm(string keyValue, string EmpNo, string strEntity, string scoreList)
- {
- StuEnrollEntity entity = strEntity.ToObject<StuEnrollEntity>();
- List<StuEnrollMidExamScoreEntity> scoreData = scoreList.ToObject<List<StuEnrollMidExamScoreEntity>>();
- if (string.IsNullOrEmpty(keyValue))
- {
- var model = stuEnrollIBLL.GetEntityByPersonalData(entity.IDCard, entity.StuName);
- if (model != null)
- {
- return Fail("您已报名,请耐心等待结果!");
- }
- }
- entity.EmpNo = EmpNo;
- stuEnrollIBLL.SaveEnroll(keyValue, entity, scoreData);
- return Success("保存成功!");
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="type">1 查询考试地点及时间;2 查询录取结果</param>
- /// <param name="strEntity"></param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult SearchForm(int type, StuEnrollEntity entity)
- {
- var data = stuEnrollIBLL.SearchForm(type, entity);
- var jsonData = new object();
- if (data != null)
- {
- jsonData = new
- {
- StuEnroll = data,
- examData = stuEnrollIBLL.GetExamDataByStuId(data.StuId)
- };
- }
- else
- {
- jsonData = new
- {
- StuEnroll = data,
- examData = new List<ExamSubjectEntity>()
- };
- }
-
- return Success(jsonData);
- }
- /// <summary>
- /// 下载
- /// </summary>
- /// <param name="name">文件名称</param>
- /// <param name="pathName">原文件名称</param>
- /// <returns></returns>
- public ActionResult FileDownLoad(string name, string pathName)
- {
- FileStreamResult result = null;
- try
- {
- var path = Server.MapPath("~/Content/otherFile/");
- var pathoffull = path + pathName;
- FileStream fsread = new FileStream(pathoffull, FileMode.OpenOrCreate, FileAccess.ReadWrite);
- result = File(fsread, "application/pdf", name + ".pdf");
-
- return result;
- }
- catch (Exception ex)
- {
- return null;
- }
- }
-
- protected virtual ActionResult Success(string info)
- {
- return Content(new ResParameter { code = ResponseCode.success, info = info, data = new object { } }.ToJson());
- }
-
- protected virtual ActionResult Success(object data)
- {
- return Content(new ResParameter { code = ResponseCode.success, info = "响应成功", data = data }.ToJson());
- }
- protected virtual ActionResult Fail(object data)
- {
- return Content(new ResParameter { code = ResponseCode.fail, info = "响应失败", data = data }.ToJson());
- }
- protected virtual ActionResult JsonResult(object data)
- {
- return Content(new ResParameter { code = ResponseCode.success, info = "响应成功", data = data }.ToJson());
- }
- }
- }
|