Ejemplo n.º 1
0
        /// <summary>
        /// Rule ID 8
        /// </summary>
        /// <param name="claimID"></param>
        /// <param name="expenseID"></param>
        /// <returns></returns>
        public static bool specificExpenseTypePerCarrier(int clientID, int claimID, int expenseID)
        {
            int carrierID = 0;
            bool isRuleMet = false;
            List<BusinessRule> rules = null;
            string[] properties = {"CarrierID", "ExpenseTypeID"};
            string[] values = null;

            // get carrier associated with claim/policy
            using (ClaimManager repository = new ClaimManager()) {
                carrierID = repository.GetCarrier(claimID);
            }

            if (carrierID > 0 && rules != null && rules.Count > 0) {
                // build value array
                values = new string[] { carrierID.ToString(), expenseID.ToString()};

                foreach (BusinessRule rule in rules) {
                    XElement ruleXML = XElement.Parse(rule.RuleXML);

                    isRuleMet = testRule(ruleXML, properties, values);

                    if (isRuleMet) {
                        // add exception to queue
                    }
                }
            }

            return isRuleMet;
        }
        public RuleException TestRule(int clientID, Claim claim, int expenseTypeID)
        {
            int carrierID = 0;
            bool isRuleMet = false;

            // get carrier associated with claim/policy
            using (ClaimManager repository = new ClaimManager()) {
                carrierID = repository.GetCarrier(claim.ClaimID);
            }

            // get business rules for client/rule type id
            using (BusinessRuleManager repository = new BusinessRuleManager()) {
                rules = repository.GetBusinessRules(clientID, Globals.RuleType.SpecificExpenseTypePerCarrier);
            }

            if (carrierID > 0 && expenseTypeID > 0 && rules != null && rules.Count > 0) {
                // build value array
                values = new string[] { carrierID.ToString(), expenseTypeID.ToString() };

                foreach (BusinessRule rule in rules) {
                    XElement ruleXML = XElement.Parse(rule.RuleXML);

                    isRuleMet = base.TestRule(ruleXML, properties, values);

                    if (isRuleMet) {
                        // add exception to queue
                        ruleException = new RuleException();

                        ruleException.BusinessRuleID = rule.BusinessRuleID;

                        ruleException.ClientID = clientID;

                        ruleException.ObjectID = claim.ClaimID;

                        ruleException.ObjectTypeID = (int)Globals.ObjectType.Claim;

                        break;
                    }
                }
            }

            return ruleException;
        }