using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using EMIS.CommonLogic.DQPSystem;
using EMIS.ViewModel;
using EMIS.Web.Controls;
using Bowin.Web.Controls.Mvc;
using EMIS.ViewModel.DQPSystem;
using Bowin.Common.Utility;
using Bowin.Common.Data;
using Bowin.Common.JSON;
using EMIS.Utility;
using EMIS.Utility.FormValidate;
using EMIS.CommonLogic.SystemServices;
using EMIS.ViewModel.SystemView;
namespace EMIS.Web.Controllers.DQPSystem
{
[Authorization]
public class SOCDetailScoreController : Controller
{
public ISOCDetailScoreServices SOCDetialScoreServices { get; set; }
public ISOCDetailServices SOCDetailServices { get; set; }
public IParameterServices ParameterServices { get; set; }
public ISOCServices SOCServices { get; set; }
///
/// 评分管理页面(最初的,直接显示每个学生课程soc,可以直接评分的页面)
///
///
public ActionResult List()
{
ViewBag.StartStatusID = (int)DQP_SOCDetailSubmitStatus.NotSubmit;
ViewBag.CancelStatusID = (int)DQP_SOCDetailSubmitStatus.Canceled;
return View();
}
[HttpGet]
public ActionResult SOCList()
{
return View();
}
[HttpPost]
public ActionResult SOCList(QueryParamsModel pararms)
{
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var schoolyearID = pararms.getExtraGuid("SchoolyearDropdown");
var user = CustomPrincipal.Current;
//var coursematerialID = pararms.getExtraGuid("CoursematerialIDDropdownGridBo");
//var collegeID = pararms.getExtraGuid("CollegeComboGrid");
//var educationMissionID = pararms.getExtraGuid("EducationMissionGrid");
var result = SOCServices.GetSOCViewByTeacherIDGrid(configuretView, schoolyearID, user.UserID, (int)pararms.page, (int)pararms.rows);
return Json(result);
}
public ActionResult SOCDetailList(Guid? socID)
{
ViewBag.SOCID = socID;
return View();
}
[HttpPost]
public ActionResult SOCDetailList(QueryParamsModel pararms, Guid? socID)
{
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var schoolyearID = pararms.getExtraGuid("SchoolyearDropdown");
var user = CustomPrincipal.Current;
//var socID = pararms.getExtraGuid("SOCID");
//var coursematerialID = pararms.getExtraGuid("CoursematerialIDDropdownGridBo");
//var collegeID = pararms.getExtraGuid("CollegeComboGrid");
//var educationMissionID = pararms.getExtraGuid("EducationMissionGrid");
var result = SOCDetailServices.GetSOCDetailViewByIDGrid(configuretView, schoolyearID, socID, user.UserID, (int)pararms.page, (int)pararms.rows);
return Json(result);
}
public ActionResult StudentDetail(Guid? socDetailID)
{
ViewBag.StartStatusID = (int)DQP_SOCDetailSubmitStatus.NotSubmit;
ViewBag.CancelStatusID = (int)DQP_SOCDetailSubmitStatus.Canceled;
ViewBag.SOCDetailID = socDetailID;
return View();
}
[HttpPost]
public ActionResult StudentDetail(QueryParamsModel pararms, Guid? SOCDetailID)
{
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var user = CustomPrincipal.Current;
return base.Json(SOCDetialScoreServices.GetSOCDetailStudentScoreViewByIDList(configuretView, SOCDetailID, user.UserID, (int)pararms.page, (int)pararms.rows));
}
public ActionResult GroupScoreList(Guid? socDetailID)
{
ViewBag.StartStatusID = (int)DQP_SOCDetailSubmitStatus.NotSubmit;
ViewBag.CancelStatusID = (int)DQP_SOCDetailSubmitStatus.Canceled;
ViewBag.SOCDetailID = socDetailID;
return View();
}
[HttpPost]
public ActionResult GroupScoreList(QueryParamsModel pararms, Guid? SOCDetailID)
{
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var user = CustomPrincipal.Current;
return base.Json(SOCDetialScoreServices.GetSOCDetailGroupScoreViewByIDList(configuretView, SOCDetailID, user.UserID, (int)pararms.page, (int)pararms.rows));
}
public ActionResult AttachmentList(Guid? detailID, Guid? userID)
{
return View();
}
public ActionResult GroupList()
{
ViewBag.StartStatusID = (int)DQP_SOCDetailSubmitStatus.NotSubmit;
ViewBag.CancelStatusID = (int)DQP_SOCDetailSubmitStatus.Canceled;
return View();
}
public ActionResult GroupScore(Guid? socDetailGroupID)
{
return View();
}
public ActionResult GroupAttachmentList(Guid? detailID, Guid? socDetailGroupID)
{
return View();
}
public ActionResult GroupStudentList(Guid socDetailGroupID)
{
return View();
}
public ActionResult RawScoreList()
{
return View();
}
[HttpPost]
public ActionResult StudentList(QueryParamsModel pararms)
{
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
var collegeID = pararms.getExtraGuid("cgbCollege");
var yearID = pararms.getExtraInt("ddlYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");
var standardID = pararms.getExtraInt("cbgStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("cbgStandard");
var classmajorID = pararms.getExtraGuid("cbgClassmajor");
var coursematerialID = pararms.getExtraGuid("cgbCourse");
var recordStatus = pararms.getExtraInt("ddlStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlStatus");
return base.Json(SOCDetialScoreServices.GetSOCDetailStudentScoreViewList(configuretView, schoolyearID, collegeID, yearID, standardID, classmajorID,
coursematerialID, recordStatus, (int)pararms.page, (int)pararms.rows));
}
[HttpPost]
public ActionResult AttachmentList(QueryParamsModel pararms)
{
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var socDetailID = pararms.getExtraGuid("hidSOCDetailID");
var userID = pararms.getExtraGuid("hidUserID");
return base.Json(SOCDetialScoreServices.GetSOCDetailStudentAttachmentViewList(configuretView, socDetailID, userID, (int)pararms.page, (int)pararms.rows));
}
[HttpPost]
public ActionResult StudentSave()
{
var studentScoreViewList = DataGrid.GetTableData("dgSOCDetailStudentScoreList");
try
{
SOCDetialScoreServices.StudentSave(studentScoreViewList);
return Json(new ReturnMessage()
{
IsSuccess = true,
Message = "保存成功。"
});
}
catch (Exception ex)
{
return Json(new ReturnMessage()
{
IsSuccess = false,
Message = "保存失败:" + ex.Message
});
}
}
[HttpGet]
public ActionResult StudentCancel(string socDetailStudentIDs)
{
ViewBag.DetailStudentList = socDetailStudentIDs;
return View();
}
[HttpPost]
public ActionResult StudentCancel()
{
//string socDetailStudentIDs = "";
var socDetailStudentIDs = Request.Form["idList"];
var remark = Request.Form["Remark"];
var socDetailStudentIDList = socDetailStudentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
try
{
SOCDetialScoreServices.StudentCancel(socDetailStudentIDList, remark);
return Json(new ReturnMessage()
{
IsSuccess = true,
Message = "退回成功。"
});
}
catch (Exception ex)
{
return Json(new ReturnMessage()
{
IsSuccess = false,
Message = "退回失败:" + ex.Message
});
}
}
[HttpPost]
public ActionResult StudentExcel()
{
NpoiExcelHelper neh = new NpoiExcelHelper();
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
var user = CustomPrincipal.Current;
var socDetailID = Request.Form["SOCDetailID"].ParseStrTo();
var schoolyearID = Request.Form["ddlSchoolyear"].ParseStrTo();
var collegeID = Request.Form["cgbCollege"].ParseStrTo();
var yearID = Request.Form["ddlYear"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo();
var standardID = Request.Form["cbgStandard"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["cbgStandard"].ParseStrTo();
var classmajorID = Request.Form["cbgClassmajor"].ParseStrTo();
var coursematerialID = Request.Form["cgbCourse"].ParseStrTo();
var recordStatus = Request.Form["ddlStatus"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlStatus"].ParseStrTo();
var dt = SOCDetialScoreServices.GetSOCDetailStudentScoreViewList(configuretView, socDetailID, user.UserID)
.Select(x => new
{
x.SchoolyearCode,
x.EducationMissionNameStr,
x.CourseCode,
x.CourseName,
x.Name,
x.LoginID,
x.SOCDetailName,
//SOCDetailCredit = x.SOCDetailCredit.HasValue ? x.SOCDetailCredit.Value.ToString("#.##") : null,
x.SOCDetailCredit,
Weight = x.Weight.HasValue ? x.Weight.Value.ToString("#.##") : null,
Score = x.Score.HasValue ? x.Score.Value.ToString("#.##") : null
}).ToTable();
string[] liststring = {
"学年学期", "任务班名", "课程代码", "课程名称", "姓名", "学号",
"成果名称", "成果学分", "成果权重", "成果得分"
};
neh.Export(dt, liststring, "学生成果评分表" + DateTime.Now.ToString("yyyyMMdd"));
return Json(new ReturnMessage()
{
IsSuccess = true,
Message = "导出成功。"
});
}
[HttpPost]
public ActionResult GroupList(QueryParamsModel pararms)
{
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
var collegeID = pararms.getExtraGuid("cgbCollege");
var yearID = pararms.getExtraInt("ddlYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");
var standardID = pararms.getExtraInt("cbgStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("cbgStandard");
var classmajorID = pararms.getExtraGuid("cbgClassmajor");
var coursematerialID = pararms.getExtraGuid("cgbCourse");
var recordStatus = pararms.getExtraInt("ddlStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlStatus");
return base.Json(SOCDetialScoreServices.GetSOCDetailGroupScoreViewList(configuretView, schoolyearID, collegeID, yearID, standardID, classmajorID,
coursematerialID, recordStatus, (int)pararms.page, (int)pararms.rows));
}
[HttpPost]
public ActionResult GroupScore(QueryParamsModel pararms)
{
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var socDetailGroupID = Request.QueryString["SOCDetailGroupID"].ParseStrTo();
return base.Json(SOCDetialScoreServices.GetSOCDetailGroupRawScoreViewList(configuretView, socDetailGroupID.Value, pararms.page, pararms.rows));
}
[HttpPost]
public ActionResult GroupScoreSave(Guid socDetailGroupID)
{
var studentRawScoreList = DataGrid.GetTableData("dgStudentScoreList");
try
{
SOCDetialScoreServices.GroupScoreSave(socDetailGroupID, studentRawScoreList);
return Json(new ReturnMessage()
{
IsSuccess = true,
Message = "保存成功。"
});
}
catch (Exception ex)
{
return Json(new ReturnMessage()
{
IsSuccess = false,
Message = "保存失败:" + ex.Message
});
}
}
[HttpPost]
public ActionResult GroupAttachmentList(QueryParamsModel pararms)
{
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var socDetailID = pararms.getExtraGuid("hidSOCDetailID");
var socDetailGroupID = pararms.getExtraGuid("hidSOCDetailGroupID");
return base.Json(SOCDetialScoreServices.GetSOCDetailGroupAttachmentViewList(configuretView, socDetailID, socDetailGroupID, (int)pararms.page, (int)pararms.rows));
}
[Obsolete]
[HttpPost]
public ActionResult GroupSave()
{
var groupScoreViewList = DataGrid.GetTableData("dgSOCDetailGroupScoreList");
try
{
SOCDetialScoreServices.GroupSave(groupScoreViewList);
return Json(new ReturnMessage()
{
IsSuccess = true,
Message = "保存成功。"
});
}
catch (Exception ex)
{
return Json(new ReturnMessage()
{
IsSuccess = false,
Message = "保存失败:" + ex.Message
});
}
}
[HttpGet]
public ActionResult GroupCancel(string socDetailGroupIDs)
{
ViewBag.DetailGroupList = socDetailGroupIDs;
return View();
}
[HttpPost]
public ActionResult GroupCancel()
{
var socDetailGroupIDs = Request.Form["idList"];
var remark = Request.Form["Remark"];
var socDetailGroupIDList = socDetailGroupIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
try
{
SOCDetialScoreServices.GroupCancel(socDetailGroupIDList, remark);
return Json(new ReturnMessage()
{
IsSuccess = true,
Message = "退回成功。"
});
}
catch (Exception ex)
{
return Json(new ReturnMessage()
{
IsSuccess = false,
Message = "退回失败:" + ex.Message
});
}
}
[HttpPost]
public ActionResult GroupExcel()
{
NpoiExcelHelper neh = new NpoiExcelHelper();
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
var user = CustomPrincipal.Current;
var socDetailID = Request.Form["SOCDetailID"].ParseStrTo();
var schoolyearID = Request.Form["ddlSchoolyear"].ParseStrTo();
var collegeID = Request.Form["cgbCollege"].ParseStrTo();
var yearID = Request.Form["ddlYear"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo();
var standardID = Request.Form["cbgStandard"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["cbgStandard"].ParseStrTo();
var classmajorID = Request.Form["cbgClassmajor"].ParseStrTo();
var coursematerialID = Request.Form["cgbCourse"].ParseStrTo();
var recordStatus = Request.Form["ddlStatus"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlStatus"].ParseStrTo();
var dt = SOCDetialScoreServices.GetSOCDetailGroupScoreViewByIDList(configuretView, socDetailID, user.UserID)
.Select(x => new
{
x.SchoolyearCode,
x.CourseCode,
x.CourseName,
x.SOCDetailName,
//SOCDetailCredit = x.SOCDetailCredit.HasValue ? x.SOCDetailCredit.Value.ToString("#.#") : null,
x.SOCDetailCredit,
Weight = x.Weight.HasValue ? x.Weight.Value.ToString("#.#") : null,
x.ClassmajorName,
x.Name,
Score = x.Score.HasValue ? x.Score.Value.ToString("#.#") : null
}).ToTable();
string[] liststring = {
"学年学期", "课程代码", "课程名称", "成果名称", "成果学分", "成果权重",
"所在班级", "组名", "成果得分"
};
neh.Export(dt, liststring, "学生分组成果评分表" + DateTime.Now.ToString("yyyyMMdd"));
return Json(new ReturnMessage()
{
IsSuccess = true,
Message = "导出成功。"
});
}
[HttpPost]
public ActionResult RawList(QueryParamsModel pararms)
{
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
var collegeID = pararms.getExtraGuid("cgbCollege");
var yearID = pararms.getExtraInt("ddlYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");
var standardID = pararms.getExtraInt("cbgStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("cbgStandard");
var classmajorID = pararms.getExtraGuid("cbgClassmajor");
var coursematerialID = pararms.getExtraGuid("cgbCourse");
return base.Json(SOCDetialScoreServices.GetSOCDetailRawScoreViewList(configuretView, schoolyearID, collegeID, yearID, standardID, classmajorID,
coursematerialID, (int)pararms.page, (int)pararms.rows));
}
[HttpPost]
public ActionResult RawExcel()
{
NpoiExcelHelper neh = new NpoiExcelHelper();
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
var schoolyearID = Request.Form["ddlSchoolyear"].ParseStrTo();
var collegeID = Request.Form["cgbCollege"].ParseStrTo();
var yearID = Request.Form["ddlYear"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo();
var standardID = Request.Form["cbgStandard"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["cbgStandard"].ParseStrTo();
var classmajorID = Request.Form["cbgClassmajor"].ParseStrTo();
var coursematerialID = Request.Form["cgbCourse"].ParseStrTo();
var dt = SOCDetialScoreServices.GetSOCDetailRawScoreViewList(configuretView, schoolyearID, collegeID, yearID,
standardID, classmajorID, coursematerialID)
.Select(x => new
{
x.SchoolyearCode,
x.CourseCode,
x.CourseName,
TotalCredit = x.TotalCredit.HasValue ? x.TotalCredit.Value.ToString("#.#") : null,
x.Gradeyear,
x.StandardDesc,
x.ClassmajorName,
x.LoginID,
x.Name,
x.SOCDetailName,
SOCDetailCredit = x.SOCDetailCredit.HasValue ? x.SOCDetailCredit.Value.ToString("#.#") : null,
Weight = x.Weight.HasValue ? x.Weight.Value.ToString("#.#") : null,
Score = x.Score.HasValue ? x.Score.Value.ToString("#.#") : null,
ActualScore = x.ActualScore.HasValue ? x.ActualScore.Value.ToString("#.#") : null
}).ToTable();
string[] liststring = {
"学年学期", "课程代码", "课程名称", "课程学分", "年级", "专业",
"班级", "学号", "姓名", "成果名称", "成果学分", "成果权重", "成果得分", "实际得分"
};
neh.Export(dt, liststring, "学生SOC原始成绩表" + DateTime.Now.ToString("yyyyMMdd"));
return Json(new ReturnMessage()
{
IsSuccess = true,
Message = "导出成功。"
});
}
[HttpPost]
public ActionResult StudentSubmit(string socDetailSubmitViews)
{
var userID = CustomPrincipal.Current.UserID;
try
{
var socDetailSubmitViewList = socDetailSubmitViews.JsonToObject>();
this.SOCDetialScoreServices.StudentSubmit(userID, socDetailSubmitViewList);
return Json(new ReturnMessage()
{
IsSuccess = true,
Message = "提交成功。"
});
}
catch (Exception ex)
{
return Json(new ReturnMessage()
{
IsSuccess = false,
Message = "提交失败:" + ex.Message
});
}
}
public ActionResult StudentAttachmentList(Guid? socDetailID, Guid? socDetailGroupID)
{
var userID = CustomPrincipal.Current.UserID;
var socDetailStudentKeyView = new SOCDetailStudentKeyView { SOCDetailID = socDetailID, SOCDetailGroupID = socDetailGroupID };
ViewBag.IsStudentCanUpload = this.SOCDetialScoreServices.IsStudentCanUpload(userID, socDetailStudentKeyView);
return View(socDetailStudentKeyView);
}
[HttpPost]
public ActionResult StudentAttachmentList(SOCDetailStudentKeyView socDetailStudentKeyView)
{
var userID = CustomPrincipal.Current.UserID;
try
{
var sessionName = FileUploadHelper.GetFileUploadSessionName((socDetailStudentKeyView.SOCDetailGroupID ?? socDetailStudentKeyView.SOCDetailID) ?? Guid.Empty);
var fileList = (List)Session[sessionName];
this.SOCDetialScoreServices.SaveFile(userID, socDetailStudentKeyView, fileList);
return Json(new ReturnMessage()
{
IsSuccess = true,
Message = "保存成功。"
});
}
catch (Exception ex)
{
return Json(new ReturnMessage()
{
IsSuccess = false,
Message = "保存失败:" + ex.Message
});
}
}
public ActionResult StudentScoreList()
{
ViewBag.ScoreDigitCount = ParameterServices.GetParameterValue(CF_ParameterType.ScoreDigitCount) ?? 1;
return View();
}
[HttpPost]
public ActionResult StudentCoursematerialList()
{
var userID = CustomPrincipal.Current.UserID;
List socStudentScoreTotalViewList = new List();
//课程成绩
var socStudentScoreItemViewList = this.SOCDetialScoreServices.GetStudentScoreItemViewList(userID);
if (socStudentScoreItemViewList.Count > 0)
{
SOCStudentScoreTotalView socStudentScoreTotalView = this.SOCDetialScoreServices.GetStudentScoreTotalView(userID);
if (socStudentScoreTotalView == null)
{
socStudentScoreTotalView = new SOCStudentScoreTotalView();
}
try
{
socStudentScoreTotalView.ListStarttermID = socStudentScoreItemViewList.Select(x => (int)x.StarttermID).Distinct().ToList();
}
catch (Exception ex)
{
throw ex;
}
socStudentScoreTotalView.SOCStudentScoreItemViewList = socStudentScoreItemViewList.ToList();
socStudentScoreTotalViewList.Add(socStudentScoreTotalView);
}
return Json(socStudentScoreTotalViewList);
}
[HttpPost]
public ActionResult StudentDetailScoreList(Guid? coursematerialID, int? startTermID)
{
var userID = CustomPrincipal.Current.UserID;
return base.Json(this.SOCDetialScoreServices.GetSOCDetailRawScoreViewList(coursematerialID, startTermID, userID));
}
[HttpPost]
public ActionResult GroupStudentList(QueryParamsModel pararms)
{
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var socDetailGroupID = pararms.getExtraGuid("hidSOCDetailGroupID");
return base.Json(SOCDetialScoreServices.GetSOCDetailGroupStudentViewList(configuretView, socDetailGroupID, (int)pararms.page, (int)pararms.rows));
}
[HttpPost]
public ActionResult DetailStudentGroupList(QueryParamsModel pararms)
{
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var socDetailID = pararms.getExtraGuid("hidSOCDetailID");
var userID = CustomPrincipal.Current.UserID;
return base.Json(SOCDetialScoreServices.GetSOCDetailGroupStudentViewList(configuretView, socDetailID.Value, userID, (int)pararms.page, (int)pararms.rows));
}
[HttpGet]
public ActionResult SendMessage(string studentUserIDLists)
{
ViewBag.UserIDLists = studentUserIDLists;
return View();
}
public ActionResult SendMessage(AnnouncementView announcementView)
{
var userIDs = Request.Form["idList"];
//var message = Request.Form["Message"];
announcementView.Content = HttpContext.Server.HtmlDecode(announcementView.Content);
var userIDList = userIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
try
{
SOCDetialScoreServices.SendMessage(userIDList, announcementView);
return Json(new ReturnMessage()
{
IsSuccess = true,
Message = "发送成功。"
});
}
catch (Exception ex)
{
return Json(new ReturnMessage()
{
IsSuccess = false,
Message = "发送失败:" + ex.Message
});
}
//return View();
}
[HttpGet]
public ActionResult Remark()
{
return View();
}
public ActionResult UploaderSave(FormCollection form)
{
Response.Cache.SetNoStore();
try
{
FileUploadView upfile = new FileUploadView();
var files = Request.Files;
var formID = (!string.IsNullOrEmpty(Request["v"])) ? new Guid(Request["v"]) : (Guid?)null;
string sessionName = FileUploadHelper.GetFileUploadSessionName(formID.Value);
var socDetial = SOCDetialScoreServices.GetSOCDetialView(formID.Value);
var savePath = "SOC";
if(socDetial!=null)
{
savePath = "SOC/" + socDetial.SchoolyearCode + "/" + socDetial.YearID + "级/" + socDetial.EducationMissionNameStr + "-" + socDetial.CourseName + "-" + socDetial.SOCDetailName + "/" + socDetial.LoginID + socDetial.Name;
}
//检查文件扩展名字
var postedFile = files["Filedata"]; //得到要上传文件
//if (postedFile != null)
//{
// if (postedFile.ContentLength > (1024 * 1024 * 10))
// {
// throw new Exception("上传的文件不能大于10M");
// }
//}
if (postedFile.FileName == null)
{
return Json(new FileUploadView(), JsonRequestBehavior.AllowGet);
}
upfile.FileID = Function.NewPKGuid();
string fileUrl = FileUploadHelper.UploadFile(postedFile, savePath);
upfile.FileUrl = fileUrl;
upfile.FileName = postedFile.FileName;
upfile.FormID = formID;
if (Session[sessionName] == null)
{
Session[sessionName] = new List();
}
((List)Session[sessionName]).Add(upfile);
return Json(upfile, JsonRequestBehavior.AllowGet);
}
catch
//(Exception ex)
{
//return Json(new ReturnMessage()
//{
// IsSuccess = false,
// Message = "发送失败:" + ex.Message
//});
}
return Json(new FileUploadView(), JsonRequestBehavior.AllowGet);
}
[HttpPost]
public ActionResult Download()
{
try
{
NpoiExcelHelper neh = new NpoiExcelHelper();
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
string WindowStr = Request.UrlReferrer.ToString();
int IndexofID = WindowStr.LastIndexOf("=");
WindowStr = WindowStr.Remove(0, IndexofID + 1);
var IDs = Request.Form["IDs"];
var schoolyearID = Request.Form["ddlSchoolyear"].ParseStrTo();
var collegeID = Request.Form["cgbCollege"].ParseStrTo();
var yearID = Request.Form["ddlYear"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo();
var standardID = Request.Form["cbgStandard"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["cbgStandard"].ParseStrTo();
var classmajorID = Request.Form["cbgClassmajor"].ParseStrTo();
var coursematerialID = Request.Form["cgbCourse"].ParseStrTo();
var recordStatus = Request.Form["ddlStatus"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlStatus"].ParseStrTo();
var isGroupList = Request.Form["isGroupList"].ParseStrTo();
List IDList = new List();
if (IDs != "")
{
IDList = IDs.SplitIDString();
}
else
{
IDList = null;
}
var socDetailList = SOCDetialScoreServices.Download(configuretView, schoolyearID, collegeID, yearID,
standardID, classmajorID, coursematerialID, recordStatus, IDList);
if (isGroupList== 1)
{
socDetailList = SOCDetialScoreServices.GroupListDownload(configuretView, schoolyearID, collegeID, yearID,
standardID, classmajorID, coursematerialID, recordStatus, IDList);
}
List fileInfoList = new List();
foreach (var soc in socDetailList)
{
FileUploadHelper.RemoteFileInfo fileInfo = new FileUploadHelper.RemoteFileInfo();
fileInfo.FileName = soc.EducationMissionNameStr + "-" + soc.CourseName + "-" + soc.SOCDetailName+ "/" + soc.LoginID + soc.Name+"/"+soc.FileName;
fileInfo.RemotePath = (soc.SOCDetailUrl.Trim().StartsWith("http://") ? soc.SOCDetailUrl.Trim() : Url.Content(soc.SOCDetailUrl.Trim()));
fileInfoList.Add(fileInfo);
}
if (fileInfoList.Count > 0)
{
var zipFileStream = FileUploadHelper.DownLoadFiles("SOC成果","学生成果下载"+ DateTime.Now.Year+"-"+DateTime.Now.Month+"-"+DateTime.Now.Day, fileInfoList);
return File(zipFileStream, System.Net.Mime.MediaTypeNames.Application.Zip,"学生成果下载"+ DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day + ".zip");
}
else
{
return RedirectToAction("MsgShowAndOpen", "Common", new
{
WindowID = WindowStr,
msg = "没有成果可下载!",
});
}
}
catch (Exception ex)
{
string mge = ex.Message;
return base.Json("下载失败,原因:" + mge + "!");
}
}
}
}