master
xiaochanghai 5 months ago
parent 001f8b6b2f
commit c1e41adc67
  1. 1
      Tiobon.Core.Model/Insert/Ghre/Ghre_CourseWare.Dto.InsertInput.cs
  2. 2
      Tiobon.Core.Services/CommonServices.cs
  3. 33
      Tiobon.Core.Services/Ghre/Ghre_CourseWareServices.cs
  4. 4
      Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs
  5. 7
      Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs

@ -32,6 +32,7 @@ public class InsertGhre_CourseWareInput : Ghre_CourseWareBase
} }
public class Ghre_CourseWareLink public class Ghre_CourseWareLink
{ {
public long Id { get; set; }
public string LinkName { get; set; } public string LinkName { get; set; }
public string LinkAddress { get; set; } public string LinkAddress { get; set; }
} }

@ -1059,7 +1059,7 @@ public partial class CommonServices : BaseServices<RootEntityTkey<int>>, ICommon
fnKey = "TBD4YN", fnKey = "TBD4YN",
fnTitle = "课程顺序", fnTitle = "课程顺序",
fnType = "row", fnType = "row",
icon = "ghr-publish", icon = "ghr-drag",
position = "left" position = "left"
}); });
break; break;

@ -74,23 +74,30 @@ public class Ghre_CourseWareServices : BaseServices<Ghre_CourseWare, Ghre_Course
} }
await _ghre_CourseWareAttachmentServices.Delete(x => x.CourseWareId == Id); await _ghre_CourseWareAttachmentServices.Delete(x => x.CourseWareId == Id);
editModel.Attachments.ForEach(x =>
if (editModel.Source == "Attachments")
{ {
x.CourseWareId = Id;
x.RelativePath = x.RelativePath.Replace("/Advanced", null);
});
await _ghre_CourseWareAttachmentServices.Add(editModel.Attachments);
if (editModel.Links != null && editModel.Links.Any()) editModel.Attachments.ForEach(x =>
{
x.CourseWareId = Id;
x.RelativePath = x.RelativePath.Replace("/Advanced", null);
});
await _ghre_CourseWareAttachmentServices.Add(editModel.Attachments);
}
else
{ {
var attachments = editModel.Links.Select(x => new InsertGhre_CourseWareAttachmentInput() if (editModel.Links != null && editModel.Links.Any())
{ {
CourseWareId = Id, var attachments = editModel.Links.Select(x => new InsertGhre_CourseWareAttachmentInput()
AttachmentName = x.LinkName, {
RelativePath = x.LinkAddress, CourseWareId = Id,
AttachFileExtension = "http" AttachmentName = x.LinkName,
}).ToList(); RelativePath = x.LinkAddress,
await _ghre_CourseWareAttachmentServices.Add(attachments); AttachFileExtension = "http"
}).ToList();
await _ghre_CourseWareAttachmentServices.Add(attachments);
}
} }
return await base.Update(Id, editModel); return await base.Update(Id, editModel);
} }

@ -1,4 +1,5 @@
using NPOI.HSSF.UserModel; using Microsoft.IdentityModel.Tokens;
using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel; using NPOI.SS.UserModel;
using NPOI.SS.Util; using NPOI.SS.Util;
using NPOI.XSSF.UserModel; using NPOI.XSSF.UserModel;
@ -1010,7 +1011,6 @@ public class Ghre_QuestionServices : BaseServices<Ghre_Question, Ghre_QuestionDt
else if (questionType == "Completion") else if (questionType == "Completion")
{ {
questionContent = questionContent.Replace("()", "()"); questionContent = questionContent.Replace("()", "()");
var completionCount = 0; var completionCount = 0;
for (int ii = 1; ii < 11; ii++) for (int ii = 1; ii < 11; ii++)
{ {

@ -1238,9 +1238,12 @@ WHERE A.Id = '{id}'";
if (course.CourseWareList[j].Attachments != null && course.CourseWareList[j].Attachments.Any()) if (course.CourseWareList[j].Attachments != null && course.CourseWareList[j].Attachments.Any())
course.CourseWareList[j].Attachments.ForEach(x => x.RelativePath = "/Advanced" + x.RelativePath); course.CourseWareList[j].Attachments.ForEach(x => x.RelativePath = "/Advanced" + x.RelativePath);
course.CourseWareList[j].Links = attachments.Where(x => x.AttachFileExtension == "http") course.CourseWareList[j].Links = attachments
.Where(x => x.AttachFileExtension == "http")
.OrderBy(x => x.SortNo)
.Select(x => new Ghre_CourseWareLink() .Select(x => new Ghre_CourseWareLink()
{ {
Id = x.Id,
LinkName = x.AttachmentName, LinkName = x.AttachmentName,
LinkAddress = x.RelativePath, LinkAddress = x.RelativePath,
}).ToList(); }).ToList();
@ -1251,7 +1254,7 @@ WHERE A.Id = '{id}'";
if (course.CourseStandardDuration.IsNull()) if (course.CourseStandardDuration.IsNull())
{ {
sql = $@"SELECT ISNULL (A.Hours, 0) * 60 + A.Minutes Minutes sql = $@"SELECT SUM (ISNULL (A.Hours, 0) * 60 + A.Minutes) Minutes
FROM Ghre_CourseWare A FROM Ghre_CourseWare A
WHERE A.Id IN WHERE A.Id IN
(SELECT CourseWareId (SELECT CourseWareId

Loading…
Cancel
Save