/// <summary>
 /// Returns select with all filters for current entity.
 /// <param name="select">Select for getting anniversary reminding.</param>
 /// <param name="queryProperty">Query property for current select.</param>
 /// <param name="queryProperty.Key">Anniversary entity schema name</param>
 /// <param name="queryProperty.Value">The property determines type of the decoration.</param>
 /// <returns>Modified select with all filters for current entity.</returns>
 /// </summary>
 protected override Select DecorateSelect(Select select, KeyValuePair <string, string> queryProperty)
 {
     select.And(SchemaName, "StatusId").In(Column.Parameters(Constants.OrderInProgressStatusId,
                                                             Constants.OrderDraftStatusId, Constants.OrderConfirmationStatusId));
     select = AnniversaryRemindingsHelper.JoinTable(select, SchemaName, queryProperty.Key);
     return(select);
 }
        /// <summary>
        /// Returns select with all filters for current entity.
        /// <param name="select">Select for getting anniversary reminding.</param>
        /// <param name="queryProperty">Query property for current select.</param>
        /// <param name="queryProperty.Key">Anniversary entity schema name</param>
        /// <param name="queryProperty.Value">The property determines type of the decoration.</param>
        /// <returns>Modified select with all filters for current entity.</returns>
        /// </summary>
        protected override Select DecorateSelect(Select select, KeyValuePair <string, string> queryProperty)
        {
            switch (queryProperty.Value)
            {
            case "Participant":
                select.Join(JoinType.Inner, SchemaName + "Participant")
                .On(SchemaName, "Id").IsEqual(SchemaName + "Participant", SchemaName + "Id");
                select.Join(JoinType.Inner, "Contact")
                .On("Contact", "Id").IsEqual(SchemaName + "Participant", "ParticipantId");
                break;

            default:
                select = AnniversaryRemindingsHelper.JoinTable(select, SchemaName, queryProperty.Key);
                break;
            }
            select.And("Activity", "DueDate").IsGreaterOrEqual(Column.Parameter(DateTime.UtcNow));
            return(select);
        }
        /// <summary>
        /// Returns select with all filters for current entity.
        /// <param name="select">Select for getting anniversary reminding.</param>
        /// <param name="queryProperty">Query property for current select.</param>
        /// <param name="queryProperty.Key">Anniversary entity schema name</param>
        /// <param name="queryProperty.Value">The property determines type of the decoration.</param>
        /// <returns>Modified select with all filters for current entity.</returns>
        /// </summary>
        protected override Select DecorateSelect(Select select, KeyValuePair <string, string> queryProperty)
        {
            select
            .And()
            .OpenBlock()
            .OpenBlock(SchemaName, "StageId").IsNotEqual(Column
                                                         .Parameter(OpportunityConstants.OpportunityClosedRejectedId))
            .And(SchemaName, "StageId").IsNotEqual(Column
                                                   .Parameter(OpportunityConstants.OpportunityClosedReroutedId))
            .And(SchemaName, "StageId").IsNotEqual(Column
                                                   .Parameter(OpportunityConstants.OpportunityClosedWonId))
            .And(SchemaName, "StageId").IsNotEqual(Column
                                                   .Parameter(OpportunityConstants.OpportunityClosedLostId))
            .CloseBlock()
            .Or()
            .OpenBlock(
                Func.DateDiff(
                    DateDiffQueryFunctionInterval.Month,
                    Column.SourceColumn(SchemaName, "DueDate"),
                    Func.CurrentDateTime()
                    )
                ).IsLessOrEqual(Column.Parameter(ActualPeriod))
            .CloseBlock()
            .CloseBlock();
            switch (queryProperty.Value)
            {
            case "Participant":
                select.Join(JoinType.Inner, SchemaName + "Contact")
                .On(SchemaName, "Id").IsEqual(SchemaName + "Contact", SchemaName + "Id");
                select.Join(JoinType.Inner, "Contact")
                .On("Contact", "Id").IsEqual(SchemaName + "Contact", "ContactId");
                break;

            default:
                select = AnniversaryRemindingsHelper.JoinTable(select, SchemaName, queryProperty.Key);
                break;
            }
            return(select);
        }