using System;
using Learun.Util;
using System.Data;
using Learun.Application.TwoDevelopment.EducationalAdministration;
using System.Web.Mvc;
using System.Collections.Generic;
using System.Linq;
using Learun.Application.Organization;
namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
{
///
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
/// 创 建:超级管理员
/// 日 期:2021-12-16 10:14
/// 描 述:长阳迎新
///
public class StuVolunteerController : MvcControllerBase
{
private StuVolunteerIBLL stuVolunteerIBLL = new StuVolunteerBLL();
#region 视图功能
///
/// 主页面
///
///
[HttpGet]
public ActionResult Index()
{
return View();
}
///
/// 表单页
///
///
[HttpGet]
public ActionResult Form()
{
return View();
}
///
/// 标注页面
///
///
[HttpGet]
public ActionResult IndexLabel()
{
return View();
}
///
/// 志愿表单页
///
///
[HttpGet]
public ActionResult FormSchool()
{
return View();
}
///
/// 志愿表单页
///
///
[HttpGet]
public ActionResult IndexAccount()
{
return View();
}
///
/// 分班页面
///
///
[HttpGet]
public ActionResult IndexDivide()
{
return View();
}
///
/// 录取
///
///
[HttpGet]
public ActionResult IndexEnroll()
{
return View();
}
///
/// 生成二维码
///
///
[HttpGet]
public ActionResult QRCode()
{
return View();
}
///
/// 分班--选择班级
///
///
[HttpGet]
public ActionResult ClassForm()
{
return View();
}
///
/// 生成学籍
///
///
[HttpGet]
public ActionResult IndexGenerate()
{
return View();
}
///
/// 生成学籍--编辑
///
///
[HttpGet]
public ActionResult FormGenerate()
{
return View();
}
///
/// 专业注册
///
///
[HttpGet]
public ActionResult IndexMajor()
{
return View();
}
///
///
///
///
[HttpGet]
public ActionResult FormMajor()
{
return View();
}
///
/// 专业
///
///
[HttpGet]
public ActionResult MajorIndex()
{
return View();
}
#endregion
#region 获取数据
///
/// 获取页面显示列表数据
///
/// 分页参数
/// 查询参数
///
[HttpGet]
[AjaxOnly]
public ActionResult GetPageList(string pagination, string queryJson)
{
Pagination paginationobj = pagination.ToObject();
var data = stuVolunteerIBLL.GetPageList(paginationobj, queryJson);
var jsonData = new
{
rows = data,
total = paginationobj.total,
page = paginationobj.page,
records = paginationobj.records
};
return Success(jsonData);
}
///
/// 获取表单数据
///
/// 主键
///
[HttpGet]
[AjaxOnly]
public ActionResult GetFormData(string keyValue)
{
var StuVolunteerData = stuVolunteerIBLL.GetStuVolunteerEntity(keyValue);
var jsonData = new
{
StuVolunteer = StuVolunteerData,
};
return Success(jsonData);
}
///
/// 获取专业统计
///
///
///
[HttpGet]
[AjaxOnly]
public ActionResult GetMajorStatistics(string queryJson)
{
var Data = stuVolunteerIBLL.GetMajorStatistics(queryJson);
var list = Data.GroupBy(x => x.DeptNo).Select(x => new
{
DeptNo = x.FirstOrDefault()?.DeptNo,
MajorNo = x.FirstOrDefault()?.MajorNo,
Grade = x.FirstOrDefault()?.Grade,
ZRNum = x.Count(),
EnrollNum = x.Count(s => s.IsEnroll == true),
WillNum = x.Count(s => s.IsEnroll == true && s.IsSubmit == true),
ManNum = x.Count(s => s.IsEnroll == true && s.IsSubmit == true && s.Sex == "1"),
WoManNum = x.Count(s => s.IsEnroll == true && s.IsSubmit == true && s.Sex == "0")
}).OrderBy(x => x.DeptNo).ThenBy(x=>x.MajorNo).ThenBy(x => x.Grade);
return Success(list);
}
#endregion
#region 提交数据
///
/// 删除实体数据
///
/// 主键
///
[HttpPost]
[AjaxOnly]
public ActionResult DeleteForm(string keyValue)
{
stuVolunteerIBLL.DeleteEntity(keyValue);
return Success("删除成功!");
}
///
/// 保存实体数据(新增、修改)
///
/// 主键
/// 实体
///
[HttpPost]
[ValidateAntiForgeryToken]
[AjaxOnly]
public ActionResult SaveForm(string keyValue, string strEntity)
{
StuVolunteerEntity entity = strEntity.ToObject();
var userInfo = LoginUserInfo.Get();
if (string.IsNullOrEmpty(keyValue))
{
entity.CreateUser = userInfo.realName;
entity.CreateTime = DateTime.Now;
}
entity.UpdateUser = userInfo.realName;
entity.UpdateTime = DateTime.Now;
var dWList =
stuVolunteerIBLL.GetRepetitions(entity.H_SchoolNo, entity.ApplyNo, entity.CardNo).Where(x => x.ID != keyValue);
if (dWList.Count() > 0)
{
return Fail("保存失败,请检查数据有重复项");
}
stuVolunteerIBLL.SaveEntity(keyValue, entity);
return Success("保存成功!");
}
///
/// 分班
///
/// 主键
/// 班级
///
[HttpPost]
[ValidateAntiForgeryToken]
[AjaxOnly]
public ActionResult SaveClassForm(string keyValue, string ClassNo)
{
stuVolunteerIBLL.SaveClassForm(keyValue, ClassNo);
return Success("保存成功!");
}
///
/// 分班-审核
///
/// 主键
/// 审核状态
///
[HttpPost]
[AjaxOnly]
public ActionResult CheckForm(string keyValue, int ClassStatus)
{
stuVolunteerIBLL.CheckForm(keyValue, ClassStatus);
return Success("审核成功!");
}
///
/// 生成学籍
///
///
[HttpPost]
[AjaxOnly]
public ActionResult GenerateStu()
{
stuVolunteerIBLL.GenerateStu();
return Success("生成成功!");
}
#endregion
#region 扩展数据
///
/// 标注数据
///
///
///
public ActionResult LabelForm(string keyValue)
{
stuVolunteerIBLL.LabelEntity(keyValue);
return Success("标注成功!");
}
///
/// 取消数据
///
///
///
public ActionResult CancelLabel(string keyValue)
{
stuVolunteerIBLL.CancelLabel(keyValue);
return Success("取消成功!");
}
///
/// 标注数据
///
///
///
public ActionResult JoinForm(string keyValue)
{
stuVolunteerIBLL.JoinEntity(keyValue);
return Success("标注成功!");
}
///
/// 取消数据
///
///
///
public ActionResult CanJoinForm(string keyValue)
{
stuVolunteerIBLL.CanJoin(keyValue);
return Success("取消成功!");
}
///
/// 填报志愿
///
///
///
public ActionResult IsOurSchool(string keyValue, string strEntity)
{
StuVolunteerEntity entity = strEntity.ToObject();
stuVolunteerIBLL.IsOurSchool(keyValue, entity);
return Success("填报成功!");
}
///
/// 录取学生
///
///
///
public ActionResult EnrollForm(string keyValue)
{
stuVolunteerIBLL.EnrollEntity(keyValue);
return Success("录取成功!");
}
///
/// 取消录取学生
///
///
///
public ActionResult CancelForm(string keyValue)
{
stuVolunteerIBLL.CancelEntity(keyValue);
return Success("取消成功!");
}
///
/// 提交选择专业
///
///
///
///
public ActionResult SubmitForm(string keyValue, string strEntity)
{
StuVolunteerEntity entity = strEntity.ToObject();
stuVolunteerIBLL.SaveEntity(keyValue, entity);
return Success("提交成功!");
}
///
/// 专业:审核/去审核
///
///
///
public ActionResult MajorForm(string keyValue, int MajorStatus)
{
stuVolunteerIBLL.MajorForm(keyValue, MajorStatus);
return Success("录取成功!");
}
///
/// 注册专业
///
/// 主键
/// 审核状态
///
[HttpPost]
[AjaxOnly]
public ActionResult SaveMajorForm(string keyValue, string MajorNo)
{
stuVolunteerIBLL.SaveMajorForm(keyValue, MajorNo);
return Success("注册成功!");
}
#endregion
}
}