public void ValidateRecordsetChildren(IRecordSetItemModel recset)
 {
     CheckForEmptyRecordset();
     if (recset != null)
     {
         CheckDataListItemsForDuplicates(recset.Children);
     }
     CheckForFixedEmptyRecordsets();
 }
        public void AddMissingTempRecordSet(IDataListVerifyPart part, IRecordSetItemModel tmpRecset)
        {
            var child = DataListItemModelFactory.CreateRecordSetFieldItemModel(part.Field, part.Description, tmpRecset);

            if (child != null)
            {
                child.DisplayName = part.Recordset + "()." + part.Field;
                tmpRecset.Children.Add(child);
            }
        }
Exemple #3
0
 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));
     }
 }
Exemple #4
0
 void CreateColumns(XmlNode subc, IRecordSetItemModel recset)
 {
     if (subc.Attributes != null)
     {
         var child = DataListItemModelFactory.CreateDataListModel(new Models.DataList.ItemModel(Common.ParseIsEditable(subc.Attributes[Common.IsEditable])), subc.Name, Common.ParseDescription(subc.Attributes[Common.Description]), recset, Common.ParseColumnIODirection(subc.Attributes[GlobalConstants.DataListIoColDirection]));
         recset.Children.Add(child);
     }
     else
     {
         var child = DataListItemModelFactory.CreateDataListModel(subc.Name, Common.ParseDescription(null), Common.ParseColumnIODirection(null), recset);
         child.IsEditable = Common.ParseIsEditable(null);
         recset.Children.Add(child);
     }
 }
 public void AddMissingRecordSetPart(IRecordSetItemModel recsetToAddTo, IDataListVerifyPart part)
 {
     if (recsetToAddTo.Children.FirstOrDefault(c => c.DisplayName == part.Field) == null)
     {
         var child = DataListItemModelFactory.CreateRecordSetFieldItemModel(part.Field, part.Description, recsetToAddTo);
         if (recsetToAddTo.Children.Count > 0)
         {
             recsetToAddTo.Children.Insert(recsetToAddTo.Children.Count - 1, child);
         }
         else
         {
             recsetToAddTo.Children.Add(child);
         }
     }
 }
Exemple #6
0
 public void AddMissingRecordSetPart(IRecordSetItemModel recsetToAddTo, IDataListVerifyPart part)
 {
     if (recsetToAddTo.Children.FirstOrDefault(c => c.DisplayName == part.Field) == null)
     {
         var child = DataListItemModelFactory.CreateRecordSetFieldItemModel(part.Field, part.Description, recsetToAddTo);
         child.OnDeleted += (item) => _vm.RemoveDataListItem(item);
         child.IsVisible  = _vm.IsItemVisible(child.Name);
         if (recsetToAddTo.Children.Count > 0)
         {
             recsetToAddTo.Children.Insert(recsetToAddTo.Children.Count - 1, child);
         }
         else
         {
             recsetToAddTo.Children.Add(child);
         }
     }
 }
Exemple #7
0
 private static void ProcessFoundRecordSets(IDataListVerifyPart part, IRecordSetItemModel recsetToRemove, bool isUsed)
 {
     if (recsetToRemove == null)
     {
         return;
     }
     if (string.IsNullOrEmpty(part.Field))
     {
         recsetToRemove.IsUsed = isUsed;
     }
     else
     {
         var childrenToRemove = recsetToRemove.Children.Where(c => c.DisplayName == part.Field);
         childrenToRemove.ToList().ForEach(childToRemove =>
         {
             childToRemove.IsUsed = isUsed;
         });
     }
 }
Exemple #8
0
 private void TestRecordSetItemModelSet(string name, bool populateAllFields = false)
 {
     if (populateAllFields)
     {
         _recordSetItemModel = new RecordSetItemModel(displayname: name
                                                      , dev2ColumnArgumentDirection: enDev2ColumnArgumentDirection.None
                                                      , description: "Test Desc"
                                                      , parent: new DataListItemModel("Parent")
                                                      , children: new OptomizedObservableCollection <IRecordSetFieldItemModel>()
                                                      , hasError: true
                                                      , errorMessage: string.Empty
                                                      , isEditable: false
                                                      , isVisible: false);
     }
     else
     {
         _recordSetItemModel = new RecordSetItemModel(name);
     }
 }
