/// <summary> /// Add new event on ClaimHeader if there are ClaimInvolvements on an Amend Claim or Change Claim Handler /// where the claim handler has been modified. /// </summary> /// <param name="claimHeader">Claim Header</param> private void GenerateEvent(ClaimHeader claimHeader) { if (claimHeader.ClaimInvolvements == null) { return; } string transactionType = claimHeader.Context.TransactionType; if (transactionType != ClaimConstants.TRANSACTION_TYPE_AMEND_CLAIM && transactionType != ClaimConstants.TRANSACTION_TYPE_CHANGE_CLAIM_HANDLER) { return; } // Has the Claim Handler been changed. if (claimHeader.ClaimInvolvements.Any(a => this.IsMainClaimHandlerModified(a))) { var productEvents = ProductService.GetProductEventQuery().GetProductEvents(claimHeader.ProductVersionID.GetValueOrDefault()); // If this product has an event of the system update type defined, raise it against the claim handler, to show it's been updated. if (productEvents.Any(x => x.EventTypeCode == ClaimConstants.SYSUPD_Event_Type)) { var productEvent = productEvents.Where(x => x.EventTypeCode == ClaimConstants.SYSUPD_Event_Type).First(); ClaimEvent claimEvent = claimHeader.AddNewClaimEvent(productEvent.ProductEventID, true); claimEvent.EventDescription = ClaimConstants.CLAIM_HANDLER_CHANGED; } } }
private static ClaimEvent CreateReviewEvent(ClaimHeader claimHeader, long claimHandlerId, long productEventID) { try { var reviewEvent = claimHeader.AddNewClaimEvent(productEventID); reviewEvent.CreatedByUserID = claimHandlerId; reviewEvent.TaskInitialUserID = claimHandlerId; reviewEvent.CreatedDate = DateTime.Now; reviewEvent.TaskInitialDueDate = DateTime.Now; reviewEvent.EventDescription = "Migrated Claim Review"; reviewEvent.TaskInitialDetails = "Migrated Claim Review"; return reviewEvent; } catch (Exception ex) { Logger.ErrorFormat("Exception thrown while creating review task for Claim\r\n{0}\r\n", JObject.FromObject(new { claimHeader.ClaimReference, ex.Message, ex.StackTrace })); return null; } }
/// <summary> /// Add Event if it has been added within a transaction once. /// </summary> /// <param name="claimHeader">Claim Header</param> /// <param name="eventTypeCode">event TypeCode</param> private void AddEvent(ClaimHeader claimHeader, string eventTypeCode) { //// The event should be added if it has been added within a transaction once. if (!claimHeader.ClaimEvents.Any(x => x.IsNew == true && x.EventTypeCode == eventTypeCode)) { var productEvent = ProductService.GetProductEventQuery() .GetProductEvents(claimHeader.ProductVersionID.GetValueOrDefault()) .Where(x => x.EventTypeCode == eventTypeCode).FirstOrDefault(); if (productEvent != null) { claimHeader.AddNewClaimEvent(productEvent.ProductEventID, true); } } }
/// <summary> /// Creating a auto Review event /// </summary> /// <param name="header">claim header component</param> /// <param name="pluginHelper">Claim event plugin helper</param> /// <param name="p">string value</param> private void CheckAndCreateAutoReviewEvent(ClaimHeader header, PluginHelper<IBusinessComponent> pluginHelper, string p) { ClaimEvent claimEvent = (ClaimEvent)pluginHelper.Component; // Get the Product Event References for Auto-Review and Manual Review from the application configuration string autoReviewCompletePrdEvtRef = ClaimsBusinessLogicHelper.ResolveMandatoryConfig<string>("AutoReviewCompleteProductEventRef"); string manualReviewCompletePrdEvtRef = ClaimsBusinessLogicHelper.ResolveMandatoryConfig<string>("ManualReviewCompleteProductEventRef"); // Only process if this is an Auto-Review or Manual Review event. if (claimEvent.ProductEventReference != autoReviewCompletePrdEvtRef && claimEvent.ProductEventReference != manualReviewCompletePrdEvtRef) { return; } string folio = ClaimsProcessHelper.GenerateFolio(header, ClaimsBusinessLogicHelper.GetInsuredFromHeader(header)); // Return a list of Review Process names. List<string> processNames = ClaimsProcessHelper.GetReviewProcessNames(); bool createAutoReviewEvent = true; // Count the number of review tasks (determined from the processNames list) that are open for the given folio. Xiap.Framework.Data.Tasks.ITaskService internalTaskService = ObjectFactory.Resolve<Xiap.Framework.Data.Tasks.ITaskService>(XiapConstants.XIAP_DATASOURCE); Dictionary<string, int> processDetails = internalTaskService.GetTaskCountByProcessName(folio, processNames); if (processDetails.FirstOrDefault(a => a.Value > 0).Key != string.Empty) { if (logger.IsDebugEnabled) { processDetails.ToList<KeyValuePair<string, int>>().ForEach(a => logger.Debug("ProcessDetails: Name : " + a.Key + ", Count : " + a.Value.ToString())); } // If there are any review tasks in progress for the folio then don't create an auto-review event. createAutoReviewEvent = false; } if (logger.IsDebugEnabled) { logger.Debug("CreateAutoReviewEvent : " + createAutoReviewEvent); } if (createAutoReviewEvent) { string autoReviewProductEventRef = ClaimsBusinessLogicHelper.ResolveMandatoryConfig<string>("AutoReviewProductEventRef"); if (logger.IsDebugEnabled) { logger.Debug("AutoReviewProductEventRef : " + autoReviewProductEventRef); logger.Debug("Creating Event with ProductRef : " + autoReviewProductEventRef); } // Create a new auto-review task against this claim ClaimEvent newAutoReviewClaimEvent = header.AddNewClaimEvent(autoReviewProductEventRef, header.ProductVersionID.Value); newAutoReviewClaimEvent.TaskInitialDueDate = claimEvent.TaskInitialDueDate; claimEvent.TaskInitialDueDate = DateTime.Now; if (logger.IsDebugEnabled) { logger.Debug("Created Event with ProductRef : " + autoReviewProductEventRef); } } }