123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using EMIS.ViewModel;
- using EMIS.ViewModel.DifferentDynamic;
- using EMIS.Web.Controls;
- using EMIS.CommonLogic.Students;
- using Bowin.Common.Exceptions;
- using Bowin.Common.Linq.Entity;
- using Bowin.Web.Controls.Mvc;
- using Bowin.Common.Utility;
- using Bowin.Common.Linq;
- using Bowin.Common.Mvc;
- using EMIS.CommonLogic.CalendarManage;
- namespace EMIS.Web.Controllers.DifferentDynamic
- {
- /// <summary>
- /// 异动申请
- /// </summary>
- [Authorization]
- public class DifferentDynamicApplyController : DifferentDynamicController
- {
- public ISchoolYearServices SchoolYearServices { get; set; }
- //[StaticFileWriteFilter]
- public ActionResult List()
- {
- var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
- ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
- return View();
- }
- [HttpPost]
- public ActionResult ApplyStatusDropDown(DropdownListBindType? bindType)
- {
- var statusList = this.DifferentDynamicServices.GetStatusViewList()
- .Where(x => x.ID != DifferentDynamicServices.GetCorrectEndStatus())
- .OrderBy(x => x.ID)
- .Select(x => new DropdownListItem()
- {
- Text = x.Name,
- Value = x.ID.HasValue ? x.ID.Value.ToString() : ""
- }).ToList();
- DropdownListBindType dbt = bindType == null ? DropdownListBindType.SelectAll : bindType.Value;
- DropdownList.FormatDropdownItemList(dbt, statusList);
- return base.Json(statusList);
- }
- /// <summary>
- /// 列表查询
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult List(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var campusID = pararms.getExtraGuid("CampusDropdown"); //校区
- var collegeID = pararms.getExtraGuid("CollegeDropdown"); //院系所
- var year = CheckIsSelectAll(pararms.getExtraInt("SchoolyearDictionaryDropDown")); //年级
- var standard = CheckIsSelectAll(pararms.getExtraInt("StandardDictionaryDropDown")); //专业名称
- var education = CheckIsSelectAll(pararms.getExtraInt("DictionaryEducation")); //培养层次
- var learningform = CheckIsSelectAll(pararms.getExtraInt("DictionaryLearningform")); //学习形式
- var classmajorID = pararms.getExtraGuid("ClassmajorDropdown"); //班级名称
- var schoolYearID = pararms.getExtraGuid("SchoolYearDropdown"); //异动学期
- var differentDynamicType = CheckIsSelectAll(pararms.getExtraInt("DictionaryDifferentDynamicType")); //异动类型
- var differentDynamicStatus = CheckIsSelectAll(pararms.getExtraInt("DictionaryDifferentDynamicStatus")); //审批状态
- var LearnSystem = pararms.getExtraString("DictionaryLearnSystem");
- var result = DifferentDynamicServices.GetDifferentDynamicViewGrid(configuretView, campusID, collegeID, year, standard, education, learningform, classmajorID, schoolYearID, differentDynamicType, differentDynamicStatus,LearnSystem, (int)pararms.page, (int)pararms.rows, 1);
- return Json(result);
- }
- public ActionResult Edit(Guid? id)
- {
-
- var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
- var vm = new DifferentDynamicView();
- vm.SchoolyearID = schoolYear.SchoolyearID;
- vm.ApplyTypeID = (int)CF_ChangeApplyType.Normal;
- if (id != null && id != Guid.Empty)
- {
- vm = DifferentDynamicServices.GetDifferentDynamicView(id);
- }
- var isView = (vm.EntityApprovalStatus.HasValue && vm.EntityApprovalStatus != DifferentDynamicServices.GetStartStatus()) ? true : false;
- ViewBag.IsView = isView;
- ViewBag.StartStatusID = DifferentDynamicServices.GetStartStatus();
- return View(vm);
- }
- /// <summary>
- /// 新增或更新
- /// </summary>
- /// <param name="vm"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(DifferentDynamicView vm)
- {
- try
- {
- vm.Action = Request.Params["type"];
- DifferentDynamicServices.AddOrUpdateDifferentDynamic(vm);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功!"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败,原因:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="ids"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Delete(string ids)
- {
- try
- {
- var list = ids.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(s => Guid.Parse(s)).ToList();
- DifferentDynamicServices.DeleteDifferentDynamic(list);
- return base.Json("删除成功");
- }
- catch (Exception ex)
- {
- string mge = ex.Message;
- System.Data.SqlClient.SqlException num = ExceptionHelper.GetSqlException(ex);
- if (num != null)
- {
- if (num.Number == 547)
- //mge = "请先删除所有关联的数据,如:专业计划、选修计划等!";
- mge = "请先删除所有关联的数据!";
- }
- return base.Json("删除失败,原因:" + mge);
- }
- }
- /// <summary>
- /// 提交
- /// </summary>
- /// <param name="planApplicationIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Submit(string ids)
- {
- try
- {
- var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
- var list = ids.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(s => Guid.Parse(s)).ToList();
- DifferentDynamicServices.Submit(list, user.UserID);
- return Json("提交成功");
- }
- catch (Exception ex)
- {
- string mge = ex.Message;
- return Json("提交失败,原因:" + mge);
- }
- }
- [HttpPost]
- public ActionResult Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- //避开全选值
- //var roleID = Request.Form["Role"].ParseStrTo<Guid>();
- var campusID = Request.Form["CampusDropdown"].ParseStrTo<Guid>(); //校区
- var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>(); //院系所
- var year = CheckIsSelectAll(Request.Form["DictionarySchoolyear"].ParseStrTo<int>()); //年级
- var standard = CheckIsSelectAll(Request.Form["DictionaryStandard"].ParseStrTo<int>()); //专业名称
- var education = CheckIsSelectAll(Request.Form["DictionaryEducation"].ParseStrTo<int>()); //培养层次
- var learningform = CheckIsSelectAll(Request.Form["DictionaryLearningform"].ParseStrTo<int>()); //学习形式
- var classmajorID = Request.Form["ClassmajorDropdown"].ParseStrTo<Guid>(); //班级名称
- var schoolYearID = Request.Form["SchoolYearDropdown"].ParseStrTo<Guid>(); //异动学期
- var differentDynamicType = CheckIsSelectAll(Request.Form["DictionaryDifferentDynamicType"].ParseStrTo<int>()); //异动类型
- var differentDynamicStatus = CheckIsSelectAll(Request.Form["DictionaryDifferentDynamicStatus"].ParseStrTo<int>()); //审批状态
- var LearnSystem = Request.Form["DictionaryLearnSystem"].ToString();
- var result = DifferentDynamicServices.GetDifferentDynamicViewList(configuretView, campusID, collegeID, year, standard, education, learningform, classmajorID, schoolYearID, differentDynamicType, differentDynamicStatus, LearnSystem,1);
- var dt = result.Select(s => new
- {
- s.SchoolyearCode,
- s.LoginID,
- s.Name,
- s.DifferentDynamicTypeName,
- s.ReasonName,
- s.InSchoolStatusName,
- s.StudentStatusName,
- s.StandardName,
- s.ClassmajorName,
- s.AfterStandardName,
- s.AfterClassmajorName,
- s.AfterInSchoolStatusName,
- s.AfterStudentStatusName,
- s.ReturnSchoolyearCode,
- s.ApprovalStatusName,
- s.ReportStatusName,
- }).ToTable();
- string[] liststring = { "异动学期", "学号", "姓名", "异动类型", "异动原因", "在校状态", "学籍状态",
- "异动前专业", "异动前班级", "异动后专业", "异动后班级", "异动后在校状态", "异动后学籍状态",
- "异动日期", "审批状态", "注册状态" };
- neh.Export(dt, liststring, "异动申请");
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "导出成功!",
- url = Url.Action("List").AddMenuParameter()
- });
- }
- /// <summary>
- /// 添加更新前验证
- /// </summary>
- /// <param name="activitiesID"></param>
- /// <param name="Name"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Verification(Guid? ID)
- {
- return base.Json("成功");
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="LoginID"></param>
- /// <returns></returns>
- public ActionResult DifferentDynamicApplyReport(string LoginID)
- {
- return View();
- }
- /// <summary>
- /// 列表查询(已弃用)
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- //[HttpPost]
- //public ActionResult GetSelectReport(QueryParamsModel pararms)
- //{
- // ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- // var result = DifferentDynamicServices.GetDifferentDynamicViewGrid(configuretView);
- // return Json(result);
- //}
- }
- }
|