/// <summary>
 /// Updates the expanded expression.
 /// </summary>
 /// <param name="expression">The expression.</param>
 /// <param name="claim">The claim.</param>
 /// <param name="paymentTypeBase">The payment type base.</param>
 /// <param name="occurence">The occurence.</param>
 private static void UpdateExpandedExpression(string expression, IEvaluateableClaim claim,
                                              PaymentTypeBase paymentTypeBase, int occurence)
 {
     if (occurence == 0)
     {
         paymentTypeBase.ExpandedExpression = Constants.ThresholdSmartBoxVariables.Where(
             s => claim.SmartBox.GetType().GetProperty(s) != null)
                                              .Aggregate(expression, (current, s) =>
                                                         current.Replace(s,
                                                                         Convert.ToString(claim.SmartBox.GetType().GetProperty(s).GetValue(claim.SmartBox, null))));
     }
     else if (occurence > 0)
     {
         paymentTypeBase.MultiplierExpandedExpression = Constants.ThresholdSmartBoxVariables.Where(
             s => claim.SmartBox.GetType().GetProperty(s) != null)
                                                        .Aggregate(expression, (current, s) =>
                                                                   current.Replace(s,
                                                                                   Convert.ToString(claim.SmartBox.GetType().GetProperty(s).GetValue(claim.SmartBox, null))));
     }
     else
     {
         paymentTypeBase.LimitExpandedExpression = Constants.ThresholdSmartBoxVariables.Where(
             s => claim.SmartBox.GetType().GetProperty(s) != null)
                                                   .Aggregate(expression, (current, s) =>
                                                              current.Replace(s,
                                                                              Convert.ToString(claim.SmartBox.GetType().GetProperty(s).GetValue(claim.SmartBox, null))));
     }
 }
        /// <summary>
        /// Evaluates the expression.
        /// </summary>
        /// <param name="expression">The expression.</param>
        /// <param name="claim">The claim.</param>
        /// <param name="paymentTypeBase">The payment type base.</param>
        /// <param name="occurence">The occurence.</param>
        /// <returns></returns>
        public static double EvaluateExpression(string expression, IEvaluateableClaim claim,
                                                PaymentTypeBase paymentTypeBase, int occurence = 0)
        {
            double threshold = 1;

            UpdateExpandedExpression(expression, claim, paymentTypeBase, occurence);
            try
            {
                var    expresult = (occurence == 0) ? new Expression(paymentTypeBase.ExpandedExpression).Evaluate() : (occurence > 0) ? new Expression(paymentTypeBase.MultiplierExpandedExpression).Evaluate() : new Expression(paymentTypeBase.LimitExpandedExpression).Evaluate();
                double output;
                if (double.TryParse(expresult.ToString(), out output))
                {
                    threshold = Math.Round(Convert.ToDouble(expresult), 4);

                    if (double.IsInfinity(threshold) || double.IsNaN(threshold))
                    {
                        threshold = 1;
                        UpdateFormulaError(paymentTypeBase, occurence);
                    }
                }
                else
                {
                    threshold = 1;
                    UpdateFormulaError(paymentTypeBase, occurence);
                }
            }
            catch (Exception)
            {
                UpdateFormulaError(paymentTypeBase, occurence);
            }
            if (occurence > 0)
            {
                paymentTypeBase.MultiplierExpressionResult = threshold;
                paymentTypeBase.Multiplier = occurence;
            }
            else if (occurence < 0)
            {
                paymentTypeBase.LimitExpressionResult = threshold;
            }
            else
            {
                paymentTypeBase.FormulaExpressionResult = threshold;
            }

            return(threshold);
        }
 /// <summary>
 /// Updates the formula error.
 /// </summary>
 /// <param name="paymentTypeBase">The payment type base.</param>
 /// <param name="occurence">The occurence.</param>
 private static void UpdateFormulaError(PaymentTypeBase paymentTypeBase, int occurence)
 {
     if (occurence == 0)
     {
         paymentTypeBase.IsFormulaError = true;
     }
     else if (occurence > 0)
     {
         paymentTypeBase.IsMultiplierFormulaError = true;
         paymentTypeBase.IsFormulaError           = true;
     }
     else
     {
         paymentTypeBase.IsLimitError   = true;
         paymentTypeBase.IsFormulaError = true;
     }
 }
