using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Bowin.Common.Exceptions;
using Bowin.Common.Utility;
using Bowin.Web.Controls.Mvc;
using EMIS.CommonLogic.EvaluationManage;
using EMIS.ViewModel;
using EMIS.ViewModel.EvaluationManage;
using EMIS.Web.Controls;
using Bowin.Common.Data;
using EMIS.CommonLogic.CalendarManage;
using EMIS.CommonLogic.EducationManagement;
using EMIS.ViewModel.EvaluationManage.EvaluationEnter;
using System.Text;
using System.Collections;
using EMIS.Utility;
using Bowin.Common.JSON;
using EMIS.Entities;
using System.Text.RegularExpressions;
namespace EMIS.Web.Controllers.EvaluationManage.EvaluationReport
{
[Authorization]
public class EvaluationRecordController : Controller
{
public IEvaluationRecordServices EvaluationRecordServices { get; set; }
public ISchoolYearServices SchoolYearServices { get; set; }
//
// GET: /EvaluationResult/评价记录
#region 1.0 列表信息查询
[HttpGet]
public ActionResult RecordList()
{
var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
return View();
}
///
/// 列表查询
///
///
///
[HttpPost]
public ActionResult RecordList(QueryParamsModel pararms)
{
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var classmajorID = pararms.getExtraGuid("ClassmajorDropdown"); //班级名称
var schoolyearCodeID = pararms.getExtraInt("SchoolyearDictionaryDropDown");//年级
var campusID = pararms.getExtraGuid("CampusDropdown");//校区
var collegeID = pararms.getExtraGuid("CollegeDropdown");//院系所
var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown");//专业名称
var staffID = pararms.getExtraGuid("StaffComboGrid");//被评教师
var schoolYearID = pararms.getExtraGuid("SchoolYearDropdown"); //学年学期
var evaluationTableID = pararms.getExtraGuid("EvaluationTableDropdown"); //评价表
var evaluationTypeID = pararms.getExtraGuid("EvaluationTypeDropdown"); //评价类型
var learningformID = pararms.getExtraInt("LearningformDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("LearningformDictionaryDropDown");
var education = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
var LearnSystem = pararms.getExtraString("DictionaryLearnSystem");
var result = EvaluationRecordServices.GetEvaluationRecordViewGrid(configuretView, campusID, collegeID, standardID, classmajorID, schoolyearCodeID, schoolYearID, evaluationTableID, evaluationTypeID, learningformID, education, LearnSystem, staffID, (int)pararms.page, (int)pararms.rows);
return Json(result);
}
#endregion
#region 2.0 删除信息操作
///
/// 删除
///
///
///
[HttpPost]
public ActionResult Delete(string ids)
{
try
{
var list = ids.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(s => Guid.Parse(s)).ToList();
EvaluationRecordServices.Delete(list);
return base.Json("删除成功");
}
catch (Exception ex)
{
return base.Json("删除失败,原因:" + ex.Message);
}
}
#endregion
#region 3.0 列表信息导出
[HttpPost]
public ActionResult Excel()
{
try
{
NpoiExcelHelper neh = new NpoiExcelHelper();
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
var schoolYearID = Request.Form["SchoolYearDropdown"].ParseStrTo(); //学年学期
var collegeID = Request.Form["CollegeDropdown"].ParseStrTo(); //院系所
var evaluationTableID = Request.Form["EvaluationTableDropdown"].ParseStrTo();//评价表
var evaluationTypeID = Request.Form["EvaluationTypeDropdown"].ParseStrTo(); //评价类型
var learningformID = Request.Form["LearningformDictionaryDropDown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["LearningformDictionaryDropDown"].ParseStrTo();
var education = Request.Form["DictionaryEducation"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo();
var LearnSystem = Request.Form["DictionaryLearnSystem"].ToString();
var dt = EvaluationRecordServices.GetEvaluationRecordViewList(configuretView, schoolYearID, collegeID, evaluationTableID, evaluationTypeID, learningformID, education, LearnSystem).Select(x => new
{
x.SchoolyearCode,
x.EvaluationSettingCode,
x.EducationMissionClassName,
x.B_EvaluationName,
x.EvaluationTypeName,
x.EvaluationCode,
x.EvaluationName,
x.EvaluationTableName,
x.EvaluationTableTypeName,
x.LimitMore,
x.EvaluationCount
}).ToTable();
string[] liststring = { "学年学期", "评价编号", "任务班名称", "被评教师", "评价类型", "参评人编号", "参评人", "评价表名", "评价类型", "可评次数", "已评次数" };
neh.Export(dt, liststring, "评价记录信息");
return RedirectToAction("MsgShow", "Common", new
{
msg = "导出成功!",
url = Url.Content("~/EvaluationReport/List").AddMenuParameter()
});
}
catch (Exception ex)
{
return RedirectToAction("MsgShow", "Common", new
{
msg = "导出失败,原因:" + ex.Message + "!",
url = Url.Content("~/EvaluationReport/List").AddMenuParameter()
});
}
}
#endregion
#region 4.0 绑定参评类型
[HttpPost]
public ActionResult EvaluationTypeDropdownListBanid(Guid? evaluationTableID)
{
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
//if (evaluationTableID == null)
//{
// List list = EvaluationRecordServices.GetEvaluationTypeByTableIDList(evaluationTableID).OrderByDescending(o => o.CreateTime).Select(x => new DropdownListItem { Value = x.TypeID.ToString(), Text = x.Name }).ToList();
//}
DropdownListBindType dbt = new DropdownListBindType();
List list = new List();
if (evaluationTableID != null)
{
list = EvaluationRecordServices.GetEvaluationTypeByTableIDList(evaluationTableID).OrderByDescending(o => o.CreateTime).Select(x => new DropdownListItem { Value = x.TypeID.ToString(), Text = x.Name }).ToList();
dbt = DropdownListBindType.None;
}
else
{
list = EvaluationRecordServices.GetEvaluationTypeByTableIDList(evaluationTableID).OrderByDescending(o => o.CreateTime).Select(x => new DropdownListItem { Value = x.TypeID.ToString(), Text = x.Name }).ToList();
dbt = DropdownListBindType.SelectAll;
}
DropdownList.FormatDropdownItemList(dbt, list);
return base.Json(list);
}
#endregion
}
}