コード例 #1
0
        public ActionResult PaymentTypeLesserOf(long?contractId, long?serviceTypeId, int paymentTypeId, bool isEdit)
        {
            //To show default percentage as 100
            PaymentTypeLesserOfViewModel paymentTypeLesserOfViewModel = new PaymentTypeLesserOfViewModel
            {
                Percentage = Constants.PaymentTypeLesserOfPercentage
            };

            if (isEdit)
            {
                PaymentTypeLesserOf paymentTypeLesserOfForPost = new PaymentTypeLesserOf
                {
                    ServiceTypeId = serviceTypeId,
                    ContractId    = contractId,
                    PaymentTypeId = paymentTypeId,
                    UserName      = GetCurrentUserName()
                };

                //Get the Name of User logged in
                PaymentTypeLesserOf paymentTypeLesserOf = PostApiResponse <PaymentTypeLesserOf>("PaymentTypeLesserOf",
                                                                                                "GetLesserOfPercentage", paymentTypeLesserOfForPost);
                paymentTypeLesserOfViewModel = AutoMapper.Mapper.Map <PaymentTypeLesserOf, PaymentTypeLesserOfViewModel>(paymentTypeLesserOf);
            }
            paymentTypeLesserOfViewModel.PaymentTypeId = (byte)Enums.PaymentTypeCodes.LesserOf;
            paymentTypeLesserOfViewModel.ServiceTypeId = serviceTypeId;
            paymentTypeLesserOfViewModel.ContractId    = contractId;
            paymentTypeLesserOfViewModel.IsEdit        = isEdit;
            return(View(paymentTypeLesserOfViewModel));
        }
コード例 #2
0
        /// <summary>
        /// Gets the type of the payment.
        /// </summary>
        /// <param name="contractId">The contract identifier.</param>
        /// <param name="contractServiceTypeId">The contract service type identifier.</param>
        /// <param name="lesserOfPercentage">The lesser of percentage.</param>
        /// <returns></returns>
        public static PaymentTypeLesserOf GetPaymentType(long?contractId, long?contractServiceTypeId, DataTable lesserOfPercentage)
        {
            PaymentTypeLesserOf paymentTypeLesserOf = null;

            if (lesserOfPercentage != null && lesserOfPercentage.Rows.Count > 0)
            {
                paymentTypeLesserOf = (from DataRow row in lesserOfPercentage.Rows
                                       where
                                       ((row["ContractId"] != DBNull.Value &&
                                         Convert.ToInt64(row["ContractId"]) == contractId)
                                        ||
                                        (row["contractServiceTypeId"] != DBNull.Value &&
                                         Convert.ToInt64(row["contractServiceTypeId"]) == contractServiceTypeId))
                                       select new PaymentTypeLesserOf
                {
                    ContractId = DBNull.Value == row["ContractId"]
                                               ? (long?)null
                                               : Convert.ToInt64(
                        row["ContractId"]),
                    Percentage = Convert.ToDouble(
                        row["Percentage"]),
                    PaymentTypeDetailId = Convert.ToInt64(row["PaymentTypeDetailID"]),
                    IsLesserOf = DBNull.Value == row["IsLesserOf"]
                                               ? (bool?)null
                                               : Convert.ToBoolean(
                        row["IsLesserOf"]),
                    PaymentTypeId = (byte)Enums.PaymentTypeCodes.LesserOf,
                    ServiceTypeId = DBNull.Value == row["contractServiceTypeId"]
                                               ? (long?)null
                                               : Convert.ToInt64(
                        row["contractServiceTypeId"])
                }).FirstOrDefault();
            }
            return(paymentTypeLesserOf);
        }
コード例 #3
0
        public JsonResult AddEditPaymentTypeLesserOf(PaymentTypeLesserOfViewModel paymentTypeLesserOfViewModel)
        {
            //Get the Name of User logged in
            paymentTypeLesserOfViewModel.UserName = GetCurrentUserName();
            PaymentTypeLesserOf paymentTypeLesserOf =
                AutoMapper.Mapper.Map <PaymentTypeLesserOfViewModel, PaymentTypeLesserOf>(paymentTypeLesserOfViewModel);
            long paymentTypeLesserOfId = PostApiResponse <long>("PaymentTypeLesserOf", "AddEditPaymentTypeLesserOf", paymentTypeLesserOf);

            return(paymentTypeLesserOfId > 0 ? Json(new { success = true }) : Json(new { sucess = false }));
        }
