/// <summary> /// Befores the date condition including time zone. /// </summary> /// <param name="date"> /// The date. /// </param> /// <param name="including"> /// if set to <c>true</c> [including]. /// </param> /// <param name="timeZone"> /// The time zone. /// </param> /// <returns> /// The <see cref="UPInfoAreaCondition"/>. /// </returns> public UPInfoAreaCondition BeforeDateCondition(DateTime date, bool including, UPCRMTimeZone timeZone) { string limitTime = timeZone.GetAdjustedCurrentMMTime(date); string limitDate = timeZone.GetAdjustedCurrentMMDate(date); if (limitTime == "0000" && !including) { return(new UPInfoAreaConditionLeaf(this.InfoAreaMetaInfo.InfoAreaId, this.DateFieldId, "<", limitDate)); } if (limitTime == "2359" && including) { return(new UPInfoAreaConditionLeaf(this.InfoAreaMetaInfo.InfoAreaId, this.DateFieldId, "<=", limitDate)); } var timeCondition = new UPInfoAreaConditionLeaf( this.InfoAreaMetaInfo.InfoAreaId, this.TimeFieldId, including ? "<=" : "<", limitTime); var dateCondition = new UPInfoAreaConditionLeaf( this.InfoAreaMetaInfo.InfoAreaId, this.DateFieldId, limitDate); var beforeDateCondition = new UPInfoAreaConditionLeaf( this.InfoAreaMetaInfo.InfoAreaId, this.DateFieldId, "<", limitDate); var cond = timeCondition.InfoAreaConditionByAppendingAndCondition(dateCondition); return(cond.InfoAreaConditionByAppendingOrCondition(beforeDateCondition)); }
/// <summary> /// Wholes the day condition for time zone. /// </summary> /// <param name="startDate"> /// The Start date. /// </param> /// <param name="timeZone"> /// The time zone. /// </param> /// <returns> /// The <see cref="UPInfoAreaCondition"/>. /// </returns> public UPInfoAreaCondition WholeDayConditionForTimeZone(DateTime startDate, UPCRMTimeZone timeZone) { var infoAreaId = this.InfoAreaMetaInfo.InfoAreaId; var timeString = timeZone.GetAdjustedCurrentMMTime(startDate); if (timeString == "0000") { return(new UPInfoAreaConditionLeaf( infoAreaId, this.DateFieldId, timeZone.GetAdjustedCurrentMMDate(startDate))); } var date1 = new UPInfoAreaConditionLeaf( infoAreaId, this.DateFieldId, timeZone.GetAdjustedCurrentMMDate(startDate)); var time1 = new UPInfoAreaConditionLeaf(infoAreaId, this.TimeFieldId, ">=", timeString); var date2 = new UPInfoAreaConditionLeaf( infoAreaId, this.DateFieldId, timeZone.GetAdjustedCurrentMMDate(startDate.AddSeconds(60 * 60 * 24))); var time2 = new UPInfoAreaConditionLeaf(infoAreaId, this.TimeFieldId, "<", timeString); var fromCondition = date1.InfoAreaConditionByAppendingAndCondition(time1); var toCondition = date2.InfoAreaConditionByAppendingAndCondition(time2); return(fromCondition.InfoAreaConditionByAppendingOrCondition(toCondition)); }
/// <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; }