|
- using Learun.Util;
- using System.Data;
- using Learun.Application.TwoDevelopment.EducationalAdministration;
- using System.Web.Mvc;
- using System.Collections.Generic;
- using System.Linq;
- using System;
- using Newtonsoft.Json.Linq;
- using Newtonsoft.Json;
-
- namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
- {
- /// <summary>
- /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
- /// Copyright (c) 2013-2018 北京泉江科技有限公司
- /// 创 建:超级管理员
- /// 日 期:2019-09-26 10:47
- /// 描 述:教学调度
- /// </summary>
- public class ArrangeLessonTermAttemperController : MvcControllerBase
- {
- private ArrangeLessonTermAttemperIBLL arrangeLessonTermAttemperIBLL = new ArrangeLessonTermAttemperBLL();
- private ArrangeLessonTermAttemperChildIBLL arrangeLessonTermAttemperChildIBLL = new ArrangeLessonTermAttemperChildBLL();
- private ArrangeLessonTermIBLL arrangeLessonTermIBLL = new ArrangeLessonTermBLL();
- #region 视图功能
-
- /// <summary>
- /// 主页面
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Index()
- {
- return View();
- }
- /// <summary>
- /// 表单页
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Form()
- {
- return View();
- }
- /// <summary>
- /// 表单查看页
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult FormView()
- {
- return View();
- }
- #endregion
-
- #region 获取数据
-
- /// <summary>
- /// 获取页面显示列表数据
- /// <summary>
- /// <param name="queryJson">查询参数</param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetPageList(string pagination, string queryJson)
- {
- Pagination paginationobj = pagination.ToObject<Pagination>();
- var data = arrangeLessonTermAttemperIBLL.GetPageList(paginationobj, queryJson);
- var jsonData = new
- {
- rows = data,
- total = paginationobj.total,
- page = paginationobj.page,
- records = paginationobj.records
- };
- return Success(jsonData);
- }
- /// <summary>
- /// 获取表单数据
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetFormData(string keyValue)
- {
- var ArrangeLessonTermAttemperData = arrangeLessonTermAttemperIBLL.GetArrangeLessonTermAttemperEntity(keyValue);
- ArrangeLessonTermAttemperData.NewF_SchoolId = ArrangeLessonTermAttemperData.F_SchoolId;
- ArrangeLessonTermAttemperData.NewAcademicYearNo = ArrangeLessonTermAttemperData.AcademicYearNo;
- ArrangeLessonTermAttemperData.NewSemester = ArrangeLessonTermAttemperData.Semester;
- var jsonData = new
- {
- ArrangeLessonTermAttemper = ArrangeLessonTermAttemperData,
- };
- return Success(jsonData);
- }
- /// <summary>
- /// 获取表单数据
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetFormDataByProcessId(string processId)
- {
- var ArrangeLessonTermAttemperData = arrangeLessonTermAttemperIBLL.GetEntityByProcessId(processId);
- ArrangeLessonTermAttemperData.NewF_SchoolId = ArrangeLessonTermAttemperData.F_SchoolId;
- ArrangeLessonTermAttemperData.NewAcademicYearNo = ArrangeLessonTermAttemperData.AcademicYearNo;
- ArrangeLessonTermAttemperData.NewSemester = ArrangeLessonTermAttemperData.Semester;
- var jsonData = new
- {
- ArrangeLessonTermAttemper = ArrangeLessonTermAttemperData,
- };
- return Success(jsonData);
- }
- #endregion
-
- #region 提交数据
-
- /// <summary>
- /// 删除实体数据
- /// <param name="keyValue">主键</param>
- /// <summary>
- /// <returns></returns>
- [HttpPost]
- [AjaxOnly]
- public ActionResult DeleteForm(string keyValue)
- {
- arrangeLessonTermAttemperIBLL.DeleteEntity(keyValue);
- return Success("删除成功!");
- }
- /// <summary>
- /// 保存实体数据(新增、修改)
- /// <param name="keyValue">主键</param>
- /// <summary>
- /// <returns></returns>
- [HttpPost]
- [ValidateAntiForgeryToken]
- [AjaxOnly]
- public ActionResult SaveForm(string keyValue, string strEntity)
- {
- ArrangeLessonTermAttemperEntity entity = strEntity.ToObject<ArrangeLessonTermAttemperEntity>();
- if (entity.AttemperType == "03")
- {
- //if (entity.F_SchoolId != entity.NewF_SchoolId || entity.AcademicYearNo != entity.NewAcademicYearNo || entity.Semester != entity.NewSemester)
- if (entity.AcademicYearNo != entity.NewAcademicYearNo || entity.Semester != entity.NewSemester)
- {
- return Fail("校区、学年、学期不一致!");
- }
- }
- if (entity.AttemperType=="04")
- {
- JObject jo = (JObject)JsonConvert.DeserializeObject(strEntity);
- List<ArrangeLessonTermAttrmperChildEntity> query = new List<ArrangeLessonTermAttrmperChildEntity>();
- string[] targetjieci = jo["tardata"]["targetjieci"].ToString().TrimEnd(';').Split(';');
- string targettime = jo["tardata"]["targettime"].ToString();
- string lastdata = "";
- int i = 0;
- int index = 0;
- foreach (var item in jo["predata"])
- {
- //index++;
- if (string.IsNullOrEmpty(lastdata) || lastdata != item["LessonTime"].ToString())
- {
- lastdata = item["LessonTime"].ToString();
- if ( index >= jo["predata"].Count()/2)
- {
- i++;
- }
- }
- DateTime NewLessonDate = Convert.ToDateTime(jo["tardata"]["targettime"].ToString());
- string newlessontime = Convert.ToInt32(NewLessonDate.DayOfWeek).ToString()+ targetjieci[i].Replace("节","");
- ArrangeLessonTermAttrmperChildEntity term = new ArrangeLessonTermAttrmperChildEntity
- {
- LessonId = !string.IsNullOrEmpty(keyValue) ? item["LessonId"].ToString(): item["AltId"].ToString(),
- LessonDate = Convert.ToDateTime(item["LessonDate"].ToString()),
- LessonTime = item["LessonTime"].ToString(),
- NewLessonDate =NewLessonDate ,
- NewLessonTime = newlessontime
- };
- query.Add(term);
- index++;
- }
- entity.query = query;
- }
-
-
- entity.Status = 0;
- entity.CheckStatus = 0;
- arrangeLessonTermAttemperIBLL.SaveEntity(keyValue, entity);
-
- return Success("保存成功!");
- }
- #endregion
-
- #region 扩展数据
-
-
- /// <summary>
- /// 课程下拉框信息【教学调度】
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetLessonDataInTerm()
- {
- var data = arrangeLessonTermIBLL.GetLessonDataInTerm("").OrderBy(x => x.value);
-
- return Success(data);
- }
- /// <summary>
- /// 获取调课数据
- /// </summary>
- /// <param name="code">数据源编号</param>
- /// <param name="strWhere">sql查询条件语句</param>
- /// <param name="queryJson">数据源请求条件字串</param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetchildData(string code)
- {
- var data = arrangeLessonTermAttemperChildIBLL.GetPageList(new Pagination { page=1,rows=10}, "{'AttemperId':'"+code+"'}");
- return JsonResult(data);
- }
-
- /// <summary>
- /// 提交课程异动记录
- /// </summary>
- /// <param name="keyValue">课程异动主键</param>
- /// <param name="status">审核状态</param>
- /// <param name="processId">流程Id</param>
- /// <returns></returns>
- public ActionResult ModifyStatus(string keyValue, int status, string processId)
- {
- arrangeLessonTermAttemperIBLL.ModifyStatus(keyValue, status, processId);
- return Success("提交成功!");
- }
- #endregion
- }
- }
|