Exemple #9
0
        static void FixCommonNamingProblems(IRecordSetItemModel recset, int childrenCount)
        {
            var child = recset.Children[childrenCount];

            if (child.Parent == null)
            {
                child.Parent = recset;
            }

            if (!string.IsNullOrWhiteSpace(child?.DisplayName))
            {
                var indexOfDot = child.DisplayName.IndexOf(".", StringComparison.Ordinal);
                if (indexOfDot > -1)
                {
                    var recsetName = child.DisplayName.Substring(0, indexOfDot + 1);
                    child.DisplayName = child.DisplayName.Replace(recsetName, child.Parent.DisplayName + ".");
                }
                FixCommonNamingProblems(child);
            }
        }
        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 bool BuildRecordSetErrorMessages(IRecordSetItemModel model, out string errorMessage)
        {
            errorMessage = "";
            if (!RecordSetHasChildren(model))
            {
                return(false);
            }
            if (model.HasError)
            {
                {
                    errorMessage = BuildErrorMessage(model);
                    return(true);
                }
            }
            var childErrors = model.Children.Where(child => child.HasError).ToList();

            if (childErrors.Any())
            {
                errorMessage = string.Join(Environment.NewLine, childErrors.Select(BuildErrorMessage));
            }
            return(true);
        }
        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++;
            }
        }
 public static IRecordSetFieldItemModel CreateRecordSetFieldItemModel(string displayname, string description, IRecordSetItemModel parent) => CreateRecordSetFieldItemModel(new ItemModel(), displayname, description, parent, enDev2ColumnArgumentDirection.None);
 public static IRecordSetFieldItemModel CreateRecordSetFieldItemModel(IRecordSetItemModel parent) => CreateRecordSetFieldItemModel(new ItemModel(), "", "", parent, enDev2ColumnArgumentDirection.None);
        public static IRecordSetFieldItemModel CreateRecordSetFieldItemModel(ItemModel model, string displayname, string description, IRecordSetItemModel parent, enDev2ColumnArgumentDirection dev2ColumnArgumentDirection)
        {
            IRecordSetFieldItemModel dataListModel = new RecordSetFieldItemModel(displayname, parent, dev2ColumnArgumentDirection, description, model.HasError, model.ErrorMessage, model.IsEditable, model.IsVisable, model.IsSelected);

            if (parent != null && !String.IsNullOrEmpty(displayname))
            {
                dataListModel.DisplayName = parent.DisplayName + "()." + displayname;
            }
            return(dataListModel);
        }
 public static IRecordSetFieldItemModel CreateDataListModel(string displayname, string description, enDev2ColumnArgumentDirection dev2ColumnArgumentDirection, IRecordSetItemModel recordSetItemModel) => CreateDataListModel(new ItemModel(), displayname, description, dev2ColumnArgumentDirection, null, null);
Exemple #17
0
 public RecordSetFieldItemModel(string displayname, IRecordSetItemModel parent, enDev2ColumnArgumentDirection dev2ColumnArgumentDirection, string description, bool hasError, string errorMessage, bool isEditable, bool isVisible, bool isSelected, bool isExpanded)
     : base(displayname, dev2ColumnArgumentDirection, description, hasError, errorMessage, isEditable, isVisible, isSelected, isExpanded)
 {
     Parent = parent;
 }
Exemple #18
0
 private static void AddIsEditablePartsToVerify(IList <IDataListVerifyPart> partsToVerify, List <IDataListVerifyPart> missingWorkflowParts, IRecordSetItemModel dataListItem)
 {
     if (!partsToVerify.Any(part => part.Recordset == dataListItem.DisplayName) && dataListItem.IsEditable)
     {
         AddMissingWorkFlowRecordsetPart(missingWorkflowParts, dataListItem);
         foreach (var child in dataListItem.Children.Where(p => !string.IsNullOrEmpty(p.DisplayName)))
         {
             AddMissingWorkFlowRecordsetPart(missingWorkflowParts, dataListItem, child);
         }
     }
     else
     {
         missingWorkflowParts.AddRange(
             from child in dataListItem.Children
             where !partsToVerify.Any(part => child.Parent != null && part.Field == child.DisplayName && part.Recordset == child.Parent.DisplayName) && child.IsEditable
             select IntellisenseFactory.CreateDataListValidationRecordsetPart(dataListItem.DisplayName, child.DisplayName, child.Description));
     }
 }
Exemple #19
0
 bool RecordSetHasChildren(IRecordSetItemModel model) => model.Children != null && model.Children.Count > 0;
        public static IRecordSetFieldItemModel CreateRecordSetFieldItemModel(string displayname, string description = "", IRecordSetItemModel parent = null, bool hasError = false, string errorMessage = "", bool isEditable = true, bool isVisable = true, bool isSelected = false, enDev2ColumnArgumentDirection dev2ColumnArgumentDirection = enDev2ColumnArgumentDirection.None)
        {
            IRecordSetFieldItemModel dataListModel = new RecordSetFieldItemModel(displayname, parent, dev2ColumnArgumentDirection, description, hasError, errorMessage, isEditable, isVisable, isSelected);

            if (parent != null && !String.IsNullOrEmpty(displayname))
            {
                dataListModel.DisplayName = parent.DisplayName + "()." + displayname;
            }
            return(dataListModel);
        }
Exemple #21
0
 public RecordSetFieldItemModel(string displayname, IRecordSetItemModel parent, enDev2ColumnArgumentDirection dev2ColumnArgumentDirection)
     : this(displayname, parent, dev2ColumnArgumentDirection, "", false, "", true, true, false, true)
 {
 }
 private bool RecordSetHasChildren(IRecordSetItemModel model)
 {
     return(model.Children != null && model.Children.Count > 0);
 }