Exemple #4
0
        /// <summary>
        /// Evaluates the expression.
        /// </summary>
        /// <param name="expression">The expression.</param>
        /// <param name="claim">The claim.</param>
        /// <param name="paymentTypeBase">The payment type base.</param>
        /// <returns></returns>
        public double EvaluateExpression(string expression, IEvaluateableClaim claim,
                                         PaymentTypeBase paymentTypeBase)
        {
            double threshold = 1;

            paymentTypeBase.ExpandedExpression = Constants.ThresholdSmartBoxVariables.Where(
                s => claim.SmartBox.GetType().GetProperty(s) != null)
                                                 .Aggregate(expression, (current, s) =>
                                                            current.Replace(s,
                                                                            Convert.ToString(claim.SmartBox.GetType().GetProperty(s).GetValue(claim.SmartBox, null))));
            try
            {
                var    expresult = new Expression(paymentTypeBase.ExpandedExpression).Evaluate();
                double output;
                if (double.TryParse(expresult.ToString(), out output))
                {
                    threshold = Math.Round(Convert.ToDouble(expresult), 4);

                    if (double.IsInfinity(threshold) || double.IsNaN(threshold))
                    {
                        threshold = 1;
                        paymentTypeBase.IsFormulaError = true;
                    }
                }
                else
                {
                    threshold = 1;
                    paymentTypeBase.IsFormulaError = true;
                }
            }
            catch (Exception)
            {
                paymentTypeBase.IsFormulaError = true;
            }

            return(threshold);
        }
 public override PaymentTypeBase GetPaymentType(PaymentTypeBase paymentType)
 {
     return(_paymentTypeCustomTableRepository.GetPaymentTypeCustomTableDetails((PaymentTypeCustomTable)paymentType));
 }
 /// <summary>
 /// Adds the type of the edit payment.
 /// </summary>
 /// <param name="paymentType">Type of the payment.</param>
 /// <returns></returns>
 public override long AddEditPaymentType(PaymentTypeBase paymentType)
 {
     return(_paymentTypeCustomTableRepository.AddEdit((PaymentTypeCustomTable)paymentType));
 }
Exemple #7
0
 /// <summary>
 /// Gets the type of the payment.
 /// </summary>
 /// <param name="paymentType">Type of the payment.</param>
 /// <returns></returns>
 public abstract PaymentTypeBase GetPaymentType(PaymentTypeBase paymentType);
 /// <summary>
 /// Gets the type of the payment.
 /// </summary>
 /// <param name="paymentType">Type of the payment.</param>
 /// <returns></returns>
 public override PaymentTypeBase GetPaymentType(PaymentTypeBase paymentType)
 {
     return(_paymentTypeDrgPaymentRepository.GetPaymentTypeDrgPayment((PaymentTypeDrg)paymentType));
 }
Exemple #9
0
 /// <summary>
 /// Gets the type of the payment.
 /// </summary>
 /// <param name="paymentType">Type of the payment.</param>
 /// <returns></returns>
 public override PaymentTypeBase GetPaymentType(PaymentTypeBase paymentType)
 {
     return(_medicareOpDetailsRepository.GetPaymentTypeMedicareOpDetails((PaymentTypeMedicareOp)paymentType));
 }
Exemple #10
0
 /// <summary>
 /// Gets the type of the payment.
 /// </summary>
 /// <param name="paymentType">Type of the payment.</param>
 /// <returns></returns>
 public override PaymentTypeBase GetPaymentType(PaymentTypeBase paymentType)
 {
     return(_paymentTypePercentageDiscountDetailsRepository.GetPaymentTypePercentageDiscountDetails((PaymentTypePercentageCharge)paymentType));
 }
 /// <summary>
 /// Adds the type of the edit payment.
 /// </summary>
 /// <param name="paymentType">Type of the payment.</param>
 /// <returns></returns>
 public override long AddEditPaymentType(PaymentTypeBase paymentType)
 {
     return(_paymentTypeFeeScheduleRepository.AddEditPaymentTypeFeeSchedule((PaymentTypeFeeSchedule)paymentType));
 }
 /// <summary>
 /// Gets the type of the payment.
 /// </summary>
 /// <param name="paymentType">Type of the payment.</param>
 /// <returns></returns>
 public override PaymentTypeBase GetPaymentType(PaymentTypeBase paymentType)
 {
     return(_paymentTypeStopLossRepository.GetPaymentTypeStopLoss((PaymentTypeStopLoss)paymentType));
 }
 /// <summary>
 /// Adds the type of the edit payment.
 /// </summary>
 /// <param name="paymentType">Type of the payment.</param>
 /// <returns></returns>
 public override long AddEditPaymentType(PaymentTypeBase paymentType)
 {
     return(_paymentTypeStopLossRepository.AddEditPaymentTypeStopLoss((PaymentTypeStopLoss)paymentType));
 }
Exemple #14
0
 /// <summary>
 /// Gets the type of the payment.
 /// </summary>
 /// <param name="paymentType">Type of the payment.</param>
 /// <returns></returns>
 public override PaymentTypeBase GetPaymentType(PaymentTypeBase paymentType)
 {
     return(_paymentTypeCapDetailsRepository.GetPaymentTypeCapDetails((PaymentTypeCap)paymentType));
 }
Exemple #15
0
 /// <summary>
 /// Gets the type of the payment.
 /// </summary>
 /// <param name="paymentType">Type of the payment.</param>
 /// <returns></returns>
 public override PaymentTypeBase GetPaymentType(PaymentTypeBase paymentType)
 {
     return(_paymentTypeLesserOfRepository.GetLesserOfPercentage((PaymentTypeLesserOf)paymentType));
 }
