using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using EMIS.CommonLogic.EvaluationManage;
using EMIS.CommonLogic.CalendarManage;
using EMIS.ViewModel;
using EMIS.Web.Controls;
using Bowin.Common.Utility;
using Bowin.Web.Controls.Mvc;
using Bowin.Common.Data;
namespace EMIS.Web.Controllers.EvaluationManage.MyEvaluation
{
[Authorization]
public class MyEvaluationController : Controller
{
//
// GET: /MyEvaluation/
public IEvaluationAdviseServices evaluationAdviseServices { get; set; }
public ISchoolYearServices schoolYearServices { get; set; }
[HttpGet]
public ActionResult List()
{
var schoolYear = schoolYearServices.GetSchoolYearIsCurrent(true);
ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();
return View();
}
[HttpPost]
public ActionResult List(QueryParamsModel pararms)
{
var schoolYearID = pararms.getExtraGuid("SchoolYearDropdown"); //学年学期
var evaluationTableID = pararms.getExtraGuid("EvaluationTableDropdown"); //评价表
var evaluationTypeID = pararms.getExtraGuid("EvaluationTypeDropdown"); //评价类型
var coursematerialID = pararms.getExtraGuid("CoursematerialComboGrid");//课程
var staffID = EMIS.Utility.FormValidate.CustomPrincipal.Current.UserID;//登录教师ID
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var result = evaluationAdviseServices.GetMyEvaluationViewGrid(configuretView, schoolYearID, coursematerialID, evaluationTableID, evaluationTypeID, staffID, (int)pararms.page, (int)pararms.rows);//, collegeID, departmentID
return Json(result);
}
///
/// Excel导出
///
///
[HttpPost]
public ActionResult Excel()
{
try
{
NpoiExcelHelper neh = new NpoiExcelHelper();
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
var schoolYearID = Request.Form["SchoolyearDropdown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["SchoolyearDropdown"].ParseStrTo(); //学年学期
var evaluationTableID = Request.Form["EvaluationTableDropdown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["EvaluationTableDropdown"].ParseStrTo();//pararms.getExtraGuid("EvaluationTableDropdown"); //评价表
var evaluationTypeID = Request.Form["EvaluationTypeDropdown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["EvaluationTypeDropdown"].ParseStrTo();//pararms.getExtraGuid("EvaluationTypeDropdown"); //评价类型
var coursematerialID = Request.Form["CoursematerialComboGrid"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["CoursematerialComboGrid"].ParseStrTo();//pararms.getExtraGuid("CollegeDropdown");//院系所
//var departmentID = Request.Form["DepartmentDropdown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DepartmentDropdown"].ParseStrTo();//pararms.getExtraGuid("DepartmentDropdown");//教研室
var staffID = EMIS.Utility.FormValidate.CustomPrincipal.Current.UserID;
//var myEvaluationID = Request.Form["MyEvaluationID"];
//List myEvaluationIDList = new List();
//if (myEvaluationID != "")
//{
// myEvaluationIDList = myEvaluationID.SplitIDString();
//}
//else
//{
// myEvaluationIDList = null;
//}
var dt = evaluationAdviseServices.GetMyEvaluationViewList(configuretView, schoolYearID, coursematerialID, evaluationTableID, evaluationTypeID, staffID).Select(x => new
{
x.SchoolyearCode,
x.CourseName,
x.EducationMissionClassName,
x.EvaluationTypeName,
x.EvaluationTableName,
x.Remark
}).ToTable();
string[] liststring = { "学年学期", "课程名称", "任务班名称", "参评类型", "评价表名", "评语建议" };
neh.Export(dt, liststring, "我的评价");
return RedirectToAction("MsgShow", "Common", new
{
msg = "导出成功!",
url = Url.Content("~/MyEvaluation/List").AddMenuParameter()
});
}
catch (Exception ex)
{
return RedirectToAction("MsgShow", "Common", new
{
msg = "导出失败,原因:" + ex.Message + "!",
url = Url.Content("~/MyEvaluation/List").AddMenuParameter()
});
}
}
}
}