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();
}
///
/// 招生简章
///
///
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);
}
///
/// 报名
///
/// 主键
/// 招生老师
///
///
[HttpPost]
[AjaxOnly]
public ActionResult SaveForm(string keyValue, string EmpNo, string strEntity, string scoreList)
{
StuEnrollEntity entity = strEntity.ToObject();
List scoreData = scoreList.ToObject>();
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("保存成功!");
}
///
///
///
/// 1 查询考试地点及时间;2 查询录取结果
///
///
[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()
};
}
return Success(jsonData);
}
///
/// 下载
///
/// 文件名称
/// 原文件名称
///
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());
}
}
}