Esempio n. 1
0
        /// <summary>
        /// Adds the reassigned claim job.
        /// </summary>
        /// <param name="reassignedClaimJob">The reassigned claim job.</param>
        /// <returns></returns>
        public bool AddReassignedClaimJob(ReassignedClaimJob reassignedClaimJob)
        {
            if (reassignedClaimJob != null)
            {
                DataTable reassignClaimDataTable = GetReassignClaimDataTable(reassignedClaimJob.ReassignClaim);

                // Initialize the Stored Procedure
                _databaseCommandObj = _databaseSqlObj.GetStoredProcCommand("AddReassignedClaimJob");

                _databaseObj.AddInParameter(_databaseCommandObj, "@RequestName", DbType.String, reassignedClaimJob.RequestName);
                _databaseObj.AddInParameter(_databaseCommandObj, "@UserName", DbType.String, reassignedClaimJob.UserName);
                _databaseObj.AddInParameter(_databaseCommandObj, "@SearchCriteria", DbType.String, reassignedClaimJob.SearchCriteria);
                _databaseObj.AddInParameter(_databaseCommandObj, "@DateType", DbType.Int64, reassignedClaimJob.DateType);
                _databaseObj.AddInParameter(_databaseCommandObj, "@DateFrom", DbType.DateTime, reassignedClaimJob.DateFrom);
                _databaseObj.AddInParameter(_databaseCommandObj, "@DateTo", DbType.DateTime, reassignedClaimJob.DateTo);
                _databaseObj.AddInParameter(_databaseCommandObj, "@HeaderModelId", DbType.Int64, reassignedClaimJob.ModelId);
                _databaseObj.AddInParameter(_databaseCommandObj, "@HeaderContractId", DbType.Int64, reassignedClaimJob.ContractId);
                _databaseObj.AddInParameter(_databaseCommandObj, "@SelectAll", DbType.Boolean, reassignedClaimJob.IsSelectAll);
                _databaseObj.AddInParameter(_databaseCommandObj, "@SelectAllHeader", DbType.Boolean, reassignedClaimJob.IsSelectAllHeader);
                _databaseSqlObj.AddInParameter(_databaseCommandObj, "@ReassignClaims",
                                               SqlDbType.Structured, reassignClaimDataTable);
                return(_databaseObj.ExecuteNonQuery(_databaseCommandObj) > 0);
            }
            return(false);
        }
Esempio n. 2
0
        public void InsertTrackTaskWithRetainedClaimTest()
        {
            _mockReassignClaimRepository = new Mock <IReassignClaimRepository>();
            ReassignedClaimJob reassignedClaimJob = new ReassignedClaimJob
            {
                RequestName = "AdjRequest_4576",
                UserName    = "******",
                DateType    = 1,
                DateFrom    = DateTime.MinValue,
                DateTo      = DateTime.MinValue
            };

            _mockReassignClaimRepository.Setup(f => f.AddReassignedClaimJob(It.IsAny <ReassignedClaimJob>())).Returns(true);
            _target = new ReassignClaimLogic(_mockReassignClaimRepository.Object);
            bool actual = _target.AddReassignedClaimJob(reassignedClaimJob);

            Assert.IsTrue(actual);
        }
 private string ValidateReassignClaim(ReassignedClaimJob reassignedClaimJob)
 {
     if (reassignedClaimJob.ReassignClaim != null)
     {
         if (reassignedClaimJob.IsSelectAll != null && (!reassignedClaimJob.ReassignClaim.Any((p => p.IsSelected)) && (bool)!reassignedClaimJob.IsSelectAll))
         {
             return(Constants.ClaimSelectErrorMsg);
         }
         if (
             reassignedClaimJob.ReassignClaim.Any(
                 p => p.IsRetained && (p.ContractId == 0 || p.ContractId == null)))
         {
             return(Constants.ContractSelectErrorMsg);
         }
     }
     else
     {
         return(Constants.ReassignClaimEmptyErrorMsg);
     }
     return(string.Empty);
 }
        public ActionResult AddReassignedClaimJob(ReassignedClaimJob reassignedClaimJob)
        {
            List <RetainedClaim> retainedClaims = GetReassignedClaims();

            if (reassignedClaimJob.ModelId != null && reassignedClaimJob.ContractId != null)
            {
                UpdateRetainClaims(retainedClaims, reassignedClaimJob.IsSelectAllPage, reassignedClaimJob.ModelId.Value, reassignedClaimJob.IsSelectAllHeader, reassignedClaimJob.IsPrimaryModel, reassignedClaimJob.ContractId.Value);
            }
            if (retainedClaims.Any(a => a.Order == reassignedClaimJob.PageIndex))
            {
                retainedClaims.Find(a => a.Order == reassignedClaimJob.PageIndex).ReassignClaims =
                    reassignedClaimJob.ReassignClaim;
            }
            else
            {
                retainedClaims.Add(new RetainedClaim
                {
                    Order          = reassignedClaimJob.PageIndex,
                    ReassignClaims = reassignedClaimJob.ReassignClaim
                });
            }
            //UpdateReassignClaim(reassignedClaimJob);
            if (retainedClaims.Any(claim => claim.ReassignClaims != null))
            {
                reassignedClaimJob.ReassignClaim = retainedClaims.SelectMany(q => q.ReassignClaims).ToList();
            }
            reassignedClaimJob.UserName   = GetLoggedInUserName();
            reassignedClaimJob.FacilityId = GetCurrentFacilityId();
            string errorMessage = ValidateReassignClaim(reassignedClaimJob);

            if (string.IsNullOrEmpty(errorMessage))
            {
                bool result = PostApiResponse <bool>(Constants.ReassignClaim, Constants.AddReassignedClaimJob,
                                                     reassignedClaimJob);
                // Making Session null while closing pop up
                SetReassignedClaims(null);
                return(Json(new { data = result }));
            }
            return(Json(new { data = false, errorMessage }));
        }
 public bool AddReassignedClaimJob(ReassignedClaimJob reassignedClaimJob)
 {
     return(_reassignClaimLogic.AddReassignedClaimJob(reassignedClaimJob));
 }
 /// <summary>
 /// Adds the reassigned claim job.
 /// </summary>
 /// <param name="reassignedClaimJob">The reassigned claim job.</param>
 /// <returns></returns>
 public bool AddReassignedClaimJob(ReassignedClaimJob reassignedClaimJob)
 {
     return(_reassignClaimRepository.AddReassignedClaimJob(reassignedClaimJob));
 }