using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using EMIS.CommonLogic.Students;
using EMIS.ViewModel;
using Bowin.Web.Controls.Mvc;
using EMIS.Web.Controls;
using EMIS.ViewModel.DifferentDynamic;
using Bowin.Common.Linq.Entity;
using Bowin.Common.JSON;
using EMIS.ViewModel.WorkflowManage;
using Bowin.Common.Mapping;
using Bowin.Common.Utility;
using Bowin.Common.Linq;
using Bowin.Common.Mvc;
using EMIS.CommonLogic.CalendarManage;
using EMIS.Utility.FormValidate;
namespace EMIS.Web.Controllers.DifferentDynamic
{
///
/// 异动审批
///
[Authorization]
public class DifferentDynamicApprovalController : 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 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 LearnSystem = pararms.getExtraString("DictionaryLearnSystem");
var result = DifferentDynamicServices.GetApprovalDifferentDynamicViewGrid(configuretView, campusID, collegeID, year, standard, education, learningform, classmajorID, schoolYearID, differentDynamicType,LearnSystem, (int)pararms.page, (int)pararms.rows);
return Json(result);
}
public ActionResult CollegeApproveList()
{
var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
return View();
}
///
/// 列表查询
///
///
///
[HttpPost]
public ActionResult CollegeApproveList(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 LearnSystem = pararms.getExtraString("DictionaryLearnSystem");
var result = DifferentDynamicServices.GetCollegeApprovalDifferentDynamicViewGrid(configuretView, campusID, collegeID, year, standard, education, learningform, classmajorID, schoolYearID, differentDynamicType, LearnSystem, (int)pararms.page, (int)pararms.rows);
return Json(result);
}
public ActionResult AdminApproveList()
{
var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
return View();
}
///
/// 列表查询
///
///
///
[HttpPost]
public ActionResult AdminApproveList(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 LearnSystem = pararms.getExtraString("DictionaryLearnSystem");
var result = DifferentDynamicServices.GetAdminApprovalDifferentDynamicViewGrid(configuretView, campusID, collegeID, year, standard, education, learningform, classmajorID, schoolYearID, differentDynamicType, LearnSystem, (int)pararms.page, (int)pararms.rows);
return Json(result);
}
[HttpPost]
public ActionResult AdminApprove(string ids, Guid actionID, string comment)
{
var list = ids.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(s => Guid.Parse(s)).ToList();
try
{
DifferentDynamicServices.Approve(list, CustomPrincipal.Current.UserID, actionID, comment);
return Json(new ReturnMessage { IsSuccess = true, Message = "审核成功。" });
}
catch (Exception ex)
{
return Json(new ReturnMessage { IsSuccess = false, Message = ex.Message });
}
}
public ActionResult Edit(Guid id)
{
var vm = new DifferentDynamicApprovalView();
var user = EMIS.Utility.FormValidate.CustomPrincipal.Current;
try
{
var result = DifferentDynamicServices.GetActionView(id, user.UserID);
if (result.Count == 0)
{
return RedirectToAction("MsgShow", "Common", new
{
WindowID = Request["WindowID"],
msg = "抱歉,因流程或操作权限限制,您无权限审核该数据,请检查后重新选择!",
url = Url.Action("List").AddMenuParameter()
});
}
var dropList = result.Select(s => new DropdownListItem { Text = s.ActionName, Value = s.ToJson() }).ToList();
ViewBag.ListAction = dropList;
if (id != null && id != Guid.Empty)
{
var resultView = DifferentDynamicServices.GetDifferentDynamicView(id);
resultView.DynamicCloneTo(vm);
}
}
catch (Exception ex)
{
return RedirectToAction("MsgShow", "Common", new
{
WindowID = Request["WindowID"],
msg = "操作失败原因:" + ex.Message,
url = Url.Action("List").AddMenuParameter()
});
}
return View(vm);
}
[HttpPost]
public ActionResult Edit(DifferentDynamicApprovalView vm)
{
try
{
string action = Request.Form["ddlAction"];
var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
var actionView = action.JsonToObject();
string comment = Request.Form["txtComment"];
var differentDynamicView = new DifferentDynamicView();
vm.DynamicCloneTo(differentDynamicView);
DifferentDynamicServices.Approve(differentDynamicView, user.UserID, actionView, comment);
return Json(new ReturnMessage()
{
IsSuccess = true,
Message = "审核成功!"
});
}
catch (Exception ex)
{
return Json(new ReturnMessage()
{
IsSuccess = false,
Message = "审核失败,原因:" + ex.Message
});
}
}
[HttpPost]
public ActionResult Excel()
{
NpoiExcelHelper neh = new NpoiExcelHelper();
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
//避开全选值
//var roleID = Request.Form["Role"].ParseStrTo();
var campusID = Request.Form["CampusDropdown"].ParseStrTo(); //校区
var collegeID = Request.Form["CollegeDropdown"].ParseStrTo(); //院系所
var year = CheckIsSelectAll(Request.Form["DictionarySchoolyear"].ParseStrTo()); //年级
var standard = CheckIsSelectAll(Request.Form["DictionaryStandard"].ParseStrTo()); //专业名称
var education = CheckIsSelectAll(Request.Form["DictionaryEducation"].ParseStrTo()); //培养层次
var learningform = CheckIsSelectAll(Request.Form["DictionaryLearningform"].ParseStrTo()); //学习形式
var classmajorID = Request.Form["ClassmajorDropdown"].ParseStrTo(); //班级名称
var schoolYearID = Request.Form["SchoolYearDropdown"].ParseStrTo(); //异动学期
var differentDynamicType = CheckIsSelectAll(Request.Form["DictionaryDifferentDynamicType"].ParseStrTo()); //异动类型
//var differentDynamicStatus = CheckIsSelectAll(Request.Form["DictionaryDifferentDynamicStatus"].ParseStrTo()); //审批状态
var LearnSystem = Request.Form["DictionaryLearnSystem"].ToString();
var result = DifferentDynamicServices.GetApprovalDifferentDynamicViewList(configuretView, campusID, collegeID, year, standard, education, learningform, classmajorID, schoolYearID, differentDynamicType, LearnSystem);
var dt = result.OrderBy(x => x.EntityCreateTime).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.EntityCreateTimeStr,
s.ApprovalStatusName,
s.ReportStatusName,
}).ToTable();
string[] liststring = { "异动学期", "学号", "姓名", "异动类型", "异动原因", "在校状态", "学籍状态",
"异动前专业", "异动前班级", "异动后专业", "异动后班级", "异动后在校状态", "异动后学籍状态",
"异动日期", "审批状态", "注册状态" };
neh.Export(dt, liststring, "异动审核");
return RedirectToAction("MsgShow", "Common", new
{
msg = "导出成功!",
url = Url.Action("List").AddMenuParameter()
});
}
[HttpPost]
public ActionResult CollegeApproveExcel()
{
NpoiExcelHelper neh = new NpoiExcelHelper();
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
//避开全选值
//var roleID = Request.Form["Role"].ParseStrTo();
var campusID = Request.Form["CampusDropdown"].ParseStrTo(); //校区
var collegeID = Request.Form["CollegeDropdown"].ParseStrTo(); //院系所
var year = CheckIsSelectAll(Request.Form["DictionarySchoolyear"].ParseStrTo()); //年级
var standard = CheckIsSelectAll(Request.Form["DictionaryStandard"].ParseStrTo()); //专业名称
var education = CheckIsSelectAll(Request.Form["DictionaryEducation"].ParseStrTo()); //培养层次
var learningform = CheckIsSelectAll(Request.Form["DictionaryLearningform"].ParseStrTo()); //学习形式
var classmajorID = Request.Form["ClassmajorDropdown"].ParseStrTo(); //班级名称
var schoolYearID = Request.Form["SchoolYearDropdown"].ParseStrTo(); //异动学期
var differentDynamicType = CheckIsSelectAll(Request.Form["DictionaryDifferentDynamicType"].ParseStrTo()); //异动类型
//var differentDynamicStatus = CheckIsSelectAll(Request.Form["DictionaryDifferentDynamicStatus"].ParseStrTo()); //审批状态
var LearnSystem = Request.Form["DictionaryLearnSystem"].ToString();
var result = DifferentDynamicServices.GetCollegeApprovalDifferentDynamicViewList(configuretView, campusID, collegeID, year, standard, education, learningform, classmajorID, schoolYearID, differentDynamicType, LearnSystem);
var dt = result.OrderBy(x => x.EntityCreateTime).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.EntityCreateTimeStr,
s.ApprovalStatusName,
s.ReportStatusName,
}).ToTable();
string[] liststring = { "异动学期", "学号", "姓名", "异动类型", "异动原因", "在校状态", "学籍状态",
"异动前专业", "异动前班级", "异动后专业", "异动后班级", "异动后在校状态", "异动后学籍状态",
"异动日期", "审批状态", "注册状态" };
neh.Export(dt, liststring, "异动审核");
return RedirectToAction("MsgShow", "Common", new
{
msg = "导出成功!",
url = Url.Action("List").AddMenuParameter()
});
}
[HttpPost]
public ActionResult AdminApproveExcel()
{
NpoiExcelHelper neh = new NpoiExcelHelper();
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
//避开全选值
//var roleID = Request.Form["Role"].ParseStrTo();
var campusID = Request.Form["CampusDropdown"].ParseStrTo(); //校区
var collegeID = Request.Form["CollegeDropdown"].ParseStrTo(); //院系所
var year = CheckIsSelectAll(Request.Form["DictionarySchoolyear"].ParseStrTo()); //年级
var standard = CheckIsSelectAll(Request.Form["DictionaryStandard"].ParseStrTo()); //专业名称
var education = CheckIsSelectAll(Request.Form["DictionaryEducation"].ParseStrTo()); //培养层次
var learningform = CheckIsSelectAll(Request.Form["DictionaryLearningform"].ParseStrTo()); //学习形式
var classmajorID = Request.Form["ClassmajorDropdown"].ParseStrTo(); //班级名称
var schoolYearID = Request.Form["SchoolYearDropdown"].ParseStrTo(); //异动学期
var differentDynamicType = CheckIsSelectAll(Request.Form["DictionaryDifferentDynamicType"].ParseStrTo()); //异动类型
//var differentDynamicStatus = CheckIsSelectAll(Request.Form["DictionaryDifferentDynamicStatus"].ParseStrTo()); //审批状态
var LearnSystem = Request.Form["DictionaryLearnSystem"].ToString();
var result = DifferentDynamicServices.GetAdminApprovalDifferentDynamicViewList(configuretView, campusID, collegeID, year, standard, education, learningform, classmajorID, schoolYearID, differentDynamicType, LearnSystem);
var dt = result.OrderBy(x => x.EntityCreateTime).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.EntityCreateTimeStr,
s.ApprovalStatusName,
s.ReportStatusName,
}).ToTable();
string[] liststring = { "异动学期", "学号", "姓名", "异动类型", "异动原因", "在校状态", "学籍状态",
"异动前专业", "异动前班级", "异动后专业", "异动后班级", "异动后在校状态", "异动后学籍状态",
"异动日期", "审批状态", "注册状态" };
neh.Export(dt, liststring, "异动审核");
return RedirectToAction("MsgShow", "Common", new
{
msg = "导出成功!",
url = Url.Action("List").AddMenuParameter()
});
}
///
/// 添加更新前验证
///
///
///
///
[HttpPost]
public ActionResult Verification(Guid? ID)
{
return base.Json("成功");
}
//[HttpPost]
//public ActionResult AuditingActionDropdownList(Guid id)
//{
// var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
// var result = DifferentDynamicServices.GetActionView(id, user.UserID);
// //if (result.Count == 0)
// //{
// // return RedirectToAction("MsgShow", "Common", new
// // {
// // msg = "你没有审核权限!",
// // url = Url.Action("List").AddMenuParameter()
// // });
// //}
// var dropList = result.Select(s => new DropdownListItem { Text = s.ActionName, Value = s.ToJson() });
// return Json(dropList);
//}
}
}