/// <summary> /// Reads View steps. /// </summary> /// <param name="process">The process.</param> /// <param name="sr">The reader.</param> /// <param name="stepList">The step list.</param> /// <param name="sectionId">The Section id.</param> /// <param name="fieldDto">The field DTO.</param> /// <param name="stepFetchers">The step fetchers.</param> private static void ReadViewSteps( ProcessEditDto process, SafeDataReader sr, IEnumerable<ViewStepDto> stepList, int? sectionId, ProcessViewSectionEditDto fieldDto, Dictionary<string, IFetcher> stepFetchers) { foreach (var fieldEditorDto in stepList) { try { var dto = fieldEditorDto; ReadViewStep(process, sr, sectionId, ref fieldDto, stepFetchers, dto); } catch (Exception ex) { Debug.WriteLine(ex.Message); throw; } } }
/// <summary> /// Read View Step. /// </summary> /// <param name="process">The process.</param> /// <param name="sr">The reader.</param> /// <param name="SectionId">The Section id.</param> /// <param name="fieldDto">The field DTO.</param> /// <param name="stepFetchers">The step fetchers.</param> /// <param name="fieldEditorDto">The field editor DTO.</param> /// <returns>The Field Id.</returns> private static int? ReadViewStep( ProcessEditDto process, SafeDataReader sr, int? SectionId, ref ProcessViewSectionEditDto fieldDto, Dictionary<string, IFetcher> stepFetchers, ViewStepDto fieldEditorDto) { sr.NextResult(); if (SectionId != fieldEditorDto.SectionId) { SectionId = fieldEditorDto.SectionId; fieldDto = process.ViewList.SelectMany(v => v.SectionList).First(s => s.Id == SectionId); } fieldDto.StepList.Add((BaseViewStepDto)(stepFetchers.ContainsKey("Cebos.Veyron.Library.Process.ProcessViews.SectionSteps." + fieldEditorDto.Class) ? stepFetchers["Cebos.Veyron.Library.Process.ProcessViews.SectionSteps." + fieldEditorDto.Class].Fetch(fieldEditorDto, sr) : fieldEditorDto)); return SectionId; }
/// <summary> /// The read process view sections. /// </summary> /// <param name="process">The process.</param> /// <param name="sr">The reader.</param> private void ReadProcessViewSections(ProcessEditDto process, SafeDataReader sr) { sr.NextResult(); int? viewId = null; ProcessViewEditDto view = null; while (sr.Read()) { var sectionDto = new ProcessViewSectionEditDto { Id = sr.GetInt32(0), ProcessViewId = sr.GetInt32(1), Name = sr.GetString(2), Guid = sr.GetGuid(3), TemplateSectionGuid = sr.GetGuid(4) }; if (sectionDto.ProcessViewId != viewId) { view = process.ViewList.First(s => s.Id == sectionDto.ProcessViewId); viewId = sectionDto.ProcessViewId; } view.SectionList.Add(sectionDto); } ReadProcessViewFields(process, sr); ReadProcessViewSteps(process, sr); }