public RuleException TestRule(int clientID, Claim claim)
        {
            string claimLimit = null;
            bool isRuleMet = false;
            int numberOfClaims = 0;
            int numberOfClaimsLimit = 0;

            // skip if no adjuster assigned to claim
            if ((claim.AdjusterID ?? 0) == 0)
                return null;

            // get number of claims assigned to adjuster
            numberOfClaims = ClaimsManager.getAdjusterClaimCount((int)claim.AdjusterID);

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

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

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

                    XElement adjusterCondition = base.GetElement(ruleXML, "AdjusterID", claim.AdjusterID.ToString());

                    claimLimit = base.GetElementValue(ruleXML, "Claim");

                    if (adjusterCondition != null && !string.IsNullOrEmpty(claimLimit)) {
                        if (int.TryParse(claimLimit, out numberOfClaimsLimit) && numberOfClaimsLimit > 0) {

                            isRuleMet = (numberOfClaims <= numberOfClaimsLimit);
                        }
                    }

                    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 this.ruleException;
        }
        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;
        }
        private void bindBusinessRules()
        {
            int clientID = SessionHelper.getClientId();
            List<BusinessRule> rules = null;

            using (BusinessRuleManager repository = new BusinessRuleManager())
            {
                rules = repository.GetBusinessRules(clientID);
                }

            gvBsuinessRules.DataSource = rules;
            gvBsuinessRules.DataBind();
        }
        private void bindBusinessRules(int ruleTypeID)
        {
            List<BusinessRule> rules = null;

            using (BusinessRuleManager repository = new BusinessRuleManager())
            {
                rules = repository.GetBusinessRules(ruleTypeID);
            }

            gvBsuinessRules.DataSource = rules;
            gvBsuinessRules.DataBind();
        }
Beispiel #5
0
        static void processClaimAssignmentReview()
        {
            List<Claim> claims = null;
            List<BusinessRule> rules = null;
            RuleException ruleException = null;

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

            if (rules != null && rules.Count > 0) {
                foreach (BusinessRule rule in rules) {
                    using (ClaimAssignmentReview ruleEngine = new ClaimAssignmentReview()) {
                        claims = ruleEngine.TestRule(rule);

                        if (claims != null && claims.Count > 0) {
                            using (TransactionScope scope = new TransactionScope()) {
                                try {
                                    foreach (Claim claim in claims) {
                                        // check exception already exists for this claim
                                        bool exceptionExists = ruleEngine.ExceptionExists((int)rule.ClientID, rule.BusinessRuleID, claim.ClaimID, (int)Globals.ObjectType.Claim);

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

                                            ruleException.BusinessRuleID = rule.BusinessRuleID;

                                            ruleException.ClientID = rule.ClientID;

                                            ruleException.ObjectID = claim.ClaimID;

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

                                            ruleException.UserID = null;

                                            ruleEngine.AddException(ruleException);
                                            //chetu code

                                            CheckSendMail(ruleException);

                                        }
                                    }

                                    // commit transaction
                                    scope.Complete();
                                }
                                catch (Exception ex) {
                                    Core.EmailHelper.emailError(ex);
                                }
                            }
                        }			// if (claims != null && claims.Count > 0)
                    }				// using (ClaimAssignmentReview ruleEngine = new ClaimAssignmentReview())
                }	// foreach
            } // if
        }