コード例 #4
0
        public void AddPaymentTypeLessorOfIfNotNull()
        {
            var mockAddPaymentTypeLessorOf = new Mock <IPaymentTypeLesserOfRepository>();

            mockAddPaymentTypeLessorOf.Setup(f => f.AddEditPaymentTypeLesserOf(It.IsAny <PaymentTypeLesserOf>())).Returns(1);
            _target = new PaymentTypeLesserOfLogic(mockAddPaymentTypeLessorOf.Object);
            PaymentTypeLesserOf objAddPaymentTypeLessorOf = new PaymentTypeLesserOf {
                ContractId = 1, Percentage = 50
            };

            _target.AddEditPaymentType(objAddPaymentTypeLessorOf);
            Assert.IsNotNull(true);
        }
コード例 #5
0
        /// <summary>
        /// Add/edit payment type lesser of.
        /// </summary>
        /// <param name="paymentTypeLesserOf">The payment type lesser of.</param>
        /// <returns> true/false </returns>
        public long AddEditPaymentTypeLesserOf(PaymentTypeLesserOf paymentTypeLesserOf)
        {
            if (paymentTypeLesserOf != null)
            {
                // Initialize the Stored Procedure
                _databaseCommandObj = _databaseObj.GetStoredProcCommand("AddEditLesserOfPayment");
                _databaseObj.AddInParameter(_databaseCommandObj, "@ContractID", DbType.Int64, paymentTypeLesserOf.ContractId);
                _databaseObj.AddInParameter(_databaseCommandObj, "@ContractServiceTypeID", DbType.Int64, paymentTypeLesserOf.ServiceTypeId);
                _databaseObj.AddInParameter(_databaseCommandObj, "@Percentage", DbType.Double, paymentTypeLesserOf.Percentage);
                _databaseObj.AddInParameter(_databaseCommandObj, "@PaymentTypeDetailID", DbType.Int64, paymentTypeLesserOf.PaymentTypeDetailId);
                _databaseObj.AddInParameter(_databaseCommandObj, "@PaymentTypeID ", DbType.Int64, paymentTypeLesserOf.PaymentTypeId);
                _databaseObj.AddInParameter(_databaseCommandObj, "@IsLesserOf", DbType.Int64, paymentTypeLesserOf.IsLesserOf);
                _databaseObj.AddInParameter(_databaseCommandObj, "@UserName", DbType.String, paymentTypeLesserOf.UserName);

                // Retrieve the results of the Stored Procedure in Datatable
                return(long.Parse(_databaseObj.ExecuteScalar(_databaseCommandObj).ToString()));
            }

            return(0);
        }
コード例 #6
0
        /// <summary>
        /// Gets the Lesser of percentage value based on contract id.
        /// </summary>
        /// <param name="paymentTypeLesserOf"></param>
        /// <returns>Lesser of percentage value</returns>
        public PaymentTypeLesserOf GetLesserOfPercentage(PaymentTypeLesserOf paymentTypeLesserOf)
        {
            if (paymentTypeLesserOf != null)
            {
                // Initialize the Stored Procedure
                _databaseCommandObj = _databaseObj.GetStoredProcCommand("GetServiceLinesandPaymentTypes");
                // Pass parameters to Stored Procedure(i.e., @ParamName), add values for
                _databaseObj.AddInParameter(_databaseCommandObj, "@PaymentTypeID ", DbType.Int64, paymentTypeLesserOf.PaymentTypeId);
                _databaseObj.AddInParameter(_databaseCommandObj, "@ContractID", DbType.Int64, paymentTypeLesserOf.ContractId);
                _databaseObj.AddInParameter(_databaseCommandObj, "@ContractServiceTypeID", DbType.Int64, paymentTypeLesserOf.ServiceTypeId);
                _databaseObj.AddInParameter(_databaseCommandObj, "@ServiceLineTypeId", DbType.Int64, 0);
                _databaseObj.AddInParameter(_databaseCommandObj, "@UserName", DbType.String, paymentTypeLesserOf.UserName);

                // Retrieve the results of the Stored Procedure in Data table
                DataSet lesserOf        = _databaseObj.ExecuteDataSet(_databaseCommandObj);
                var     lesserOfDetails = lesserOf.Tables[0];
                if (lesserOf.Tables.Count > 0)
                {
                    //populating ContractBasicInfo data
                    if (lesserOfDetails.Rows != null && lesserOfDetails.Rows.Count > 0)
                    {
                        PaymentTypeLesserOf paymentLesserOf = new PaymentTypeLesserOf
                        {
                            Percentage          = Convert.ToDouble(lesserOfDetails.Rows[0]["Percentage"]),
                            PaymentTypeDetailId = Convert.ToInt64(lesserOfDetails.Rows[0]["PaymentTypeDetailID"]),
                            IsLesserOf          = DBNull.Value == lesserOfDetails.Rows[0]["IsLesserOf"]
                                ? (bool?)null
                                : Convert.ToBoolean(
                                lesserOf.Tables[0].Rows[0]["IsLesserOf"])
                        };
                        return(paymentLesserOf);
                    }
                }
            }
            //returns response to Business layer
            return(null);
        }
