Example #1
0
        private static Rule GetRule(Flow flow, SqlDataReader dr)
        {
            var rule = new Rule(flow, dr.GetGuid(1))
            {
                Id = dr.GetInt32(0),
                Expression = dr.GetString(2),
                Query = dr.IsDBNull(3) ? string.Empty : dr.GetString(3).Replace("\r\n", " "),
                Description = dr.IsDBNull(6) ? string.Empty : dr.GetString(6)
            };
            var trueActionId = dr.IsDBNull(4) ? (int?)null : dr.GetInt32(4);
            var falseActionId = dr.IsDBNull(5) ? (int?)null : dr.GetInt32(5);

            if (trueActionId.HasValue)
            {
                rule.TrueActions.Add(ReadAction(trueActionId, flow));
            }
            if (falseActionId.HasValue)
            {
                rule.FalseActions.Add(ReadAction(falseActionId, flow));
            }

            return rule;
        }
Example #2
0
        private static Rule CreateRule1(Flow flow)
        {
            var rule = new Rule(flow, new Guid("3F7D75DA-FA32-405C-A227-BC40EFF4EB6D"))
            {
                Query = @"
            SELECT  grasscanceldate
            FROM    dbo.tbLoans
            WHERE   LoanNumber = '0000000274'",
                Expression = "new Date('$(grasscanceldate)') > new Date('$(CurrentDate)')"
            };

            rule.Description = "GrassCancelDate is less then today";

            rule.TrueActions.Add(new ExecuteTaskAction(new SendEmailTask(flow, "Serguei Vassiliev <*****@*****.**>")));
            rule.FalseActions.Add(new ExecuteRuleAction(CreateRule2(flow)));

            return rule;
        }
Example #3
0
        private static Rule CreateRule2(Flow flow)
        {
            var rule = new Rule(flow, new Guid("93E93AD7-B2C0-4574-B813-3B01290D8F79"))
            {
                Query = @"
            SELECT  [LoanType] ,
            LoanUnits
            FROM    [COBALT_Test].[dbo].[tbLoans]
            WHERE   LoanNumber = '0001016575'
              ",
                Expression = "('$(LoanType)' === 'FHLM') && ($(LoanUnits) > 1)"
            };

            var asyncTask = CreateAsyncTask1(flow);
            asyncTask.Action = new ExecuteTaskAction(new SendEmailTask(flow, "*****@*****.**"));
            rule.TrueActions.Add(new StartTaskAction(asyncTask));
            return rule;
        }
Example #4
0
File: Flow.cs Project: mparsin/TBMS
 /// <summary>
 /// <see cref="Rule"/> calls this method in order to maintain a transition state, so it can be serialized/deserialized latter
 /// </summary>
 /// <param name="rule">The rule.</param>
 internal void TransitionedTo(Rule rule)
 {
     Transitions.Add(rule.Uid, null);
 }