public static Claim Execute(Claim claim)
        {
            var sw = Stopwatch.StartNew();
            try
            {

                if (!ShouldExecute(claim) ) return claim;
                var transaction =  claim.CreateAmendClaimWithoutValidationTransaction();
                
                ClaimHeader claimHeader = transaction.ClaimHeader;
                if (claimHeader == null && InvalidCodes.Contains(claimHeader.ClaimHeaderStatusCode))
                {
                    transaction.Cancel();
                    return claim;
                }

                // Transfer to Genius 
                CreateClaimTransferRequests(claimHeader, claim);
                transaction.Cancel();

                claim.ClaimTransfered = true;
                return claim;
            }
            finally
            {
                sw.Stop();
                var workDone = GlobalClaimWakeUp.Statistics.GetOrAdd(typeof(CreateClaimTransferRequestsBlock).Name, TimeSpan.FromMilliseconds(sw.ElapsedMilliseconds));
                GlobalClaimWakeUp.Statistics[typeof(CreateClaimTransferRequestsBlock).Name] = (workDone + TimeSpan.FromMilliseconds(sw.ElapsedMilliseconds));
            }
            

        }
Ejemplo n.º 2
0
        public static Claim Execute(Claim claim)
        {
            var sw = Stopwatch.StartNew();
            if (!ShouldExecute(claim)) return claim;
            var transaction = claim.CreateAmendClaimWithoutValidationTransaction();
            if (transaction == null) return claim;
            try
            {
                var claimHeader = transaction.ClaimHeader;

                if (claimHeader.ClaimHeaderInternalStatus >= (short)StaticValues.ClaimHeaderInternalStatus.Finalized) return claim;
                var productEvent = claim.ProductType == "MOT" ? _motorProductEvents.Value : _liabilityProductEvents.Value;

                var reviewEvent = CreateReviewEvent(claimHeader, claim.GeniusXClaimHandler, productEvent.ProductEventId);
                transaction.Complete(false);
                if (reviewEvent != null)
                {
                    var processHandler = GlobalClaimWakeUp.Container.Resolve<ClaimsProcessHandler>();
                    processHandler.ProcessComponent(reviewEvent, ProcessInvocationPoint.Virtual, 0, new ProcessParameters { Alias = "AXAManualReviewStartClaimProcessHandler" });
                    Logger.InfoFormat("Review Task successfully created for Claim\r\n{0}\r\n", JObject.FromObject(new { claimHeader.ClaimReference, UserId = claim.GeniusXClaimHandler }));
                }
                return claim;
            }
            catch
            {
                transaction.Cancel();
                return claim;
            }
            finally
            {
                sw.Stop();
                var workDone = GlobalClaimWakeUp.Statistics.GetOrAdd(typeof(CreateReviewTaskBlock).Name, TimeSpan.FromMilliseconds(sw.ElapsedMilliseconds));
                GlobalClaimWakeUp.Statistics[typeof(CreateReviewTaskBlock).Name] = (workDone + TimeSpan.FromMilliseconds(sw.ElapsedMilliseconds));
            }
        }
Ejemplo n.º 3
0
 public static void Execute(Claim claim)
 {
     var sw = Stopwatch.StartNew();
     var transaction = claim.CreateAmendClaimWithoutValidationTransaction();
     if (transaction == null) return;
     try
     {
         List<FlattenedTransaction> transactions;
         GlobalClaimWakeUp.MappedTransactionDetails.TryRemove(claim.ClaimReference, out transactions);
         if (ShouldExecute(claim))
         {
             
             var claimHeader = transaction.ClaimHeader;
             claimHeader.CustomCode18 = claim.CustomCode18;
             transaction.Complete(false);
         }
     }
     catch
     {
         transaction.Cancel();
     }
     finally
     {
         sw.Stop();
         var workDone = GlobalClaimWakeUp.Statistics.GetOrAdd(typeof(SetCustomCode18Block).Name, TimeSpan.FromMilliseconds(sw.ElapsedMilliseconds));
         GlobalClaimWakeUp.Statistics[typeof(SetCustomCode18Block).Name] = (workDone + TimeSpan.FromMilliseconds(sw.ElapsedMilliseconds));
     }
 }
