public void AddRowToRecordsets() { List <IRecordSetItemModel> blankList = _vm.RecsetCollection.Where(c => c.IsBlank && c.Children.Count == 1 && c.Children[0].IsBlank).ToList(); if (blankList.Count == 0) { AddRecordSet(); } foreach (var recset in _vm.RecsetCollection) { List <IRecordSetFieldItemModel> blankChildList = recset.Children.Where(c => c.IsBlank).ToList(); if (blankChildList.Count != 0) { continue; } IRecordSetFieldItemModel newChild = DataListItemModelFactory.CreateRecordSetFieldItemModel(string.Empty); if (newChild != null) { newChild.Parent = recset; recset.Children.Add(newChild); } } }
static void AddMissingWorkFlowRecordsetPart(List <IDataListVerifyPart> missingWorkflowParts, IRecordSetItemModel dataListItem, IRecordSetFieldItemModel child = null) { if (dataListItem.IsEditable) { missingWorkflowParts.Add(child != null ? IntellisenseFactory.CreateDataListValidationRecordsetPart(dataListItem.DisplayName, child.DisplayName, child.Description) : IntellisenseFactory.CreateDataListValidationRecordsetPart(dataListItem.DisplayName, string.Empty, dataListItem.Description)); } }
public void AddRecordSet() { IRecordSetItemModel recset = DataListItemModelFactory.CreateRecordSetItemModel(string.Empty); IRecordSetFieldItemModel childItem = DataListItemModelFactory.CreateRecordSetFieldItemModel(string.Empty); if (recset != null) { recset.IsComplexObject = false; recset.AllowNotes = false; recset.IsExpanded = false; if (childItem != null) { childItem.IsComplexObject = false; childItem.AllowNotes = false; childItem.Parent = recset; recset.Children.Add(childItem); } _vm.RecsetCollection.Add(recset); } }
public void ValidateNames(IDataListItemModel item) { if (item == null) { return; } if (item is IRecordSetItemModel) { _recordsetHandler.ValidateRecordset(); } else if (item is IRecordSetFieldItemModel) { IRecordSetFieldItemModel rs = (IRecordSetFieldItemModel)item; _recordsetHandler.ValidateRecordsetChildren(rs.Parent); } else { ValidateScalar(); } }
public void AddRecordsetNamesIfMissing() { var recsetNum = _vm.RecsetCollection?.Count ?? 0; int recsetCount = 0; while (recsetCount < recsetNum) { IRecordSetItemModel recset = _vm.RecsetCollection?[recsetCount]; if (!string.IsNullOrWhiteSpace(recset?.DisplayName)) { FixNamingForRecset(recset); int childrenNum = recset.Children.Count; int childrenCount = 0; while (childrenCount < childrenNum) { IRecordSetFieldItemModel child = recset.Children[childrenCount]; if (!string.IsNullOrWhiteSpace(child?.DisplayName)) { int indexOfDot = child.DisplayName.IndexOf(".", StringComparison.Ordinal); if (indexOfDot > -1) { string recsetName = child.DisplayName.Substring(0, indexOfDot + 1); child.DisplayName = child.DisplayName.Replace(recsetName, child.Parent.DisplayName + "."); } else { child.DisplayName = string.Concat(child.Parent.DisplayName, ".", child.DisplayName); } FixCommonNamingProblems(child); } childrenCount++; } } recsetCount++; } }