Exemple #1
0
        /// <summary>
        /// Adds the sub table relation.
        /// </summary>
        /// <param name="querytable">
        /// The querytable.
        /// </param>
        /// <param name="relation">
        /// The relation.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public bool AddSubTableRelation(UPConfigQueryTable querytable, string relation)
        {
            var table = new UPContainerInfoAreaMetaInfo(querytable);

            if (relation != null)
            {
                table.ParentRelation = relation;
            }

            if (this.subTables == null)
            {
                this.subTables = new List <UPContainerInfoAreaMetaInfo>();
            }

            this.subTables.Add(table);
            var count = querytable.NumberOfSubTables;

            for (var i = 0; i < count; i++)
            {
                var subQueryTable     = querytable.SubTableAtIndex(i);
                var subParentRelation = subQueryTable.ParentRelation;
                if (string.IsNullOrEmpty(subParentRelation))
                {
                    subParentRelation = relation;
                }

                table.AddSubTableRelation(subQueryTable, subParentRelation);
            }

            return(true);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="UPInfoAreaORDateTimeCondition"/> class.
 /// </summary>
 /// <param name="infoAreaMetaInfo">
 /// The information area meta information.
 /// </param>
 /// <param name="condition">
 /// The condition.
 /// </param>
 public UPInfoAreaORDateTimeCondition(UPContainerInfoAreaMetaInfo infoAreaMetaInfo, UPInfoAreaDateTimeCondition condition)
     : base(infoAreaMetaInfo)
 {
     this.Conditions = new List <UPInfoAreaDateTimeCondition> {
         condition
     };
 }
Exemple #3
0
        /// <summary>
        /// Adds the table.
        /// </summary>
        /// <param name="table">
        /// The table.
        /// </param>
        public void AddTable(UPContainerInfoAreaMetaInfo table)
        {
            if (this.subTables == null)
            {
                this.subTables = new List <UPContainerInfoAreaMetaInfo>();
            }

            this.subTables.Add(table);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="UPInfoAreaANDDateTimeCondition"/> class.
 /// </summary>
 /// <param name="infoAreaMetaInfo">
 /// The information area meta information.
 /// </param>
 /// <param name="single1">
 /// The single1.
 /// </param>
 /// <param name="single2">
 /// The single2.
 /// </param>
 public UPInfoAreaANDDateTimeCondition(
     UPContainerInfoAreaMetaInfo infoAreaMetaInfo,
     UPInfoAreaSingleDateTimeCondition single1,
     UPInfoAreaSingleDateTimeCondition single2)
     : base(infoAreaMetaInfo)
 {
     this.SingleConditions = new List <UPInfoAreaSingleDateTimeCondition> {
         single1, single2
     };
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="UPInfoAreaSingleDateTimeCondition"/> class.
 /// </summary>
 /// <param name="infoAreaMetaInfo">
 /// The information area meta information.
 /// </param>
 /// <param name="dateFieldId">
 /// The date field identifier.
 /// </param>
 /// <param name="timeFieldId">
 /// The time field identifier.
 /// </param>
 /// <param name="dateFieldCondition">
 /// The date field condition.
 /// </param>
 /// <param name="parentCondition">
 /// The parent condition.
 /// </param>
 public UPInfoAreaSingleDateTimeCondition(
     UPContainerInfoAreaMetaInfo infoAreaMetaInfo,
     int dateFieldId,
     int timeFieldId,
     UPInfoAreaConditionLeaf dateFieldCondition,
     UPInfoAreaConditionTree parentCondition)
     : base(infoAreaMetaInfo)
 {
     this.DateCondition   = dateFieldCondition;
     this.ParentCondition = parentCondition;
     this.DateFieldId     = dateFieldId;
     this.TimeFieldId     = timeFieldId;
 }
Exemple #6
0
        /// <summary>
        /// Dates the time condition for information area parent.
        /// </summary>
        /// <param name="infoArea">
        /// The information area.
        /// </param>
        /// <param name="parent">
        /// The parent.
        /// </param>
        /// <returns>
        /// The <see cref="UPInfoAreaDateTimeCondition"/>.
        /// </returns>
        public override UPInfoAreaDateTimeCondition DateTimeConditionForInfoAreaParent(
            UPContainerInfoAreaMetaInfo infoArea,
            UPInfoAreaConditionTree parent)
        {
            if (this.conditions == null)
            {
                return(null);
            }

            UPInfoAreaDateTimeCondition combinedCondition = null;

            if (this.relation == "AND")
            {
                foreach (var cond in this.conditions)
                {
                    var dateTimeCond = cond.DateTimeConditionForInfoAreaParent(infoArea, this);
                    if (dateTimeCond != null)
                    {
                        combinedCondition =
                            UPInfoAreaDateTimeCondition.ConditionByANDCombiningConditionWithCondition(
                                dateTimeCond,
                                combinedCondition);
                    }
                }
            }
            else
            {
                foreach (var cond in this.conditions)
                {
                    var dateTimeCond = cond.DateTimeConditionForInfoAreaParent(infoArea, this);
                    if (dateTimeCond != null || combinedCondition != null)
                    {
                        combinedCondition =
                            UPInfoAreaDateTimeCondition.ConditionByOrCombiningConditionWithCondition(
                                dateTimeCond,
                                combinedCondition);
                    }
                }
            }

            return(combinedCondition);
        }
        /// <summary>
        /// Adds the child node key.
        /// </summary>
        /// <param name="treeNode">The tree node.</param>
        /// <param name="key">The key.</param>
        /// <returns></returns>
        public UPContainerMetaInfoAreaTreeNode AddChildNodeKey(UPContainerInfoAreaMetaInfo treeNode, string key)
        {
            var childNode = new UPContainerMetaInfoAreaTreeNode(treeNode, key);

            if (this.Children == null)
            {
                this.Children = new Dictionary <string, UPContainerMetaInfoAreaTreeNode>
                {
                    { childNode.Key, childNode }
                };

                this.OrderedChildren = new List <UPContainerMetaInfoAreaTreeNode>()
                {
                    childNode
                };
            }
            else
            {
                this.Children[childNode.Key] = childNode;
                this.OrderedChildren.Add(childNode);
            }

            return(childNode);
        }
Exemple #8
0
        /// <summary>
        /// Adds the field.
        /// </summary>
        /// <param name="field">
        /// The field.
        /// </param>
        /// <returns>
        /// The <see cref="int"/>.
        /// </returns>
        public int AddField(UPContainerFieldMetaInfo field)
        {
            if (field.InfoAreaIdWithLink != this.InfoAreaIdWithLink)
            {
                if (this.subTables != null)
                {
                    foreach (var subTable in this.subTables)
                    {
                        if (field.InfoAreaIdWithLink.Equals(subTable.InfoAreaIdWithLink))
                        {
                            return(subTable.AddField(field));
                        }
                    }
                }

                var addSubTable = new UPContainerInfoAreaMetaInfo(field.InfoAreaId, field.LinkId)
                {
                    ParentRelation = "PLUS"
                };

                if (this.subTables == null)
                {
                    this.subTables = new List <UPContainerInfoAreaMetaInfo> {
                        addSubTable
                    };
                }
                else
                {
                    this.subTables.Add(addSubTable);
                }

                return(addSubTable.AddField(field));
            }

            return(this.AddFieldWithoutChildCheck(field));
        }
        /// <summary>
        /// Dates the time condition for information area parent.
        /// </summary>
        /// <param name="infoArea">The information area.</param>
        /// <param name="parent">The parent.</param>
        /// <returns></returns>
        public override UPInfoAreaDateTimeCondition DateTimeConditionForInfoAreaParent(UPContainerInfoAreaMetaInfo infoArea, UPInfoAreaConditionTree parent)
        {
            if (!this.IsSingle || this.FirstValue?.Length < 2)
            {
                return(null);
            }

            var fieldInfo = UPCRMDataStore.DefaultStore.FieldInfoForInfoAreaFieldId(this._infoAreaId, this.FieldIndex);

            if (fieldInfo.IsDateField)
            {
                var timeFieldId = fieldInfo.TimeFieldId;
                if (timeFieldId >= 0)
                {
                    return(new UPInfoAreaSingleDateTimeCondition(infoArea, this.FieldIndex, timeFieldId, this, parent));
                }
            }
            else if (fieldInfo.IsTimeField)
            {
                var dateFieldId = fieldInfo.DateFieldId;
                if (dateFieldId >= 0)
                {
                    return(new UPInfoAreaSingleDateTimeCondition(infoArea, dateFieldId, this.FieldIndex, this, parent));
                }
            }

            return(null);
        }
 /// <summary>
 /// Dates the time condition for information area parent.
 /// </summary>
 /// <param name="infoArea">
 /// The information area.
 /// </param>
 /// <param name="parent">
 /// The parent.
 /// </param>
 /// <returns>
 /// The <see cref="UPInfoAreaDateTimeCondition"/>.
 /// </returns>
 public virtual UPInfoAreaDateTimeCondition DateTimeConditionForInfoAreaParent(
     UPContainerInfoAreaMetaInfo infoArea,
     UPInfoAreaConditionTree parent) => null;
 /// <summary>
 /// Initializes a new instance of the <see cref="UPContainerMetaInfoAreaTreeNode"/> class.
 /// </summary>
 /// <param name="node">The node.</param>
 /// <param name="key">The key.</param>
 public UPContainerMetaInfoAreaTreeNode(UPContainerInfoAreaMetaInfo node, string key)
 {
     this.Node = node;
     this.Key  = key;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="UPInfoAreaDateTimeCondition"/> class.
 /// </summary>
 /// <param name="infoAreaMetaInfo">
 /// The _info area meta information.
 /// </param>
 public UPInfoAreaDateTimeCondition(UPContainerInfoAreaMetaInfo infoAreaMetaInfo)
 {
     this.InfoAreaMetaInfo = infoAreaMetaInfo;
 }