Commit b642eb08 authored by 黄奎's avatar 黄奎

页面修改

parent 95479c92
......@@ -1093,14 +1093,19 @@ namespace Edu.Module.Course
/// </summary>
public void RunCourseChapterModule()
{
var courseList = courseRepository.GetCourseListRepository(new RB_Course_ViewModel() { QCourseIds = "97" });
var courseList = chapterRepository.GetCourseChapterListExtRepository();
if (courseList != null && courseList.Count > 0)
{
foreach (var item in courseList)
{
//if (item.CourseId != 97)
//{
// continue;
//}
List<RB_Course_Chapter_ViewModel> result = new List<RB_Course_Chapter_ViewModel>();
var sourceList = GetChapterListModule(new RB_Course_Chapter_ViewModel() { CourseId = item.CourseId });
var treeList= GetChapterTreeListModule(new RB_Course_Chapter_ViewModel() { CourseId = item.CourseId });
var chapterQuery = new RB_Course_Chapter_ViewModel() { CourseId = item.CourseId };
var sourceList = GetChapterListModule(chapterQuery);
var treeList= GetChapterTreeListModule(chapterQuery);
if (treeList != null && treeList.Count>0)
{
foreach (var tItem in treeList)
......@@ -1140,7 +1145,12 @@ namespace Edu.Module.Course
int index = 1;
foreach (var sItem in result)
{
sItem.SortNum = index;
sItem.ChapterNo = index.ToString();
string pattern = @"第[一二三四五六七八九十]次课";
string newStr = Regex.Replace(sItem.ChapterName, pattern, "");
string newTitle = string.Format("第{0}次课", new WordToNumHelper().NumToChinese(index.ToString())) + " " + newStr.Trim();
sItem.ChapterName = newTitle;
index++;
}
chapterRepository.DeleteByCourseIdRepository(item.CourseId);
......@@ -1169,7 +1179,12 @@ namespace Edu.Module.Course
var tempModel = sourceList?.Where(qitem => qitem.ChapterId == subItem.ChapterId)?.FirstOrDefault();
if (tempModel != null)
{
tempModel.ChapterName = item.ChapterName + " " + tempModel.ChapterName;
string newName= item.ChapterName + " " + tempModel.ChapterName;
string pattern = @"第[一二三四五六七八九十]*次课";
newName = Regex.Replace(newName, pattern, "");
string pattern2 = @"第[一二三四五六七八九十]*课";
newName = Regex.Replace(newName, pattern2, "");
tempModel.ChapterName = newName;
tempModel.StudyHours = 2;
tempModel.StudyMinutes = 90;
tempModel.ParentId = 0;
......
......@@ -46,6 +46,16 @@ namespace Edu.Repository.Course
return Get<RB_Course_Chapter_ViewModel>(builder.ToString(), parameters).ToList();
}
/// <summary>
/// 获取有章节的课程编号
/// </summary>
/// <returns></returns>
public List<RB_Course_Chapter_ViewModel> GetCourseChapterListExtRepository()
{
string sql = " SELECT DISTINCT CourseId FROM rb_course_chapter WHERE Status=0 ORDER BY CourseId ";
return Get<RB_Course_Chapter_ViewModel>(sql).ToList();
}
/// <summary>
/// 批量插入
/// </summary>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment