internal IDataListViewModel CreateDataListViewModel(IResourceModel resourceModel, IDataListItemModel dataListItemViewModel)
        {
            IDataListViewModel dlVM = CreateDataListViewModel(resourceModel);
            dlVM.DataList.Add(dataListItemViewModel);

            return dlVM;
        }
 // ReSharper restore MethodOverloadWithOptionalParameter
 // ReSharper disable MethodOverloadWithOptionalParameter
 public static IDataListItemModel CreateDataListItemViewModel(IDataListViewModel dataListViewModel, string name, string description, IDataListItemModel parent, bool isEditable = true, enDev2ColumnArgumentDirection dev2ColumnArgumentDirection = enDev2ColumnArgumentDirection.None)
 {
     IDataListItemModel dataListModel = CreateDataListModel(name);
     dataListModel.Description = description;
     dataListModel.Parent = parent;
     dataListModel.IsExpanded = true;
     dataListModel.IsEditable = isEditable;
     return dataListModel;
 }
 public static IDataListItemModel CreateDataListModel(string displayname, string description = "", IDataListItemModel parent = null, OptomizedObservableCollection<IDataListItemModel> children = null, bool hasError = false, string errorMessage = "", bool isEditable = true, bool isVisable = true, bool isSelected = false, enDev2ColumnArgumentDirection dev2ColumnArgumentDirection = enDev2ColumnArgumentDirection.None)
 {
     IDataListItemModel dataListModel = new DataListItemModel(displayname, dev2ColumnArgumentDirection, description, parent, children, hasError, errorMessage, isEditable, isVisable, isSelected);
     if(parent != null && !String.IsNullOrEmpty(displayname))
     {
         dataListModel.Name = parent.DisplayName + "()." + displayname;
     }
     return dataListModel;
 }
 // ReSharper disable MethodOverloadWithOptionalParameter
 public static IDataListItemModel CreateDataListItemViewModel(IDataListViewModel dataListViewModel, string name, string description, IDataListItemModel parent, bool isEditable = true, enDev2ColumnArgumentDirection dev2ColumnArgumentDirection = enDev2ColumnArgumentDirection.None)
 // ReSharper restore MethodOverloadWithOptionalParameter
 {
     IDataListItemModel dataListModel = CreateDataListModel(name);
     dataListModel.Description = description;
     dataListModel.Parent = parent;
     dataListModel.IsExpanded = true;
     dataListModel.IsEditable = isEditable;
     return dataListModel;
 }
 /*
  * This is a piss poor implementation of optional parameters.... Constructor chaining would be far better suited to our needs, or even better a factory or builder!!!! ;)
  */
 public DataListItemModel(string displayname, enDev2ColumnArgumentDirection dev2ColumnArgumentDirection = enDev2ColumnArgumentDirection.None, string description = "", IDataListItemModel parent = null, OptomizedObservableCollection<IDataListItemModel> children = null, bool hasError = false, string errorMessage = "", bool isEditable = true, bool isVisable = true, bool isSelected = false, bool isExpanded = true)
 {
     Description = description;
     Parent = parent;
     Children = children;
     HasError = hasError;
     ErrorMessage = errorMessage;
     IsEditable = isEditable;
     IsVisable = isVisable;
     DisplayName = displayname;
     IsSelected = isSelected;
     IsExpanded = isExpanded;
     LastIndexedName = Name;
     IsUsed = true;
     ColumnIODirection = dev2ColumnArgumentDirection;
 }
Example #6
0
 static bool BuildRecordSetErrorMessages(IDataListItemModel model, out string errorMessage)
 {
     errorMessage = "";
     if(RecordSetHasChildren(model))
     {
         if(model.HasError)
         {
             {
                 errorMessage = BuildErrorMessage(model);
                 return true;
             }
         }
         var childErrors = model.Children.Where(child => child.HasError);
         {
             errorMessage = string.Join(Environment.NewLine, childErrors.Select(BuildErrorMessage));
             return true;
         }
     }
     return false;
 }
Example #7
0
 static string BuildErrorMessage(IDataListItemModel model)
 {
     return DataListUtil.AddBracketsToValueIfNotExist(model.DisplayName) + " : " + model.ErrorMessage;
 }
 static IDataListItemModel CreateFieldDataListModel(string fieldName, IDataListItemModel recSetDataModel)
 {
     IDataListItemModel fieldDataListModel = DataListItemModelFactory.CreateDataListModel(fieldName, "", recSetDataModel);
     fieldDataListModel.Name = recSetDataModel.Name + "()." + fieldName;
     return fieldDataListModel;
 }
 private void TestDataListItemModelSet(string name, bool populateAllFields = false, IDataListItemModel parent = null)
 {
     if(populateAllFields)
     {
         _testDataListItemModel = new DataListItemModel(name, enDev2ColumnArgumentDirection.None
                                                      , "Test Description"
                                                      , parent
                                                      , CreateChildren(_testDataListItemModel, 10)
                                                      , false
                                                      , ""
                                                      , true
                                                      , true
                                                      , false
                                                      , false);
     }
     else
     {
         _testDataListItemModel = new DataListItemModel(name);
     }
 }
Example #10
0
 static bool RecordSetHasChildren(IDataListItemModel model)
 {
     return model.IsRecordset && model.Children != null && model.Children.Count > 0;
 }
Example #11
0
 static void FixNamingForScalar(IDataListItemModel scalar)
 {
     if(scalar.DisplayName.Contains("()"))
     {
         scalar.DisplayName = scalar.DisplayName.Replace("()", "");
     }
     FixCommonNamingProblems(scalar);
 }
