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 ///