Ejemplo n.º 4
0
        public static Claim Execute(Claim claim)
        {
            var sw = Stopwatch.StartNew();
            if (!ShouldExecute(claim)) return claim;
            var transaction = claim.CreateAmendClaimWithoutValidationTransaction();
            if (transaction == null) return claim;
            try
            {

                var claimHeader = transaction.ClaimHeader;
                claim.ExcessAndDeductiblesToProcess = true;
                bool policyExists;
                if (!GlobalClaimWakeUp.GeniusXPolicyState.TryGetValue(claim.PolicyNumber, out policyExists) || !policyExists) return claim;

                if (!claimHeader.PolicyDeductible01.HasValue &&
                    !claimHeader.PolicyDeductible02.HasValue &&
                    !claimHeader.PolicyDeductible03.HasValue &&
                    !claimHeader.PolicyDeductible04.HasValue &&
                    !claimHeader.PolicyDeductible05.HasValue)
                {
                    Logger.InfoFormat("No excess or deductibles to calculate for\r\n{0}\r\n", JObject.FromObject(new { claim.ClaimReference }));
                    claim.ExcessAndDeductiblesToProcess = false;
                    return claim;
                }
                // If we didn't have to create a policy then we can execute E&D
                if (ExcessAndDeductiblesProcessing(claim, claimHeader))
                {
                    if (claim.ClaimIsClosed) claim.ClaimProcessingCompleted = true;
                    transaction.Complete(false);
                }
                else
                    transaction.Cancel();

                return claim;
            }
            catch
            {
                transaction.Cancel();
                return claim;
            }
            finally
            {
                sw.Stop();
                var workDone = GlobalClaimWakeUp.Statistics.GetOrAdd(typeof(ExcessAndDeductiblesBlock).Name, TimeSpan.FromMilliseconds(sw.ElapsedMilliseconds));
                GlobalClaimWakeUp.Statistics[typeof(ExcessAndDeductiblesBlock).Name] = (workDone + TimeSpan.FromMilliseconds(sw.ElapsedMilliseconds));
            }
        }
        public static Claim Execute(Claim claim)
        {
            var sw = Stopwatch.StartNew();
            try
            {
                if (!ShouldExecute(claim)) return claim;

                var transaction = claim.CreateAmendClaimWithoutValidationTransaction();
                if (transaction.ClaimHeader == null)
                {
                    transaction.Cancel();
                    return claim;
                }
                CreateNameTransferRequests(transaction.ClaimHeader);
                transaction.Cancel();
                return claim;
            }
            finally
            {
                sw.Stop();
                var workDone = GlobalClaimWakeUp.Statistics.GetOrAdd(typeof(CreateNameTransferRequestsBlock).Name, TimeSpan.FromMilliseconds(sw.ElapsedMilliseconds));
                GlobalClaimWakeUp.Statistics[typeof(CreateNameTransferRequestsBlock).Name] = (workDone + TimeSpan.FromMilliseconds(sw.ElapsedMilliseconds));
            }
        }