Example #12
0
        void ValidateRecordsetChildren(IDataListItemModel recset)
        {
            CheckForEmptyRecordset();

            CheckDataListItemsForDuplicates(recset.Children);

            CheckForFixedEmptyRecordsets();
        }
 public static IDataListItemModel CreateDataListModel(string displayname, string description, enDev2ColumnArgumentDirection dev2ColumnArgumentDirection = enDev2ColumnArgumentDirection.None, IDataListItemModel parent = null, OptomizedObservableCollection<IDataListItemModel> children = null, bool hasError = false, string errorMessage = "", bool isEditable = true, bool isVisable = true, bool isSelected = false)
 {
     IDataListItemModel dataListModel = new DataListItemModel(displayname, dev2ColumnArgumentDirection, description, parent, children, hasError, errorMessage, isEditable, isVisable, isSelected);
     return dataListModel;
 }
 public static IDataListItemModel CreateDataListItemViewModel(IDataListViewModel dataListViewModel, string name, string description, IDataListItemModel parent)
 {
     return CreateDataListItemViewModel(dataListViewModel, name, description, parent, true);
 }
 public static IDataListItemModel CreateDataListItemViewModel(IDataListViewModel dataListViewModel, IDataListItemModel parent)
 {
     return CreateDataListItemViewModel(dataListViewModel, string.Empty, string.Empty, parent, true);
 }
Example #16
0
 static void FixCommonNamingProblems(IDataListItemModel recset)
 {
     if(recset.DisplayName.Contains("[") || recset.DisplayName.Contains("]"))
     {
         recset.DisplayName = recset.DisplayName.Replace("[", "").Replace("]", "");
     }
 }
Example #17
0
 static void FixNamingForRecset(IDataListItemModel recset)
 {
     if(!recset.DisplayName.EndsWith("()"))
     {
         recset.DisplayName = string.Concat(recset.DisplayName, "()");
     }
     FixCommonNamingProblems(recset);
 }
Example #18
0
 public void AddBlankRow(IDataListItemModel item)
 {
     if(item != null)
     {
         if(!item.IsRecordset && !item.IsField)
         {
             AddRowToScalars();
         }
         else
         {
             AddRowToRecordsets();
         }
     }
     else
     {
         AddRowToScalars();
         AddRowToRecordsets();
     }
 }
Example #19
0
 static void ProcessFoundRecordSets(IDataListVerifyPart part, IDataListItemModel recsetToRemove, bool isUsed)
 {
     if(string.IsNullOrEmpty(part.Field))
     {
         if(recsetToRemove != null)
         {
             recsetToRemove.IsUsed = isUsed;
         }
     }
     else
     {
         if(recsetToRemove == null) return;
         var childrenToRemove = recsetToRemove.Children.Where(c => c.Name == part.Field && c.IsField);
         childrenToRemove.ToList().ForEach(childToRemove =>
         {
             if(childToRemove != null)
             {
                 childToRemove.IsUsed = isUsed;
             }
         });
     }
 }
Example #20
0
        public void RemoveBlankRows(IDataListItemModel item)
        {
            if(item == null) return;

            if(!item.IsRecordset && !item.IsField)
            {
                RemoveBlankScalars();
            }
            else if(item.IsRecordset)
            {
                RemoveBlankRecordsets();
            }
            else
            {
                RemoveBlankRecordsetFields();
            }
        }
Example #21
0
 void AddItemToBuilder(StringBuilder result, IDataListItemModel recSet)
 {
     result.Append("<");
     result.Append(recSet.Name);
     result.Append(" " + Description + "=\"");
     result.Append(recSet.Description);
     result.Append("\" ");
     result.Append(IsEditable + "=\"");
     result.Append(recSet.IsEditable);
     result.Append("\" ");
     result.Append(GlobalConstants.DataListIoColDirection + "=\"");
     result.Append(recSet.ColumnIODirection);
     result.Append("\" ");
 }
Example #22
0
        public void RemoveDataListItem(IDataListItemModel itemToRemove)
        {
            if(itemToRemove == null) return;

            if(!itemToRemove.IsRecordset && !itemToRemove.IsField)
            {
                ScalarCollection.Remove(itemToRemove);
                CheckDataListItemsForDuplicates(DataList);
            }
            else if(itemToRemove.IsRecordset)
            {
                RecsetCollection.Remove(itemToRemove);
                CheckDataListItemsForDuplicates(DataList);
            }
            else
            {
                foreach(var recset in RecsetCollection)
                {
                    recset.Children.Remove(itemToRemove);
                    CheckDataListItemsForDuplicates(recset.Children);
                }
            }
        }
Example #23
0
        private OptomizedObservableCollection<IDataListItemModel> CreateChildren(IDataListItemModel parent, int numberOfChildrenToCreate)
        {
            OptomizedObservableCollection<IDataListItemModel> children = new OptomizedObservableCollection<IDataListItemModel>();
            for(int i = 1; i <= numberOfChildrenToCreate; i++)
            {
                children.Add(new DataListItemModel("child" + i, enDev2ColumnArgumentDirection.None, "", parent));
            }

            return children;
        }
Example #24
0
        public void ValidateNames(IDataListItemModel item)
        {
            if(item == null) return;

            if(item.IsRecordset)
            {
                ValidateRecordset();
            }
            else if(item.IsField)
            {
                ValidateRecordsetChildren(item.Parent);
            }
            else
            {
                ValidateScalar();
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Object"/> class.
 /// </summary>
 public DataListItemSelectedMessage(IDataListItemModel dataListItemModel)
 {
     DataListItemModel = dataListItemModel;
 }
Example #26
0
 static void AddColumnsToRecordSet(IEnumerable<IDataListItemModel> cols, IDataListItemModel recset)
 {
     foreach(var col in cols)
     {
         col.Parent = recset;
         recset.Children.Add(col);
     }
 }