using Learun.Application.TwoDevelopment.LR_Desktop;
using Learun.Util;
using System.Web.Mvc;
using Learun.Application.Base.SystemModule;
using Learun.Application.TwoDevelopment.EducationalAdministration;
namespace Learun.Application.Web.Areas.LR_Desktop.Controllers
{
///
/// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
/// Copyright (c) 2013-2018 北京泉江科技有限公司
/// 创 建:超级管理员
/// 日 期:2018-09-25 11:32
/// 描 述:图标配置
///
public class DTChartController : MvcControllerBase
{
private DTChartIBLL dTChartIBLL = new DTChartBLL();
private DatabaseLinkIBLL databaseLinkIbll = new DatabaseLinkBLL();
private ThematicManagementIBLL thematicManagementIbll = new ThematicManagementBLL();
#region 视图功能
///
/// 主页面
///
///
[HttpGet]
public ActionResult Index()
{
return View();
}
///
/// 表单页
///
///
[HttpGet]
public ActionResult Form()
{
return View();
}
#endregion
#region 获取数据
///
/// 获取页面显示列表数据
///
/// 查询参数
///
[HttpGet]
[AjaxOnly]
public ActionResult GetPageList(string pagination, string queryJson)
{
Pagination paginationobj = pagination.ToObject();
var data = dTChartIBLL.GetPageList(paginationobj, queryJson);
if (paginationobj == null)
{
return JsonResult(data);
}
else
{
var jsonData = new
{
rows = data,
total = paginationobj.total,
page = paginationobj.page,
records = paginationobj.records
};
return JsonResult(jsonData);
}
}
///
/// 获取表单数据
///
///
[HttpGet]
[AjaxOnly]
public ActionResult GetFormData(string keyValue)
{
var LR_DT_ChartData = dTChartIBLL.GetLR_DT_ChartEntity(keyValue);
var jsonData = new
{
LR_DT_Chart = LR_DT_ChartData,
};
return JsonResult(jsonData);
}
#endregion
#region 提交数据
///
/// 删除实体数据
/// 主键
///
///
[HttpPost]
[AjaxOnly]
public ActionResult DeleteForm(string keyValue)
{
dTChartIBLL.DeleteEntity(keyValue);
return Success("删除成功!");
}
///
/// 保存实体数据(新增、修改)
/// 主键
///
///
[HttpPost]
[ValidateAntiForgeryToken]
[AjaxOnly]
public ActionResult SaveForm(string keyValue, DTChartEntity entity)
{
dTChartIBLL.SaveEntity(keyValue, entity);
return Success("保存成功!");
}
[HttpGet]
[AjaxOnly]
public ActionResult GetSqlData(string Id)
{
var dtListEntity = dTChartIBLL.GetLR_DT_ChartEntity(Id);
if (Id == "a2939764-2422-4782-89a1-131b57f75370" || Id == "f3c192ed-65b1-43a3-8b68-d81dd550a447")//教师电子成绩单提交统计 或 教师纸质成绩单提交统计
{
if (dtListEntity != null)
{
//获取当前时间学年和学期
var yearAndSemester = Common.GetSemesterAndYear();
var sql = dtListEntity.F_Sql;
var strSql = $" where t.AcademicYearNo='{yearAndSemester.AcademicYearShort}' and t.Semester='{yearAndSemester.Semester}' ";
var tempsql = sql.Substring(0, sql.IndexOf("group")) + strSql + sql.Substring(sql.IndexOf("group"));
dtListEntity.F_Sql = tempsql;
}
}
var reqDataTable = databaseLinkIbll.FindTable(dtListEntity.F_DataSourceId.Trim(), dtListEntity.F_Sql);
var jsonData = new
{
Id = Id,
value = reqDataTable,
};
return JsonResult(jsonData);
}
#endregion
}
}