Ejemplo n.º 6
0
        public static Claim Execute(Claim claim)
        {
            var sw = Stopwatch.StartNew();
            if (!ShouldExecute(claim)) return claim;
            // The change here is to allow us to automatically reprocess items that are F00, F01 or F02 as part of the
            // automated system.
            var transaction = claim.CreateAmendClaimWithoutValidationTransaction(true);
            if (transaction == null) return claim;
            try
            {

                var claimHeader = transaction.ClaimHeader;
                claimHeader.DateLastSeen = DateTime.UtcNow;
                // Update Custom Code 18 to NULL if it's an F- code since we now auto-retry those.
                //if (claimHeader.CustomCode18 != null && claimHeader.CustomCode18.StartsWith("F"))
                   // claimHeader.CustomCode18 = null;
                //Update CustomCode18 to be P01 - in progress
                claimHeader.CustomCode18 = "P01";
                if (GetPolicyAndAttachClaim(claim, claimHeader))
                {
                    Logger.Info("Checking for AD ClaimDetail");
                    var adClaimDetail = claimHeader.ClaimDetails.FirstOrDefault(cd => cd.ClaimDetailTypeCode == "AD");
                    if (adClaimDetail != null)
                    {
                        
                        // If there is no Excess on the ClaimDetail then copy it from the ClaimHeader
                        if (!adClaimDetail.PolicyDeductible01.HasValue)
                        {
                            if (adClaimDetail.GetProduct().ClaimDetailAutomaticDeductibleProcessingMethod == 
                                (short)StaticValues.ClaimDetailAutomaticDeductibleProcessingMethod.StandardClaimDetailDeductible
                                 && adClaimDetail.IsAutomaticDeductibleProcessingApplied == true)
                            {
                                Logger.InfoFormat("AD ClaimDetail found and has no Excess so copying from ClaimHeader:\r\n{0}", JObject.FromObject(
                                    new
                                    {
                                        claim.ClaimReference,
                                        adClaimDetail.ClaimDetailReference,
                                        IsDeductible01PaidByInsurer = claimHeader.CustomBoolean15,
                                        PolicyDeductible01 = claimHeader.CustomNumeric10
                                    }));
                                adClaimDetail.IsDeductible01PaidByInsurer = claimHeader.CustomBoolean15;
                                adClaimDetail.PolicyDeductible01 = claimHeader.CustomNumeric10;
                            }
                        }
                        // If there is Excess on the ClaimDetail then assume that is an override and update the ClaimHeader
                        else if(adClaimDetail.PolicyDeductible01 != claimHeader.CustomNumeric10)
                        {
                            Logger.InfoFormat("AD ClaimDetail found but looks like there is an override so updating ClaimHeader:\r\n{0}", JObject.FromObject(
                                   new
                                   {
                                       claim.ClaimReference,
                                       adClaimDetail.ClaimDetailReference, 
                                       adClaimDetail.IsDeductible01PaidByInsurer,
                                       adClaimDetail.PolicyDeductible01
                                   }));
                            claimHeader.CustomBoolean15 = adClaimDetail.IsDeductible01PaidByInsurer;
                            claimHeader.CustomNumeric10 = adClaimDetail.PolicyDeductible01;
                        }
                    }
                    transaction.Complete(false);
                    var policyReferenceLocks = LockManager.CheckLock(claim.PolicyNumber, LockLevel.HeaderReference, LockDurationType.Transaction, LockType.Update, LockOrigin.Underwriting);
                    if (policyReferenceLocks.Any())
                    {
                        foreach (var @lock in policyReferenceLocks)
                        {
                            LockManager.RemoveLock(@lock.LockLevel, @lock.LockData, @lock.TransactionID);
                            Logger.InfoFormat("Remove lock\r\n{0}\r\n", JObject.FromObject(new { claim.PolicyNumber }));
                        }
                    }

                    if (!string.Equals(claim.PolicyHeaderStatusCode, "OPV", StringComparison.OrdinalIgnoreCase))
                    {

                        using (var uwe = new UnderwritingEntities())
                        {
                            var policy = (from h in uwe.Header
                                          where h.HeaderReference == claim.PolicyNumber
                                          select h).FirstOrDefault();
                            if (policy != null)
                            {
                                policy.HeaderStatusCode = "OPV";
                            }
                            uwe.SaveChanges();
                            Logger.InfoFormat("Policy HeaderStatusCode change\r\n{0}\r\n", JObject.FromObject(new { claim.PolicyNumber, policy.HeaderStatusCode }));
                        }

                    }
                }
                else
                {
                    Logger.InfoFormat("Failed, cancelling");
                    transaction.Cancel();
                }
                return claim;
            }
            catch
            {
                transaction.Cancel();
                return claim;
            }
            finally
            {
                sw.Stop();
                var workDone = GlobalClaimWakeUp.Statistics.GetOrAdd(typeof(AttachClaimToPolicyBlock).Name, TimeSpan.FromMilliseconds(sw.ElapsedMilliseconds));
                GlobalClaimWakeUp.Statistics[typeof(AttachClaimToPolicyBlock).Name] = (workDone + TimeSpan.FromMilliseconds(sw.ElapsedMilliseconds));
            }
        }