using Learun.Application.Base.SystemModule;
using Learun.Application.OA;
using Learun.Application.Organization;
using Learun.Application.TwoDevelopment.EducationalAdministration;
using Learun.Application.TwoDevelopment.Permission;
using Learun.Application.WorkFlow;
using Learun.Util;
using Learun.Util.Operat;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Newtonsoft.Json;
using Learun.Application.TwoDevelopment.AdmissionsPlatform;
using Learun.Application.TwoDevelopment.ReceiveSendFeeManagement;
namespace Learun.Application.Web.Controllers
{
[HandlerLogin(FilterMode.Ignore)]
public class OnlineRegistrateController : MvcControllerBase
{
private CdMajorIBLL cdMajorIBLL = new CdMajorBLL();
private DataItemIBLL dataItemIBLL = new DataItemBLL();
private CompanyIBLL companyIBLL = new CompanyBLL();
private AP_OnlineUserInfoIBLL onlineUserInfoIBLL = new AP_OnlineUserInfoBLL();
private AP_OnlineStudentInfoIBLL onlineStudentInfoIBLL = new AP_OnlineStudentInfoBLL();
private AP_CompanyPaymentAccountIBLL aP_CompanyPaymentAccountIBLL = new AP_CompanyPaymentAccountBLL();
private FinaChargesStandardIBLL finaChargesStandardIBLL = new FinaChargesStandardBLL();
private AnnexesFileIBLL annexesFileIBLL = new AnnexesFileBLL();
private DIC_PROVINCEIBLL dIC_PROVINCEIBLL = new DIC_PROVINCEBLL();
private DataSourceIBLL dataSourceIBLL = new DataSourceBLL();
///
/// 选择专业
///
///
public ActionResult MajorInfo(string userId, bool isReselect = false)
{
//是否是重选专业
ViewBag.UserId = userId;
ViewBag.IsReselect = isReselect;
//获取专业信息
var majorInfoModel = new MajorInfoModel();
var aaa = cdMajorIBLL.GetListByDeptNo("").GroupBy(x => x.RecruitObject).Select(x => new RecruitInfoModel()
{
RecruitObject = x.Key,
RecruitObjectText = dataItemIBLL.GetDetailList("RecruitObject").FirstOrDefault(a => a.F_ItemValue == x.Key)?.F_ItemName,
SchoolInfoList = x.GroupBy(y => y.F_SchoolId).Select(y => new SchoolInfoModel()
{
ShoolId = y.Key,
Shool = companyIBLL.GetEntity(y.Key)?.F_FullName,
MajorInfoList = y.Select(xx => new CdMajorEntity()
{
MajorNo = xx.MajorNo,
MajorName = xx.MajorName
}).OrderBy(xx => xx.MajorNo).ToList()
}).ToList()
}).OrderBy(x => x.RecruitObject).ToList();
majorInfoModel.RecruitInfoList = aaa;
return View(majorInfoModel);
}
///
/// 专业介绍
///
///
public ActionResult MajorIntroduce(string majorNo, string userId, bool isReselect = false)
{
//是否是重选专业
ViewBag.UserId = userId;
ViewBag.IsReselect = isReselect;
var model = cdMajorIBLL.GetCdMajorEntityByMajorNo(majorNo);
if (!string.IsNullOrEmpty(model.RecruitObject))
{
model.RecruitObjectText = dataItemIBLL.GetDetailList("RecruitObject").FirstOrDefault(a => a.F_ItemValue == model.RecruitObject)?.F_ItemName;
}
if (!string.IsNullOrEmpty(model.F_SchoolId))
{
model.SchoolName = companyIBLL.GetEntity(model.F_SchoolId)?.F_FullName;
}
//获取头像地址
if (!string.IsNullOrEmpty(model.Photo))
{
var annexesFileEntity = annexesFileIBLL.GetEntityByFolderId(model.Photo);
if (annexesFileEntity != null)
{
model.Photo = "/" + annexesFileEntity.F_FilePath.Substring(annexesFileEntity.F_FilePath.IndexOf("Resource"));
}
else
{
model.Photo = "";
}
}
return View(model);
}
///
/// 填写信息
///
///
public ActionResult SignUp(string majorNo)
{
var model = cdMajorIBLL.GetCdMajorEntityByMajorNo(majorNo);
if (!string.IsNullOrEmpty(model.RecruitObject))
{
model.RecruitObjectText = dataItemIBLL.GetDetailList("RecruitObject").FirstOrDefault(a => a.F_ItemValue == model.RecruitObject)?.F_ItemName;
}
if (!string.IsNullOrEmpty(model.F_SchoolId))
{
model.SchoolName = companyIBLL.GetEntity(model.F_SchoolId)?.F_FullName;
}
ViewBag.Sex = dataItemIBLL.GetDetailList("usersex");
return View(model);
}
///
/// 报名成功
///
///
public ActionResult SignUpSuccess(string userId)
{
ViewBag.UserId = userId;
return View();
}
///
/// 缴费
///
///
public ActionResult PaymentMoney(string userId, bool isLogin = false)
{
//是否是登录后点击的缴费
ViewBag.IsLogin = isLogin;
//基础信息
var onlineUserInfo = onlineUserInfoIBLL.GetEntity(userId);
if (onlineUserInfo != null)
{
onlineUserInfo.SexId = dataItemIBLL.GetDetailList("usersex").FirstOrDefault(a => a.F_ItemValue == onlineUserInfo.SexId)?.F_ItemName;
var osinfo = onlineStudentInfoIBLL.GetEntityByUserId(onlineUserInfo.Id);
onlineUserInfo.SchoolId = osinfo?.SchoolId;
onlineUserInfo.MajorId = osinfo?.MajorId;
onlineUserInfo.SchoolName = companyIBLL.GetEntity(onlineUserInfo.SchoolId)?.F_FullName;
onlineUserInfo.MajorName = cdMajorIBLL.GetCdMajorEntityByMajorNo(onlineUserInfo.MajorId)?.MajorName;
//费用信息
var semesterAndYear = Common.GetSemesterAndYear();
var finaChargesStandardEntities = finaChargesStandardIBLL.GetFinaChargesStandardListByMajorNoOfNotAll(osinfo?.MajorId, semesterAndYear.AcademicYearShort, semesterAndYear.Semester, semesterAndYear.AcademicYearShort.Substring(0, 2));
if (finaChargesStandardEntities.Any())
{
ViewBag.feeList = finaChargesStandardEntities;
ViewBag.feeTotal = finaChargesStandardEntities.Select(x => x.Standard).Sum();
}
}
//支付方式
ViewBag.AP_CompanyPaymentAccount = new AP_CompanyPaymentAccountEntity();
var AP_CompanyPaymentAccountData = aP_CompanyPaymentAccountIBLL.GetList(null).FirstOrDefault(x => x.IsEnabled == true);
if (AP_CompanyPaymentAccountData != null)
{
AP_CompanyPaymentAccountData.CompayId = companyIBLL.GetEntity(AP_CompanyPaymentAccountData.CompayId)?.F_FullName;
ViewBag.AP_CompanyPaymentAccount = AP_CompanyPaymentAccountData;
}
return View(onlineUserInfo);
}
///
/// 登录
///
///
public ActionResult Login()
{
return View();
}
///
/// 登记表
///
///
public ActionResult RegistrateForm(string userId)
{
var ouinfo = new AP_OnlineUserInfoEntity();
var onlineUserInfoEntity = onlineUserInfoIBLL.GetEntity(userId);
if (onlineUserInfoEntity != null)
{
//获取头像地址
if (!string.IsNullOrEmpty(onlineUserInfoEntity.PhotoUrl))
{
var annexesFileEntity = annexesFileIBLL.GetEntityByFolderId(onlineUserInfoEntity.PhotoUrl);
if (annexesFileEntity != null)
{
onlineUserInfoEntity.PhotoUrl = "/" + annexesFileEntity.F_FilePath.Substring(annexesFileEntity.F_FilePath.IndexOf("Resource"));
}
else
{
onlineUserInfoEntity.PhotoUrl = "";
}
}
//学生信息
var onlineStudentInfoEntity = onlineUserInfoIBLL.GetAP_OnlineStudentInfoEntity(userId);
if (onlineStudentInfoEntity != null)
{
onlineUserInfoEntity.AP_OnlineStudentInfoEntity = onlineStudentInfoEntity;
}
else
{
onlineUserInfoEntity.AP_OnlineStudentInfoEntity = new AP_OnlineStudentInfoEntity();
}
//简历
var onlineStudentResumeInfo = onlineUserInfoIBLL.GetAP_OnlineStudentResumeInfoList(userId);
if (onlineStudentResumeInfo.Any())
{
onlineUserInfoEntity.AP_OnlineStudentResumeInfoList = onlineStudentResumeInfo.ToList();
}
else
{
onlineUserInfoEntity.AP_OnlineStudentResumeInfoList = new List();
}
//家庭成员
var onlineStudentFamilyInfo = onlineUserInfoIBLL.GetAP_OnlineStudentFamilyInfoList(userId);
if (onlineStudentFamilyInfo.Any())
{
onlineUserInfoEntity.AP_OnlineStudentFamilyInfoList = onlineStudentFamilyInfo.ToList();
}
else
{
onlineUserInfoEntity.AP_OnlineStudentFamilyInfoList = new List();
}
ouinfo = onlineUserInfoEntity;
}
return View(ouinfo);
}
///
/// 登记表完善
///
///
public ActionResult RegistrateFormEdit(string userId)
{
var ouinfo = new AP_OnlineUserInfoEntity();
ViewBag.Url = "";
var onlineUserInfoEntity = onlineUserInfoIBLL.GetEntity(userId);
if (onlineUserInfoEntity != null)
{
//获取头像地址
if (!string.IsNullOrEmpty(onlineUserInfoEntity.PhotoUrl))
{
var annexesFileEntity = annexesFileIBLL.GetEntityByFolderId(onlineUserInfoEntity.PhotoUrl);
if (annexesFileEntity != null)
{
ViewBag.Url = "/" + annexesFileEntity.F_FilePath.Substring(annexesFileEntity.F_FilePath.IndexOf("Resource"));
}
}
//学生信息
var onlineStudentInfoEntity = onlineUserInfoIBLL.GetAP_OnlineStudentInfoEntity(userId);
if (onlineStudentInfoEntity != null)
{
onlineUserInfoEntity.AP_OnlineStudentInfoEntity = onlineStudentInfoEntity;
}
else
{
onlineUserInfoEntity.AP_OnlineStudentInfoEntity = new AP_OnlineStudentInfoEntity();
}
//简历
var onlineStudentResumeInfo = onlineUserInfoIBLL.GetAP_OnlineStudentResumeInfoList(userId);
if (onlineStudentResumeInfo.Any())
{
onlineUserInfoEntity.AP_OnlineStudentResumeInfoList = onlineStudentResumeInfo.ToList();
}
else
{
onlineUserInfoEntity.AP_OnlineStudentResumeInfoList = new List();
}
//家庭成员
var onlineStudentFamilyInfo = onlineUserInfoIBLL.GetAP_OnlineStudentFamilyInfoList(userId);
if (onlineStudentFamilyInfo.Any())
{
onlineUserInfoEntity.AP_OnlineStudentFamilyInfoList = onlineStudentFamilyInfo.ToList();
}
else
{
onlineUserInfoEntity.AP_OnlineStudentFamilyInfoList = new List();
}
ouinfo = onlineUserInfoEntity;
}
return View(ouinfo);
}
///
/// 修改密码
///
///
///
public ActionResult PasswordEdit(string userId)
{
var ouinfo = new AP_OnlineUserInfoEntity();
var onlineUserInfoEntity = onlineUserInfoIBLL.GetEntity(userId);
if (onlineUserInfoEntity != null)
{
//获取头像地址
if (!string.IsNullOrEmpty(onlineUserInfoEntity.PhotoUrl))
{
var annexesFileEntity = annexesFileIBLL.GetEntity(onlineUserInfoEntity.PhotoUrl);
if (annexesFileEntity != null)
{
onlineUserInfoEntity.PhotoUrl = "/" + annexesFileEntity.F_FilePath.Substring(annexesFileEntity.F_FilePath.IndexOf("Resource"));
}
else
{
onlineUserInfoEntity.PhotoUrl = "";
}
}
//学生信息
var onlineStudentInfoEntity = onlineUserInfoIBLL.GetAP_OnlineStudentInfoEntity(userId);
if (onlineStudentInfoEntity != null)
{
onlineUserInfoEntity.AP_OnlineStudentInfoEntity = onlineStudentInfoEntity;
}
else
{
onlineUserInfoEntity.AP_OnlineStudentInfoEntity = new AP_OnlineStudentInfoEntity();
}
ouinfo = onlineUserInfoEntity;
}
return View(ouinfo);
}
///
/// 使用向导
///
///
public ActionResult UseGuid() {
return View();
}
#region 提交数据
///
/// 获取数据源数据
///
/// 数据源编号
/// sql查询条件语句
/// 数据源请求条件字串
///
[HttpGet]
[AjaxOnly]
public ActionResult GetDataSourceMap(string code, string where)
{
var data = dataSourceIBLL.GetDataTable(code, where);
return JsonResult(data);
}
///
/// 获取数据源数据
///
/// 数据源编号
/// sql查询条件语句
/// 数据源请求条件字串
///
[HttpGet]
[AjaxOnly]
public ActionResult GetDataItemMap(string code)
{
var data = dataItemIBLL.GetDetailList(code, null);
return JsonResult(data);
}
///
/// 保存【填写信息】
/// 主键
///
///
[HttpPost]
[AjaxOnly]
public ActionResult SaveOnlineRegistrate(string strEntity)
{
var entity = strEntity.ToObject();
var aa = onlineUserInfoIBLL.GetEntityByMobile(entity.Mobile);
if (aa != null)
{
return Fail("该手机号已报名!");
}
onlineUserInfoIBLL.SaveOnlineRegistrate(entity);
var aaa = onlineUserInfoIBLL.GetEntityByMobile(entity.Mobile);
return Success("保存成功!", aaa);
}
///
/// 登录
/// 主键
///
///
[HttpPost]
[AjaxOnly]
public ActionResult Login(string userName, string passward)
{
var entity = onlineUserInfoIBLL.GetEntityByMobile(userName);
if (entity == null)
{
return Fail("该手机号不存在!");
}
if (entity.Password != passward)
{
return Fail("密码错误!");
}
return Success("登录成功!", entity);
}
///
/// 完善资料
/// 主键
///
///
[HttpPost]
[AjaxOnly]
public ActionResult SaveRegistrateFormEdit(string keyValue, string strEntity, string strOnlineStudentResumeList, string strOnlineStudentFamilyList)
{
AP_OnlineUserInfoEntity entity = strEntity.ToObject();
entity.CreateDate = DateTime.Now;
AP_OnlineStudentInfoEntity studentEntity = strEntity.ToObject();
studentEntity.Id = entity.OSIId;
studentEntity.CreateDate = DateTime.Now;
List onlineStudentResumeList = strOnlineStudentResumeList.ToObject>();
List onlineStudentFamilyList = strOnlineStudentFamilyList.ToObject>();
onlineUserInfoIBLL.SaveRegistrateForm(keyValue, entity, studentEntity, onlineStudentResumeList, onlineStudentFamilyList);
return Success("保存成功!");
}
///
/// 确定重选专业
/// 主键
///
///
[HttpPost]
[AjaxOnly]
public ActionResult SaveReselectMajor(string userId, string majorNo)
{
onlineUserInfoIBLL.SaveReselectMajor(userId, majorNo);
return Success("保存成功!");
}
///
/// 提交修改密码
/// 主键
///
///
[HttpPost]
[AjaxOnly]
public ActionResult SavePasswordEdit(string userId, string oldPassword, string newPassword)
{
var ouientity = onlineUserInfoIBLL.GetEntity(userId);
if (ouientity == null)
{
return Fail("学生不存在!");
}
if (oldPassword != ouientity.Password)
{
return Fail("旧密码不正确!");
}
if (string.IsNullOrEmpty(newPassword))
{
return Fail("新密码为空!");
}
ouientity.Password = newPassword;
onlineUserInfoIBLL.SaveEntity(ouientity.Id, ouientity);
return Success("保存成功!");
}
#endregion
#region 模型
///
/// 模型【选择专业】
///
public class MajorInfoModel
{
public List RecruitInfoList { get; set; }
}
public class RecruitInfoModel
{
///
/// 招生对象
///
public string RecruitObject { get; set; }
public string RecruitObjectText { get; set; }
///
/// 校区
///
public List SchoolInfoList { get; set; }
}
public class SchoolInfoModel
{
///
/// 校区
///
public string Shool { get; set; }
///
/// 校区主键
///
public string ShoolId { get; set; }
///
/// 专业
///
public List MajorInfoList { get; set; }
}
#endregion
}
}