Exemple #16
0
 /// <summary>
 /// Adds the type of the edit payment.
 /// </summary>
 /// <param name="paymentType">Type of the payment.</param>
 /// <returns></returns>
 public override long AddEditPaymentType(PaymentTypeBase paymentType)
 {
     return(_paymentTypeLesserOfRepository.AddEditPaymentTypeLesserOf((PaymentTypeLesserOf)paymentType));
 }
 /// <summary>
 /// Adds the type of the edit payment.
 /// </summary>
 /// <param name="paymentType">Type of the payment.</param>
 /// <returns></returns>
 public override long AddEditPaymentType(PaymentTypeBase paymentType)
 {
     return(_paymentTypePerDiemDetailsRepository.AddEditPaymentTypePerDiemDetails((PaymentTypePerDiem)paymentType));
 }
 /// <summary>
 /// Gets the type of the payment.
 /// </summary>
 /// <param name="paymentType">Type of the payment.</param>
 /// <returns></returns>
 public override PaymentTypeBase GetPaymentType(PaymentTypeBase paymentType)
 {
     return(_paymentTypePerDiemDetailsRepository.GetPaymentTypePerDiem((PaymentTypePerDiem)paymentType));
 }
 /// <summary>
 /// Gets the type of the payment.
 /// </summary>
 /// <param name="paymentType">Type of the payment.</param>
 /// <returns></returns>
 public override PaymentTypeBase GetPaymentType(PaymentTypeBase paymentType)
 {
     return(_paymentTypeFeeScheduleRepository.GetPaymentTypeFeeSchedule((PaymentTypeFeeSchedule)paymentType));
 }
Exemple #20
0
 /// <summary>
 /// Adds the type of the edit payment.
 /// </summary>
 /// <param name="paymentType">Type of the payment.</param>
 /// <returns></returns>
 public override long AddEditPaymentType(PaymentTypeBase paymentType)
 {
     return(_medicareOpDetailsRepository.AddEditPaymentTypeMedicareOpPayment((PaymentTypeMedicareOp)paymentType));
 }
Exemple #21
0
 /// <summary>
 /// Adds the type of the edit payment.
 /// </summary>
 /// <param name="paymentType">Type of the payment.</param>
 /// <returns></returns>
 /// FIXED-JAN-AA The payment type's CRUD operations also can be fitted into the PaymentTypeBase interface for uniformity. This will ensure that the interfacing is complete.
 public override long AddEditPaymentType(PaymentTypeBase paymentType)
 {
     return(_paymentTypeAscFeeScheduleDetailsRepository.AddEditPaymentTypeAscFeeScheduleDetails((PaymentTypeAscFeeSchedule)paymentType));
 }
 /// <summary>
 /// Adds the type of the edit payment.
 /// </summary>
 /// <param name="paymentType">Type of the payment.</param>
 /// <returns></returns>
 public override long AddEditPaymentType(PaymentTypeBase paymentType)
 {
     return(_paymentTypeDrgPaymentRepository.AddEditPaymentTypeDrgPayment((PaymentTypeDrg)paymentType));
 }
 /// <summary>
 /// Gets the type of the payment.
 /// </summary>
 /// <param name="paymentType">Type of the payment.</param>
 /// <returns></returns>
 public override PaymentTypeBase GetPaymentType(PaymentTypeBase paymentType)
 {
     return(_paymentTypeMedicareSequesterRepository.GetPaymentTypeMedicareSequester((PaymentTypeMedicareSequester)paymentType));
 }
Exemple #24
0
 /// <summary>
 /// Gets the type of the payment.
 /// </summary>
 /// <param name="paymentType">Type of the payment.</param>
 /// <returns></returns>
 /// FIXED-JAN-AA The payment type's CRUD operations also can be fitted into the PaymentTypeBase interface for uniformity. This will ensure that the interfacing is complete.
 public override PaymentTypeBase GetPaymentType(PaymentTypeBase paymentType)
 {
     return(_paymentTypeAscFeeScheduleDetailsRepository.GetPaymentTypeAscFeeScheduleDetails((PaymentTypeAscFeeSchedule)paymentType));
 }
Exemple #25
0
 /// <summary>
 /// Adds the type of the edit payment.
 /// </summary>
 /// <param name="paymentType">Type of the payment.</param>
 /// <returns></returns>
 public abstract long AddEditPaymentType(PaymentTypeBase paymentType);
 /// <summary>
 /// Adds the type of the edit payment.
 /// </summary>
 /// <param name="paymentType">Type of the payment.</param>
 /// <returns></returns>
 public override long AddEditPaymentType(PaymentTypeBase paymentType)
 {
     return(_medicareLabFeeScheduleDetailsRepository.AddEditPaymentTypeMedicareLabFeeSchedulePayment((PaymentTypeMedicareLabFeeSchedule)paymentType));
 }
 /// <summary>
 /// Adds the type of the edit payment.
 /// </summary>
 /// <param name="paymentType">Type of the payment.</param>
 /// <returns></returns>
 public override long AddEditPaymentType(PaymentTypeBase paymentType)
 {
     return(_paymentTypeMedicareSequesterRepository.AddEditPaymentTypeMedicareSequester((PaymentTypeMedicareSequester)paymentType));
 }