Exemple #1
0
        /// <summary>
        ///     Converts a list of data list item view models to a binary data list.
        /// </summary>
        /// <param name="errorString">The error string.</param>
        /// <returns></returns>
        private IBinaryDataList ConvertIDataListItemModelsToIBinaryDataList(out string errorString)
        {
            errorString = string.Empty;
            IBinaryDataList result = Dev2BinaryDataListFactory.CreateDataList();

            IList <IDataListItemModel> filledScalars =
                ScalarCollection != null?ScalarCollection.Where(scalar => !scalar.IsBlank && !scalar.HasError).ToList() : new List <IDataListItemModel>();

            foreach (var scalar in filledScalars)
            {
                result.TryCreateScalarTemplate
                    (string.Empty, scalar.Name, scalar.Description
                    , true, scalar.IsEditable, scalar.ColumnIODirection, out errorString);
            }

            foreach (var recset in RecsetCollection ?? new OptomizedObservableCollection <IDataListItemModel>())
            {
                if (recset.IsBlank)
                {
                    continue;
                }
                IEnumerable <IDataListItemModel> filledRecordSets = recset.Children.Where(c => !c.IsBlank && !c.HasError);
                IList <Dev2Column> cols = filledRecordSets.Select(child => DataListFactory.CreateDev2Column(child.Name, child.Description, child.IsEditable, child.ColumnIODirection))
                                          .ToList();

                result.TryCreateRecordsetTemplate(recset.Name, recset.Description, cols, true, recset.IsEditable, recset.ColumnIODirection, out errorString);
            }

            return(result);
        }
Exemple #2
0
        public void RemoveBlankScalars()
        {
            IList <IDataListItemModel> blankList = ScalarCollection.Where(c => c.IsBlank).ToList();

            if (blankList.Count > 1)
            {
                ScalarCollection.Remove(blankList.First());
                Validator.Remove(blankList.First());
            }
        }
Exemple #3
0
        public void RemoveBlankScalars()
        {
            List <IDataListItemModel> blankList = ScalarCollection.Where(c => c.IsBlank).ToList();

            if (blankList.Count <= 1)
            {
                return;
            }

            ScalarCollection.Remove(blankList.First());
        }
Exemple #4
0
        private void AddRowToScalars()
        {
            IList <IDataListItemModel> blankList = ScalarCollection.Where(c => c.IsBlank).ToList();

            if (blankList.Count == 0)
            {
                IDataListItemModel scalar = DataListItemModelFactory.CreateDataListModel(string.Empty);
                ScalarCollection.Add(scalar);
                Validator.Add(scalar);
            }
        }
Exemple #5
0
        void ProcessScalarPart(IDataListVerifyPart part)
        {
            var scalarsToRemove = ScalarCollection.Where(c => c.Name == part.Field);

            scalarsToRemove.ToList().ForEach(scalarToRemove =>
            {
                if (scalarToRemove != null)
                {
                    scalarToRemove.IsUsed = false;
                }
            });
        }
Exemple #6
0
        void AddRowToScalars()
        {
            List <IDataListItemModel> blankList = ScalarCollection.Where(c => c.IsBlank).ToList();

            if (blankList.Count != 0)
            {
                return;
            }

            IDataListItemModel scalar = DataListItemModelFactory.CreateDataListModel(string.Empty);

            ScalarCollection.Add(scalar);
        }
Exemple #7
0
        private string GetDataListString()
        {
            StringBuilder result = new StringBuilder("<" + RootTag + ">");

            foreach (var recSet in RecsetCollection.Where(model => !string.IsNullOrEmpty(model.DisplayName)))
            {
                IEnumerable <IDataListItemModel> filledRecordSet = recSet.Children.Where(c => !c.IsBlank && !c.HasError);
                IList <Dev2Column> cols = filledRecordSet.Select(child => DataListFactory.CreateDev2Column(child.DisplayName, child.Description, child.IsEditable, child.ColumnIODirection)).ToList();

                AddItemToBuilder(result, recSet);
                result.Append(">");
                foreach (var col in cols)
                {
                    result.AppendFormat("<{0} {1}=\"{2}\" {3}=\"{4}\" {5}=\"{6}\" />", col.ColumnName
                                        , Description
                                        , col.ColumnDescription
                                        , IsEditable
                                        , col.IsEditable
                                        , GlobalConstants.DataListIoColDirection
                                        , col.ColumnIODirection);
                }
                result.Append("</");
                result.Append(recSet.DisplayName);
                result.Append(">");
            }

            IList <IScalarItemModel> filledScalars = ScalarCollection?.Where(scalar => !scalar.IsBlank && !scalar.HasError).ToList() ?? new List <IScalarItemModel>();

            foreach (var scalar in filledScalars)
            {
                AddItemToBuilder(result, scalar);
                result.Append("/>");
            }
            var complexObjectItemModels = ComplexObjectCollection.Where(model => !string.IsNullOrEmpty(model.DisplayName) && !model.HasError);

            foreach (var complexObjectItemModel in complexObjectItemModels)
            {
                _complexObjectHandler.AddComplexObjectsToBuilder(result, complexObjectItemModel);
            }

            result.Append("</" + RootTag + ">");
            return(result.ToString());
        }
Exemple #8
0
        public void RemoveUnusedDataListItems()
        {
            var unusedScalars = ScalarCollection.Where(c => c.IsUsed == false).ToList();

            if (unusedScalars.Any())
            {
                foreach (var dataListItemModel in unusedScalars)
                {
                    ScalarCollection.Remove(dataListItemModel);
                }
            }
            var unusedRecordsets = RecsetCollection.Where(c => c.IsUsed == false).ToList();

            if (unusedRecordsets.Any())
            {
                foreach (var dataListItemModel in unusedRecordsets)
                {
                    RecsetCollection.Remove(dataListItemModel);
                }
            }
            foreach (var recset in RecsetCollection)
            {
                if (recset.Children.Count > 0)
                {
                    var unusedRecsetChildren = recset.Children.Where(c => c.IsUsed == false).ToList();
                    if (unusedRecsetChildren.Any())
                    {
                        foreach (var unusedRecsetChild in unusedRecsetChildren)
                        {
                            recset.Children.Remove(unusedRecsetChild);
                        }
                    }
                }
            }

            WriteToResourceModel();
            EventPublisher.Publish(new UpdateIntellisenseMessage());
        }