コード例 #7
0
        public void EvaluateLesserOfTestForApplyContractFilter()
        {
            List <PaymentResult> paymentResults = new List <PaymentResult>
            {
                new PaymentResult {
                    ClaimId = 123, AdjudicatedValue = 110, ClaimTotalCharges = 110, ServiceTypeId = 1
                },
                new PaymentResult {
                    ClaimId = 123, Line = 1, AdjudicatedValue = 110, ClaimTotalCharges = 110, ServiceTypeId = 1
                }
            };
            // Arrange
            var mockContractServiceTypeLogic = new Mock <IContractServiceTypeLogic>();
            var mockPaymentResultLogic       = new Mock <IPaymentResultLogic>();

            mockPaymentResultLogic.Setup(
                x =>
                x.Evaluate(It.IsAny <EvaluateableClaim>(), It.IsAny <List <PaymentResult> >(), It.IsAny <bool>(),
                           It.IsAny <bool>())).Returns(paymentResults);
            Mock <IPaymentTypeLesserOfRepository> paymentTypeLesserOfRepository = new Mock <IPaymentTypeLesserOfRepository>();

            paymentTypeLesserOfRepository.Setup(x => x.GetLesserOfPercentage(It.IsAny <PaymentTypeLesserOf>()))
            .Returns(new PaymentTypeLesserOf());

            PaymentTypeLesserOf paymentTypeLesserOf = new PaymentTypeLesserOf
            {
                Conditions = new List <ICondition>
                {
                    new Condition
                    {
                        ConditionOperator = (byte)Enums.ConditionOperation.EqualTo,
                        LeftOperands      = new List <string> {
                            "300"
                        },
                        OperandType  = (byte)Enums.OperandIdentifier.HcpcsCode,
                        RightOperand = "300"
                    }
                },
                ServiceTypeId = 1,
                ValidLineIds  = new List <int> {
                    1, 2
                },
                HcpcsCode  = "ABCDE",
                ContractId = 1,
                IsLesserOf = true,
                Percentage = 50
            };


            _target = new PaymentTypeLesserOfLogic(paymentTypeLesserOfRepository.Object)
            {
                PaymentTypeBase = paymentTypeLesserOf
            };


            IEvaluateableClaim evaluateableClaim = new EvaluateableClaim();

            evaluateableClaim.ClaimId      = 123;
            evaluateableClaim.ClaimTotal   = 100;
            evaluateableClaim.ClaimCharges = new List <ClaimCharge>
            {
                new ClaimCharge
                {
                    Line    = 1,
                    Amount  = 20,
                    RevCode = "250"
                }
            };


            List <PaymentResult> updatedPaymentResults = new List <PaymentResult>
            {
                new PaymentResult {
                    ClaimId = 123, ContractId = 1, AdjudicatedValue = 110, ClaimTotalCharges = 110, ServiceTypeId = 1
                },
                new PaymentResult {
                    ClaimId = 123, Line = 1, ContractId = 1, AdjudicatedValue = 110, ClaimTotalCharges = 110, ServiceTypeId = 1
                }
            };

            Mock <ContractBaseLogic> mockContractBaseLogic = new Mock <ContractBaseLogic>();

            mockContractServiceTypeLogic.Setup(x => x.IsValidServiceType()).Returns(true);
            mockContractServiceTypeLogic.Setup(x => x.Evaluate(evaluateableClaim, paymentResults, false, false))
            .Returns(updatedPaymentResults);
            mockContractBaseLogic.SetupAllProperties();

            //Act
            List <PaymentResult> actual = _target.EvaluatePaymentType(evaluateableClaim, paymentResults, false, true);

            // Assert
            Assert.AreEqual(2, actual.Count);
            var firstOrDefault = paymentResults.FirstOrDefault();

            if (firstOrDefault != null)
            {
                Assert.AreEqual(50, firstOrDefault.AdjudicatedValue);
            }
        }
コード例 #8
0
 public PaymentTypeLesserOf GetLesserOfPercentage(PaymentTypeLesserOf paymentTypeLesserOf)
 {
     return((PaymentTypeLesserOf)_paymentTypeLesserOfLogic.GetPaymentType(paymentTypeLesserOf));
 }
コード例 #9
0
 public long AddEditPaymentTypeLesserOf(PaymentTypeLesserOf paymentTypeLesserOf)
 {
     return(_paymentTypeLesserOfLogic.AddEditPaymentType(paymentTypeLesserOf));
 }