private static void CreateGddChapterAndSections(GddConfigurationElements gddConfigElement, int level) { try { var chapter = $"<li><h3>{gddConfigElement.Title}</h3></li>"; Html = Html + chapter; CreateGddSectionContent(gddConfigElement); var childElements = DbFactory.GddConfigurationElementsRepository.FindAllChildren(gddConfigElement.Id); if (childElements != null && childElements.Count > 0) { level++; Html = Html + "<ol>"; foreach (var element in childElements) { CreateGddChapterAndSections(element, level); } Html = Html + "</ol>"; } } catch (Exception ex) { throw new Exception("It haven't been possible to generate the chapters and sections of game design document.", ex); } }
private static void CreateGddSectionContent(GddConfigurationElements confElement) { try { var mapping = DbFactory.DesignMappingRepository.FindFirstByProjectId(_project.Id); if (mapping != null) { foreach (var genreElement in confElement.GameGenreElements) { var mappingElements = mapping.GameDesignMappingElements.Where(w => w.GameGenreElement.Id == genreElement.Id) .ToList(); if (mappingElements.Count > 0) { Html = Html + "<ul>"; foreach (var mappingContent in mappingElements) { var content = "<li>" + $"<p>{mappingContent.Descricao}" + (!String.IsNullOrEmpty(mappingContent.ModelElementId) ? " <small style='color: silver;'>(*Relative to process object: " + mappingContent.ModelElementId + ")</small>" : "") + "</p></li>"; Html = Html + content; } Html = Html + "</ul>"; } } } } catch (Exception ex) { throw new Exception("It haven't been possible to generate the section content of game design document.", ex); } }
public PartialViewResult SaveGddSection(Guid IdGdd, Guid IdGddElement, Guid IdSection, GddConfigurationElements gddElement, Guid[] cklGenreElements) { try { var Gdd = DbFactory.GddConfigurationRepository.FirstById(IdGdd); var parent = DbFactory.GddConfigurationElementsRepository.FirstById(IdSection); if (parent != null) { gddElement.ParentElement = parent; } var maxOrder = DbFactory.GddConfigurationElementsRepository.GetMaxOrder(IdGdd); maxOrder++; gddElement.PresentationOrder = maxOrder; if (IdGddElement != gddElement.Id) { var gddElemetDb = DbFactory.GddConfigurationElementsRepository.FirstById(IdGddElement); gddElemetDb.Title = gddElement.Title; gddElemetDb.Description = gddElement.Description; gddElemetDb.ParentElement = gddElement.ParentElement; gddElement = gddElemetDb; } if (cklGenreElements != null) { var elements = DbFactory.GameGenreElementRepository.FindAllElementsByListId(cklGenreElements); foreach (var element in elements) { gddElement.GameGenreElements.Add(element); } } gddElement.GddConfig = Gdd; DbFactory.GddConfigurationElementsRepository.SaveOrUpdate(gddElement); var gddElements = DbFactory.GddConfigurationElementsRepository.FindAllElementsByGddId(Gdd.Id).OrderBy(o => o.PresentationOrder).ToList(); ViewBag.IdGdd = Gdd.Id; return(PartialView("_TblGddElements", gddElements)); } catch (Exception ex) { return(PartialView("Error", new HandleErrorInfo(ex, "Configuration", "AddGddSection"))); } }