/// <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;
 }
Пример #2
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>
        /// 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;