public Task <string> D4LEntry(D4LDTO dto) { return(this._entry.DoAsync(dto)); }
public async Task <string> DoAsync(D4LDTO dto) { var code = new StringHelper(dto.CatalogCode).Split('/'); var name = new StringHelper(dto.CatalogName).Split('/'); string catalogCode = code.Get(1); string gradCode = code.Get(3); string gradeName = name.Get(3); string catalogName = name.Get(1); var notes = await this.GetDesignNotes(dto.ClassId, this._user.UserId, catalogCode, gradCode, dto.DsId, dto.TaskId);//this._bridge.GetDesignNotes(dto.ClassId, this._user.UserId, catalogCode, gradCode, dto.DsId, dto.TaskId); //如果笔记已存在... if (notes != null) { var section = notes.SetSection(this.sId); if (section == null) { //以学程创建 notes = await this._notes.CreateSection(notes.Id, this.sId, dto.DsName); } } var pv = notes?.SetSection(this.sId)? .SetCurrentPage(this.pid); //创建页 if (notes != null && dto.TaskId != Guid.Empty && pv == null) { notes = await this._notes.CreatePage(notes.Id, sId, pid, dto.TaskName, null); notes.SetSection(sId) .SetCurrentPage(pid); } if (notes == null) { Guid nid = Guid.NewGuid(); notes = await this._notes.CreateAsync(new CreateNotesDTO { CatalogCode = catalogCode, //code.Get(1), CatalogName = catalogName, //name.Get(1), GradeCode = gradCode, //code.Get(0), GradeName = gradeName, //name.Get(0), ClassId = dto.ClassId, Name = String.Concat(name.Get(3), name.Get(1), name.Get(2), name.Get(4)), //"新建笔记本", Section = new NotesComponent { Id = sId, //dto.DsId, Value = dto.DsName }, Page = new NotesComponent { Id = pid,//dto.TaskId, Value = dto.TaskName }, Content = "", }, nid , this._user.UserName , this._user.UserId); if (dto.TaskId != Guid.Empty) { await this._body.Create(nid, this.sId, this.pid, ""); } //用户使用分类 await this._userRoot.ReferenceCatalog(this._user.UserId, catalogCode, catalogName, gradCode, gradeName); } return($"{notes.Id},{notes.CurrentSection?.Sections.Id},{notes.CurrentSection?.CurrentPage?.Page.Id}"); }