diff --git a/ECC.Core.DataContext/Entities/Entities.cs b/ECC.Core.DataContext/Entities/Entities.cs index b627351f..040487ff 100644 --- a/ECC.Core.DataContext/Entities/Entities.cs +++ b/ECC.Core.DataContext/Entities/Entities.cs @@ -6205,6 +6205,38 @@ public string ofm_on_k12_school_grounds_or_board_affiliatedname } } + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("ofm_on_k12_school_grounds_or_board_affiliated")] + public virtual ecc_ynempty? ofm_on_k12_school_grounds_or_board_affiliated + { + [System.Diagnostics.DebuggerNonUserCode()] + get + { + return ((ecc_ynempty?)(EntityOptionSetEnum.GetEnum(this, "ofm_on_k12_school_grounds_or_board_affiliated"))); + } + [System.Diagnostics.DebuggerNonUserCode()] + set + { + this.SetAttributeValue("ofm_on_k12_school_grounds_or_board_affiliated", value.HasValue ? new Microsoft.Xrm.Sdk.OptionSetValue((int)value) : null); + } + } + + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("ofm_on_k12_school_grounds_or_board_affiliatedname")] + public string ofm_on_k12_school_grounds_or_board_affiliatedname + { + [System.Diagnostics.DebuggerNonUserCode()] + get + { + if (this.FormattedValues.Contains("ofm_on_k12_school_grounds_or_board_affiliated")) + { + return this.FormattedValues["ofm_on_k12_school_grounds_or_board_affiliated"]; + } + else + { + return default(string); + } + } + } + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("ofm_on_reserve")] public virtual ecc_ynempty? ofm_on_reserve { @@ -24945,6 +24977,21 @@ public virtual ecc_ynempty? ofm_accb_participation } } + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("ofm_accb_participation")] + public virtual ecc_ynempty? ofm_accb_participation + { + [System.Diagnostics.DebuggerNonUserCode()] + get + { + return ((ecc_ynempty?)(EntityOptionSetEnum.GetEnum(this, "ofm_accb_participation"))); + } + [System.Diagnostics.DebuggerNonUserCode()] + set + { + this.SetAttributeValue("ofm_accb_participation", value.HasValue ? new Microsoft.Xrm.Sdk.OptionSetValue((int)value) : null); + } + } + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("ofm_accb_participationname")] public string ofm_accb_participationname { @@ -26411,6 +26458,53 @@ public virtual ecc_ynempty? ofm_provide_previous_fy_financial_statements } } + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("ofm_provide_actual_expenses")] + public virtual ecc_ynempty? ofm_provide_actual_expenses + { + [System.Diagnostics.DebuggerNonUserCode()] + get + { + return ((ecc_ynempty?)(EntityOptionSetEnum.GetEnum(this, "ofm_provide_actual_expenses"))); + } + [System.Diagnostics.DebuggerNonUserCode()] + set + { + this.SetAttributeValue("ofm_provide_actual_expenses", value.HasValue ? new Microsoft.Xrm.Sdk.OptionSetValue((int)value) : null); + } + } + + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("ofm_provide_actual_expensesname")] + public string ofm_provide_actual_expensesname + { + [System.Diagnostics.DebuggerNonUserCode()] + get + { + if (this.FormattedValues.Contains("ofm_provide_actual_expenses")) + { + return this.FormattedValues["ofm_provide_actual_expenses"]; + } + else + { + return default(string); + } + } + } + + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("ofm_provide_previous_fy_financial_statements")] + public virtual ecc_ynempty? ofm_provide_previous_fy_financial_statements + { + [System.Diagnostics.DebuggerNonUserCode()] + get + { + return ((ecc_ynempty?)(EntityOptionSetEnum.GetEnum(this, "ofm_provide_previous_fy_financial_statements"))); + } + [System.Diagnostics.DebuggerNonUserCode()] + set + { + this.SetAttributeValue("ofm_provide_previous_fy_financial_statements", value.HasValue ? new Microsoft.Xrm.Sdk.OptionSetValue((int)value) : null); + } + } + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("ofm_provide_previous_fy_financial_statementsname")] public string ofm_provide_previous_fy_financial_statementsname { diff --git a/ECC.Core.DataContext/OptionSets/OptionSets.cs b/ECC.Core.DataContext/OptionSets/OptionSets.cs index 70f34701..61d5ce05 100644 --- a/ECC.Core.DataContext/OptionSets/OptionSets.cs +++ b/ECC.Core.DataContext/OptionSets/OptionSets.cs @@ -15642,6 +15642,38 @@ public enum ofm_system_message_StatusCode Inactive = 2, } + /// + /// Status of the OFM System Message + /// + [System.Runtime.Serialization.DataContractAttribute()] + public enum ofm_system_message_statecode + { + + [System.Runtime.Serialization.EnumMemberAttribute()] + [OptionSetMetadataAttribute("Active", 0)] + Active = 0, + + [System.Runtime.Serialization.EnumMemberAttribute()] + [OptionSetMetadataAttribute("Inactive", 1)] + Inactive = 1, + } + + /// + /// Reason for the status of the OFM System Message + /// + [System.Runtime.Serialization.DataContractAttribute()] + public enum ofm_system_message_StatusCode + { + + [System.Runtime.Serialization.EnumMemberAttribute()] + [OptionSetMetadataAttribute("Active", 0)] + Active = 1, + + [System.Runtime.Serialization.EnumMemberAttribute()] + [OptionSetMetadataAttribute("Inactive", 1)] + Inactive = 2, + } + [System.Runtime.Serialization.DataContractAttribute()] public enum ofm_verification_checklist_status { diff --git a/OFM.Infrastructure.CustomWorkflowActivities/Application/CreateFundingRecord.cs b/OFM.Infrastructure.CustomWorkflowActivities/Application/CreateFundingRecord.cs index 2974fb33..c7457014 100644 --- a/OFM.Infrastructure.CustomWorkflowActivities/Application/CreateFundingRecord.cs +++ b/OFM.Infrastructure.CustomWorkflowActivities/Application/CreateFundingRecord.cs @@ -98,11 +98,12 @@ protected override void Execute(CodeActivityContext executionContext) //generate the application funding number Base tracingService.Trace("***Update Funding Number Base" + ofmFundingNumberBase); - Entity newudpate = new Entity(); - newudpate.LogicalName = entity.LogicalName; - newudpate["ofm_applicationid"] = entity["ofm_applicationid"]; - newudpate["ofm_funding_number_base"] = ofmFundingNumberBase; - service.Update(newudpate); + Entity newupdate = new Entity(); + newupdate.LogicalName = entity.LogicalName; + newupdate["ofm_applicationid"] = entity["ofm_applicationid"]; + newupdate["ofm_funding_number_base"] = ofmFundingNumberBase; + newupdate["ofm_funding_version_number"] = 0; + service.Update(newupdate); // Create first Funding record Entity newFundingRecord = new Entity("ofm_funding"); @@ -120,37 +121,42 @@ protected override void Execute(CodeActivityContext executionContext) tracingService.Trace("\nStart resubmit logic implement, logical name: {0}, id:{1}", entity.LogicalName, entity.Id); var fetchData = new { - ofm_application = recordId.ToString(), - statecode = "0" + ofm_application = recordId.ToString() }; fetchXml = $@" - - - - - + + + - - + - "; - EntityCollection fundingRecords = service.RetrieveMultiple(new FetchExpression(fetchXml)); - if (fundingRecords.Entities.Count > 0 && fundingRecords[0] != null) + EntityCollection applicationRecord = service.RetrieveMultiple(new FetchExpression(fetchXml)); + tracingService.Trace("application count: " + applicationRecord.Entities.Count); + if (applicationRecord.Entities.Count > 0 && applicationRecord[0] != null) { - var id = fundingRecords[0].Id; - tracingService.Trace("\nResubmission, create new funding records:" + id); + tracingService.Trace("\nModification, create new funding records, current version: " + applicationRecord[0].GetAttributeValue("ofm_funding_version_number")); Entity newFundingRecord = new Entity("ofm_funding"); - newFundingRecord["ofm_version_number"] = fundingRecords[0].GetAttributeValue("ofm_version_number") + 1; - newFundingRecord["ofm_funding_number"] = ofmFundingNumberBase + "-" + (fundingRecords[0].GetAttributeValue("ofm_version_number") + 1).ToString("00"); // Primary coloumn + var newVersionNumber = applicationRecord[0].GetAttributeValue("ofm_funding_version_number") + 1; + newFundingRecord["ofm_version_number"] = newVersionNumber; + newFundingRecord["ofm_funding_number"] = ofmFundingNumberBase + "-" + newVersionNumber.ToString("00"); // Primary coloumn newFundingRecord["ofm_application"] = new EntityReference("ofm_application", recordId); newFundingRecord["ofm_rate_schedule"] = (rateSchedualId == null || rateSchedualId == Guid.Empty) ? null : new EntityReference("ofm_rate_schedule", rateSchedualId); //newFundingRecord["statuscode"] = new OptionSetValue((int) ofm_funding_StatusCode.FAReview); service.Create(newFundingRecord); - + + + //Update application version number + Entity newupdate = new Entity(); + newupdate.LogicalName = entity.LogicalName; + newupdate["ofm_applicationid"] = entity["ofm_applicationid"]; + newupdate["ofm_funding_version_number"] = newVersionNumber; + service.Update(newupdate); + + tracingService.Trace("\nThis is a resubmisstion.Create Funding records successfully."); } } @@ -163,4 +169,4 @@ protected override void Execute(CodeActivityContext executionContext) } } } -} +} \ No newline at end of file diff --git a/OFM.Infrastructure.CustomWorkflowActivities/Funding/OutputModStartAndEndDate.cs b/OFM.Infrastructure.CustomWorkflowActivities/Funding/OutputModStartAndEndDate.cs index 38a71a4e..c06aef22 100644 --- a/OFM.Infrastructure.CustomWorkflowActivities/Funding/OutputModStartAndEndDate.cs +++ b/OFM.Infrastructure.CustomWorkflowActivities/Funding/OutputModStartAndEndDate.cs @@ -16,9 +16,10 @@ public sealed class OutputModStartAndEndDate : CodeActivity [Input("Application")] public InArgument application { get; set; } - [Input("Version")] + [ReferenceTarget("ofm_funding")] [RequiredArgument] - public InArgument version { get; set; } + [Input("Funding")] + public InArgument funding { get; set; } [Output("Start Date")] public OutArgument startDate { get; set; } @@ -39,28 +40,36 @@ protected override void Execute(CodeActivityContext executionContext) IOrganizationService service = serviceFactory.CreateOrganizationService(context.InitiatingUserId); tracingService.Trace("{0}{1}", "Start Custom Workflow Activity: OutputMODStartAndEndDate", DateTime.Now.ToLongTimeString()); var application = this.application.Get(executionContext); - var version = this.version.Get(executionContext); + var funding = this.funding.Get(executionContext); try { var fundingRequest = new QueryExpression() { EntityName = ofm_funding.EntityLogicalName, - ColumnSet = new ColumnSet(new string[] { ofm_funding.Fields.ofm_end_date, ofm_funding.Fields.ofm_application }), + ColumnSet = new ColumnSet(new string[] { ofm_funding.Fields.ofm_end_date, ofm_funding.Fields.ofm_application, ofm_funding.Fields.ofm_version_number }), Criteria = new FilterExpression { Conditions = { - new ConditionExpression(ofm_funding.Fields.ofm_version_number, ConditionOperator.Equal, version - 1), - new ConditionExpression(ofm_funding.Fields.ofm_application, ConditionOperator.Equal, application.Id) + new ConditionExpression(ofm_funding.Fields.ofm_application, ConditionOperator.Equal, application.Id), + new ConditionExpression("ofm_fundingid", ConditionOperator.NotEqual, funding.Id) } + }, + Orders = + { + new OrderExpression("ofm_version_number", OrderType.Descending) } }; var d365Funding = service.RetrieveMultiple(fundingRequest); + tracingService.Trace("{0}{1}", "Fundings:", d365Funding.Entities.Count); + tracingService.Trace("{0}{1}", "Latest Funding: ", d365Funding[0].Id); + if (d365Funding != null && d365Funding.Entities.Count > 0 && d365Funding[0].Attributes.Contains(ofm_funding.Fields.ofm_end_date)) { + RetrieveRequest timeZoneCode = new RetrieveRequest { ColumnSet = new ColumnSet(new string[] { UserSettings.Fields.timezonecode }), diff --git a/OFM.Infrastructure.WebAPI/Models/Fundings/Fundings.cs b/OFM.Infrastructure.WebAPI/Models/Fundings/Fundings.cs index 8e002673..4b1936ad 100644 --- a/OFM.Infrastructure.WebAPI/Models/Fundings/Fundings.cs +++ b/OFM.Infrastructure.WebAPI/Models/Fundings/Fundings.cs @@ -147,6 +147,7 @@ public class SupplementaryApplication : ofm_allowance public new decimal? ofm_transport_odometer { get; set; } public new decimal? ofm_monthly_amount { get; set; } public new decimal? ofm_retroactive_amount { get; set; } + public string? ofm_funding_number { get; set; } public new SupplementarySchedule? ofm_supplementary_schedule { get; set; } public string? _ofm_application_value { get; set; } [property: JsonPropertyName("con.ofm_first_name")] diff --git a/OFM.Infrastructure.WebAPI/Services/Processes/Emails/IEmailRepository.cs b/OFM.Infrastructure.WebAPI/Services/Processes/Emails/IEmailRepository.cs index 9d547c23..b9bfed7e 100644 --- a/OFM.Infrastructure.WebAPI/Services/Processes/Emails/IEmailRepository.cs +++ b/OFM.Infrastructure.WebAPI/Services/Processes/Emails/IEmailRepository.cs @@ -308,7 +308,7 @@ public async Task CreateAllowanceEmail(SupplementaryApplication allo //var allowanceStatusReason = allowance.statuscode; Guid applicationPrimaryContact = (Guid)allowance._ofm_contact_value != null ? (Guid)allowance._ofm_contact_value : Guid.Empty; Guid submittedBy = allowance._ofm_summary_submittedby_value != null ? (Guid)allowance._ofm_summary_submittedby_value : Guid.Empty; - var fundingNumber = allowance.ofm_funding_number_base; + var fundingNumber = allowance.ofm_funding_number; var effectiveDate = allowance.ofm_start_date; var retroActiveDate = allowance.ofm_retroactive_date; var VIN = allowance.ofm_transport_vehicle_vin; diff --git a/OFM.Infrastructure.WebAPI/Services/Processes/Emails/P240AllowanceApprovalDenialNotificationProvider.cs b/OFM.Infrastructure.WebAPI/Services/Processes/Emails/P240AllowanceApprovalDenialNotificationProvider.cs index eb825710..c1a51ab3 100644 --- a/OFM.Infrastructure.WebAPI/Services/Processes/Emails/P240AllowanceApprovalDenialNotificationProvider.cs +++ b/OFM.Infrastructure.WebAPI/Services/Processes/Emails/P240AllowanceApprovalDenialNotificationProvider.cs @@ -64,6 +64,7 @@ public string RequestUri +