From b8b2b2533ea590b9c89f934ec4e1bd6b7571fbd3 Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Sat, 26 Feb 2022 10:16:28 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=AF=BE=E7=A8=8B=E8=A1=A8?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=97=A5=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ArrangeLessonTermController.cs | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/ArrangeLessonTermController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/ArrangeLessonTermController.cs index 4a8b53c83..50437f39d 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/ArrangeLessonTermController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/ArrangeLessonTermController.cs @@ -190,7 +190,7 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers string returnStr = ""; var startDate = DateTime.Parse(Common.CalculateFirstDateOfWeek(startTime).ToString("yyyy-MM-dd")); //int k = Convert.ToInt32(startTime.DayOfWeek);//得到开始时间的第一天是周几 - int countDay = endTime.Subtract(startDate).Days; + int countDay = endTime.Subtract(startDate).Days; int countWeek = countDay / 14 + 1; return countWeek; @@ -248,7 +248,7 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers if (string.IsNullOrEmpty(classNo)) { var res = new - { schoolName = "课程表", semester = $"{strAcademicYear}学年度 第{strSemester}学期", weekList = "" }; + { schoolName = "课程表", semester = $"{strAcademicYear}学年度 第{strSemester}学期", weekList = "" }; return JsonResult(res); } @@ -256,8 +256,14 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers var entity = schoolCalendarIbll.GetSchoolCalendarEntityByNo(semesterAndYear.AcademicYearShort, semesterAndYear.Semester); var StartTime = entity.StartTime.Value; //根据第几周,计算查询的开始和结束日期 - startDate = StartTime.AddDays(((curWeek - 1) * 14)).ToString("yyyy-MM-dd"); - endDate = StartTime.AddDays(((curWeek - 1) * 14)).AddDays(10).ToString("yyyy-MM-dd"); + startDate = Common.CalculateFirstDateOfWeek(StartTime.AddDays(((curWeek - 1) * 14))).ToString("yyyy-MM-dd");//StartTime.AddDays(((curWeek - 1) * 14)).ToString("yyyy-MM-dd"); + if (curWeek == 1 && Convert.ToDateTime(startDate) < StartTime) + { + startDate = StartTime.ToString("yyyy-MM-dd"); + } + + endDate = Common.CalculateFirstDateOfWeek(StartTime.AddDays(((curWeek - 1) * 14))).AddDays(10) + .ToString("yyyy-MM-dd");// StartTime.AddDays(((curWeek - 1) * 14)).AddDays(10).ToString("yyyy-MM-dd"); var timeTableList = new List(); //课程表 @@ -350,12 +356,12 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers /// [HttpPost] [AjaxOnly] - public ActionResult DeleteLessonTerm(string keyValue,string WeekTime) + public ActionResult DeleteLessonTerm(string keyValue, string WeekTime) { arrangeLessonTermIBLL.DeleteLessonTerm(keyValue, WeekTime); return Success("删除成功!"); } - + /// ///修改课程 /// 主键 @@ -363,10 +369,10 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers /// [HttpPost] [AjaxOnly] - public ActionResult UpdateLessonTerm(string keyValue,string postdata) + public ActionResult UpdateLessonTerm(string keyValue, string postdata) { UpdateLessonTermEntity model = postdata.ToObject(); - var res=arrangeLessonTermIBLL.UpdateLessonTerm(keyValue, model); + var res = arrangeLessonTermIBLL.UpdateLessonTerm(keyValue, model); if (!string.IsNullOrEmpty(res)) { return Fail(res); @@ -375,7 +381,7 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers return Success("操作成功!"); } - + #endregion ///