public RoutingRuleDefinition Copy()
        {
            Server.Application.RoutingRuleDefinition serverRoutingRuleDefinition = (Server.Application.RoutingRuleDefinition)ToServerObject();

            RoutingRuleDefinition copiedRoutingRuleDefinition = new RoutingRuleDefinition(application, serverRoutingRuleDefinition);

            return(copiedRoutingRuleDefinition);
        }
        public void AppendRule(RoutingRuleDefinition ruleDefinition)
        {
            if (!RuleExists(ruleDefinition))
            {
                ruleDefinition.RoutingRuleId = Id;

                ruleDefinition.Sequence = rules.Keys.Count + 1;

                rules.Add(ruleDefinition.Sequence, ruleDefinition);
            }

            return;
        }
        public Boolean RuleExists(RoutingRuleDefinition ruleDefinition)
        {
            Boolean exists = false;

            foreach (Int32 currentSequence in rules.Keys)
            {
                exists = rules[currentSequence].IsEqual(ruleDefinition);

                if (exists)
                {
                    break;
                }
            }

            return(exists);
        }
        public Boolean IsEqual(RoutingRuleDefinition compareDefinition)
        {
            Boolean isEqual = true;

            if (insurerId != compareDefinition.InsurerId)
            {
                isEqual = false;
            }

            if (programId != compareDefinition.ProgramId)
            {
                isEqual = false;
            }

            if (benefitPlanId != compareDefinition.BenefitPlanId)
            {
                isEqual = false;
            }


            if (gender != compareDefinition.Gender)
            {
                isEqual = false;
            }


            if (useAgeCriteria != compareDefinition.UseAgeCriteria)
            {
                isEqual = false;
            }

            if (ageMinimum != compareDefinition.AgeMinimum)
            {
                isEqual = false;
            }

            if (ageMaximum != compareDefinition.AgeMaximum)
            {
                isEqual = false;
            }

            if (isAgeInMonths != compareDefinition.IsAgeInMonths)
            {
                isEqual = false;
            }


            if (ethnicityId != compareDefinition.EthnicityId)
            {
                isEqual = false;
            }

            isEqual &= (languageId == compareDefinition.languageId);


            if (state != compareDefinition.State)
            {
                isEqual = false;
            }

            if (city != compareDefinition.City)
            {
                isEqual = false;
            }


            if (county != compareDefinition.County)
            {
                isEqual = false;
            }

            if (zipCode != compareDefinition.ZipCode)
            {
                isEqual = false;
            }

            if (workQueueId != compareDefinition.WorkQueueId)
            {
                isEqual = false;
            }

            return(isEqual);
        }