示例#1
0
        /// <summary>
        /// This method returns the Changes Set
        /// </summary>
        public static ChangesSet GetChangesSet(List <ExcludeInfo> originalValues, List <ExcludeInfo> currentValues)
        {
            // initial value
            ChangesSet changesSet = new ChangesSet();

            // if both lists of objects have items
            if (ListHelper.HasOneOrMoreItems(originalValues, currentValues))
            {
                // Iterate the collection of ExcludeInfo objects
                foreach (ExcludeInfo original in originalValues)
                {
                    // find the current value of this type
                    ExcludeInfo current = currentValues.FirstOrDefault(x => x.TableId == original.TableId && x.ObjectType == original.ObjectType && x.FieldId == original.FieldId);

                    // If the current object exists and the values for Exclude are different
                    if ((NullHelper.Exists(current)) && (current.Exclude != original.Exclude))
                    {
                        // Add this change
                        changesSet.Changes.Add(current);
                    }
                }
            }

            // return value
            return(changesSet);
        }
示例#2
0
        /// <summary>
        /// method returns a list of integer values to represent the Exclude values
        /// </summary>
        public static List <ExcludeInfo> GetObjectValues(List <DTNTable> tables)
        {
            // initial value
            List <ExcludeInfo> values = new List <ExcludeInfo>();

            // local
            ExcludeInfo excludeInfo = null;

            // If the tables collection exists and has one or more items
            if (ListHelper.HasOneOrMoreItems(tables))
            {
                // Iterate the collection of DTNTable objects
                foreach (DTNTable table in tables)
                {
                    // set the excludeInfo
                    excludeInfo = new ExcludeInfo();

                    // Set the value for Exclude
                    excludeInfo.Exclude = table.Exclude;

                    // Set the ObjectType
                    excludeInfo.ObjectType = ExcludeObjectTypeEnum.Table;

                    // Set the TableId
                    excludeInfo.TableId = table.TableId;

                    // Add this value
                    values.Add(excludeInfo);

                    // if the Fields collection exists
                    if (table.HasFields)
                    {
                        // iterate the fields
                        foreach (DTNField field in table.Fields)
                        {
                            // set the excludeInfo
                            excludeInfo = new ExcludeInfo();

                            // Set the value for Exclude
                            excludeInfo.Exclude = field.Exclude;

                            // Set the ObjectType
                            excludeInfo.ObjectType = ExcludeObjectTypeEnum.Field;

                            // Set the FieldId
                            excludeInfo.TableId = table.TableId;
                            excludeInfo.FieldId = field.FieldId;

                            // Add this value
                            values.Add(excludeInfo);
                        }
                    }
                }
            }

            // return value
            return(values);
        }