/// <summary> /// Builds the financial assessment report sp parameters. /// </summary> /// <param name="financialSummary">The financial assessment report.</param> /// <param name="isUpdate">if set to <c>true</c> [is update].</param> /// <returns></returns> private List <SqlParameter> BuildFinancialSummarySpParams(FinancialSummaryModel financialSummary, bool isUpdate) { var FinancialAssessmentXML = FinancialSummaryModelToXml(financialSummary); var spParameters = new List <SqlParameter>(); if (isUpdate) { spParameters.Add(new SqlParameter("FinancialSummaryID", financialSummary.FinancialSummaryID)); } spParameters.Add(new SqlParameter("ContactID", financialSummary.ContactID)); spParameters.Add(new SqlParameter("OrganizationID", (object)financialSummary.OrganizationID ?? DBNull.Value)); spParameters.Add(new SqlParameter("FinancialAssessmentXML", (object)FinancialAssessmentXML ?? DBNull.Value)); spParameters.Add(new SqlParameter("DateSigned", (object)financialSummary.DateSigned ?? DBNull.Value)); spParameters.Add(new SqlParameter("EffectiveDate", (object)financialSummary.EffectiveDate ?? DBNull.Value)); spParameters.Add(new SqlParameter("AssessmentEndDate", (object)financialSummary.AssessmentEndDate ?? DBNull.Value)); spParameters.Add(new SqlParameter("ExpirationDate", (object)financialSummary.ExpirationDate ?? DBNull.Value)); spParameters.Add(new SqlParameter("SignatureStatusID", (object)financialSummary.SignatureStatusID ?? DBNull.Value)); spParameters.Add(new SqlParameter("UserID", (object)financialSummary.UserID ?? DBNull.Value)); spParameters.Add(new SqlParameter("UserPhoneID", (object)financialSummary.UserPhoneID ?? DBNull.Value)); spParameters.Add(new SqlParameter("CredentialID", (object)financialSummary.CredentialID ?? DBNull.Value)); spParameters.Add(new SqlParameter("ModifiedOn", financialSummary.ModifiedOn ?? DateTime.Now)); return(spParameters); }
/// <summary> /// Adds the financial assessment report. /// </summary> /// <param name="financialSummary">The financial assessment report.</param> /// <returns></returns> public Response <FinancialSummaryModel> AddFinancialSummary(FinancialSummaryModel financialSummary) { var repository = unitOfWork.GetRepository <FinancialSummaryModel>(SchemaName.Registration); var spParameters = BuildFinancialSummarySpParams(financialSummary, false); var response = unitOfWork.EnsureInTransaction <Response <FinancialSummaryModel> >(repository.ExecuteNQStoredProc, "usp_AddFinancialSummary", spParameters, forceRollback: financialSummary.ForceRollback ?? false, idResult: true); financialSummary.FinancialSummaryConfirmationStatements.RemoveAll(item => item == null); financialSummary.FinancialSummaryID = response.ID; financialSummary.FinancialSummaryConfirmationStatements.ForEach(delegate(FinancialSummaryConfirmationStatementModel finalcialSummaryConfirmationStatement) { if (finalcialSummaryConfirmationStatement != null && finalcialSummaryConfirmationStatement.SignatureBLOB != null) { finalcialSummaryConfirmationStatement.FinancialSummaryID = response.ID; AddFinancialSummaryConfirmationStatement(finalcialSummaryConfirmationStatement); } }); // Save Client Signature if (financialSummary.ClientSignature != null && financialSummary.ClientSignature.SignatureBlob != null) { AddSignature(financialSummary.ClientSignature.SignatureBlob, financialSummary.FinancialSummaryID, (int)DocumentType.FinancialAssessment, null, financialSummary.ContactID, financialSummary.ClientSignature.EntityName, (int)EntityType.Contact, financialSummary.ClientSignature.ModifiedOn); } // Save Staff Signature if (financialSummary.StaffSignature != null && financialSummary.StaffSignature.SignatureBlob != null) { AddSignature(financialSummary.StaffSignature.SignatureBlob, financialSummary.FinancialSummaryID, (int)DocumentType.FinancialAssessment, null, financialSummary.UserID, financialSummary.StaffSignature.EntityName, (int)EntityType.User, financialSummary.StaffSignature.ModifiedOn); } // Save Legally Authorized Representative Signature if (financialSummary.LegalAuthRepresentativeSignature != null && financialSummary.LegalAuthRepresentativeSignature.SignatureBlob != null) { AddSignature(financialSummary.LegalAuthRepresentativeSignature.SignatureBlob, financialSummary.FinancialSummaryID, (int)DocumentType.FinancialAssessment, null, financialSummary.UserID, financialSummary.LegalAuthRepresentativeSignature.EntityName, (int)EntityType.ExternalUser, financialSummary.StaffSignature.ModifiedOn); } return(response); }
public void AddFinancialSummary_Success() { // Arrange var url = baseRoute + "AddFinancialSummary"; var financialSummary = new FinancialSummaryModel { ContactID = 1, EffectiveDate = DateTime.UtcNow, ExpirationDate = DateTime.UtcNow, OrganizationID = 1, DateSigned = DateTime.UtcNow, SignatureStatusID = 1, UserID = 1, UserPhoneID = 4, CredentialID = 1, EmploymentStatusID = 1, LookingForWork = true, FinancialAssessment = new FinancialAssessmentModel() { TotalIncome = 10, TotalExpenses = 08, TotalExtraOrdinaryExpenses = 06, TotalOther = 10 }, FinancialAssessmentDetails = new List <FinancialAssessmentDetailsModel> { new FinancialAssessmentDetailsModel() { CategoryTypeID = 1, Amount = 20, FinanceFrequencyID = 1, CategoryID = 1 } }, SelfPay = new FinancialSummarySelfPayModel() { ISChildInConservatorship = true, IsEnrolledInPublicBenefits = false, }, Payors = new List <BenefitModel> { new BenefitModel() { PayorName = "AARP", PolicyHolderID = 20, RelationshipTypeID = 1, EffectiveDate = DateTime.UtcNow, ExpirationDate = DateTime.UtcNow, PlanID = "Plan 1", PlanName = "TEAMCARE-(ILLINOI)", GroupID = "Group 1", GroupName = "TEAMCARE-(ILLINOI)" } }, ForceRollback = true }; // Act var response = communicationManager.Post <FinancialSummaryModel, Response <FinancialSummaryModel> >(financialSummary, url); // Assert Assert.IsTrue(response != null, "Response can't be null"); Assert.IsTrue(response.ResultCode == 0, "Financial Summary could not be created."); }
public void UpdateFinancialSummary_Failed() { // Arrange var financialSummary = new FinancialSummaryModel { FinancialSummaryID = -1, ContactID = -1, EffectiveDate = DateTime.UtcNow, ExpirationDate = DateTime.UtcNow, OrganizationID = 1, DateSigned = DateTime.UtcNow, SignatureStatusID = 1, UserID = 1, UserPhoneID = 4, CredentialID = 1, EmploymentStatusID = 1, LookingForWork = true, FinancialAssessment = new FinancialAssessmentModel() { TotalIncome = 10, TotalExpenses = 08, TotalExtraOrdinaryExpenses = 06, TotalOther = 10 }, FinancialAssessmentDetails = new List <FinancialAssessmentDetailsModel> { new FinancialAssessmentDetailsModel() { CategoryTypeID = 1, Amount = 20, FinanceFrequencyID = 1, CategoryID = 1 } }, SelfPay = new FinancialSummarySelfPayModel() { ISChildInConservatorship = true, IsEnrolledInPublicBenefits = false, }, Payors = new List <BenefitModel> { new BenefitModel() { PayorName = "AARP", PolicyHolderID = 20, RelationshipTypeID = 1, EffectiveDate = DateTime.UtcNow, ExpirationDate = DateTime.UtcNow, PlanID = "Plan 1", PlanName = "TEAMCARE-(ILLINOI)", GroupID = "Group 1", GroupName = "TEAMCARE-(ILLINOI)" } }, ForceRollback = true }; // Act var response = controller.UpdateFinancialSummary(financialSummary); // Assert Assert.IsTrue(response != null, "Response can't be null"); Assert.IsTrue(response.RowAffected == 0, "Update financial summary expected to be failed."); }
/// <summary> /// Financials the summary XML to model. /// </summary> /// <param name="financialSummary">The financial summary.</param> /// <returns></returns> private FinancialSummaryModel FinancialSummaryXmlToModel(FinancialSummaryModel financialSummary) { XDocument doc = XDocument.Parse(financialSummary.FinancialAssessmentXML); var copyOfFinancialSummary = new FinancialSummaryModel(); copyOfFinancialSummary = (from root in doc.Descendants("FinancialSummary") select new FinancialSummaryModel() { EmploymentStatusID = root.Element("EmploymentStatusID").IsEmpty ? (int?)null : (int)root.Element("EmploymentStatusID"), LookingForWork = root.Element("LookingForWork").IsEmpty ? (bool?)null : (bool)root.Element("LookingForWork"), FAStaffName = root.Element("FAStaffName").IsEmpty ? null : (string)root.Element("FAStaffName"), FAStaffCredential = root.Element("FAStaffCredential").IsEmpty ? null : (string)root.Element("FAStaffCredential"), FAStaffPhone = root.Element("FAStaffPhone").IsEmpty ? null : (string)root.Element("FAStaffPhone"), FAStaffExtension = root.Element("FAStaffExtension") != null ? (root.Element("FAStaffExtension").IsEmpty ? null : (string)root.Element("FAStaffExtension")) : null, FinancialAssessment = (from financialAssessment in root.Descendants("FinancialAssessment") where root.Descendants("FinancialAssessment").Any() select new FinancialAssessmentModel() { FinancialAssessmentID = financialAssessment.Element("FinancialAssessmentID") != null ? (long)financialAssessment.Element("FinancialAssessmentID") : 0, // FinancialAssessmentID does not exists for old xml, so take care them TotalIncome = (decimal)financialAssessment.Element("TotalIncome"), TotalExpenses = (decimal)financialAssessment.Element("TotalExpenses"), TotalExtraOrdinaryExpenses = (decimal)financialAssessment.Element("TotalExtraOrdinaryExpenses"), AdjustedGrossIncome = (decimal)financialAssessment.Element("AdjustedGrossIncome"), FamilySize = (int)financialAssessment.Element("FamilySize") }).FirstOrDefault(), FinancialAssessmentDetails = (from financialAssessmentDetail in root.Descendants("FinancialAssessmentDetail") where root.Descendants("FinancialAssessmentDetail").Any() select new FinancialAssessmentDetailsModel() { CategoryTypeID = (int)financialAssessmentDetail.Element("CategoryTypeID"), CategoryID = (int)financialAssessmentDetail.Element("CategoryID"), Amount = (decimal)financialAssessmentDetail.Element("Amount"), FinanceFrequencyID = (int)financialAssessmentDetail.Element("FinanceFrequencyID") }).ToList(), Payors = (from payors in root.Descendants("Payor") where root.Descendants("Payor").Any() select new BenefitModel() { PolicyHolderName = payors.Element("PolicyHolderName").IsEmpty ? null : (string)payors.Element("PolicyHolderName"), EffectiveDate = (payors.Element("EffectiveDate") == null || payors.Element("EffectiveDate").IsEmpty) ? (DateTime?)null : (DateTime)payors.Element("EffectiveDate"), ExpirationDate = (payors.Element("ExpirationDate") == null || payors.Element("ExpirationDate").IsEmpty) ? (DateTime?)null : (DateTime)payors.Element("ExpirationDate"), PayorName = (string)payors.Element("PayorName"), RelationshipTypeID = payors.Element("RelationshipTypeID").IsEmpty ? (int?)null : (int)payors.Element("RelationshipTypeID"), PlanID = payors.Element("PlanID").IsEmpty ? null : (string)payors.Element("PlanID"), PlanName = payors.Element("PlanName").IsEmpty ? null : (string)payors.Element("PlanName"), GroupID = payors.Element("GroupID").IsEmpty ? null : (string)payors.Element("GroupID"), GroupName = payors.Element("GroupName").IsEmpty ? null : (string)payors.Element("GroupName"), PolicyID = payors.Element("PolicyID").IsEmpty ? null : (string)payors.Element("PolicyID") }).ToList(), SelfPay = (from selfPay in root.Descendants("SelfPay") where root.Descendants("SelfPay").Any() select new FinancialSummarySelfPayModel() { MonthlyAbilities = (from monthlyAbility in selfPay.Descendants("MonthlyAbility") where selfPay.Descendants("MonthlyAbility").Any() select new MonthlyAbilityToPayModel() { SelfPayID = (long)monthlyAbility.Element("SelfPayID"), OrganizationDetailID = (long)monthlyAbility.Element("OrganizationDetailID"), ContactID = (long)monthlyAbility.Element("ContactID"), SelfPayAmount = (monthlyAbility.Element("SelfPayAmount") == null || monthlyAbility.Element("SelfPayAmount").IsEmpty) ? (decimal?)null : (decimal)monthlyAbility.Element("SelfPayAmount"), IsPercent = (monthlyAbility.Element("IsPercent") == null || monthlyAbility.Element("IsPercent").IsEmpty) ? (bool?)null : (bool)monthlyAbility.Element("IsPercent"), EffectiveDate = (monthlyAbility.Element("EffectiveDate") == null || monthlyAbility.Element("EffectiveDate").IsEmpty) ? (DateTime?)null : (DateTime)monthlyAbility.Element("EffectiveDate"), ExpirationDate = monthlyAbility.Element("ExpirationDate") == null || (monthlyAbility.Element("ExpirationDate").IsEmpty) ? (DateTime?)null : (DateTime)monthlyAbility.Element("ExpirationDate") } ).ToList(), ISChildInConservatorship = selfPay.Element("ISChildInConservatorship").IsEmpty ? false : (bool)selfPay.Element("ISChildInConservatorship"), IsNotAttested = selfPay.Element("IsNotAttested").IsEmpty ? false : (bool)selfPay.Element("IsNotAttested"), IsEnrolledInPublicBenefits = selfPay.Element("IsEnrolledInPublicBenefits").IsEmpty ? false : (bool)selfPay.Element("IsEnrolledInPublicBenefits"), IsRequestingReconsideration = selfPay.Element("IsRequestingReconsideration").IsEmpty ? false : (bool)selfPay.Element("IsRequestingReconsideration"), IsNotGivingConsent = selfPay.Element("IsNotGivingConsent").IsEmpty ? false : (bool)selfPay.Element("IsNotGivingConsent"), IsOtherChildEnrolled = selfPay.Element("IsOtherChildEnrolled").IsEmpty ? false : (bool)selfPay.Element("IsOtherChildEnrolled"), IsApplyingForPublicBenefits = selfPay.Element("IsApplyingForPublicBenefits").IsEmpty ? false : (bool)selfPay.Element("IsApplyingForPublicBenefits"), IsReconsiderationOfAdjustment = selfPay.Element("IsReconsiderationOfAdjustment").IsEmpty ? false : (bool)selfPay.Element("IsReconsiderationOfAdjustment") }).FirstOrDefault() }).FirstOrDefault(); financialSummary.EmploymentStatusID = copyOfFinancialSummary.EmploymentStatusID; financialSummary.LookingForWork = copyOfFinancialSummary.LookingForWork; financialSummary.FAStaffName = copyOfFinancialSummary.FAStaffName; financialSummary.FAStaffCredential = copyOfFinancialSummary.FAStaffCredential; financialSummary.FAStaffPhone = copyOfFinancialSummary.FAStaffPhone; financialSummary.FAStaffExtension = copyOfFinancialSummary.FAStaffExtension; financialSummary.FinancialAssessment = copyOfFinancialSummary.FinancialAssessment; financialSummary.FinancialAssessmentDetails = copyOfFinancialSummary.FinancialAssessmentDetails; financialSummary.Payors = copyOfFinancialSummary.Payors; financialSummary.SelfPay = copyOfFinancialSummary.SelfPay; return(financialSummary); }
/// <summary> /// Financials the summary model to XML. /// </summary> /// <param name="financialSummary">The financial summary XML.</param> /// <returns></returns> private string FinancialSummaryModelToXml(FinancialSummaryModel financialSummary) { var xmlString = new XElement("FinancialSummary", new XElement("EmploymentStatusID", financialSummary.EmploymentStatusID != null ? financialSummary.EmploymentStatusID : null), new XElement("LookingForWork", financialSummary.LookingForWork != null ? financialSummary.LookingForWork : null), new XElement("FAStaffName", financialSummary.FAStaffName != null ? financialSummary.FAStaffName : null), new XElement("FAStaffCredential", financialSummary.FAStaffCredential != null ? financialSummary.FAStaffCredential : null), new XElement("FAStaffPhone", financialSummary.FAStaffPhone != null ? financialSummary.FAStaffPhone : null), new XElement("FAStaffExtension", financialSummary.FAStaffExtension != null ? financialSummary.FAStaffExtension : null), financialSummary.FinancialAssessment != null ? new XElement("FinancialAssessment", new XElement("FinancialAssessmentID", financialSummary.FinancialAssessment.FinancialAssessmentID), new XElement("TotalIncome", financialSummary.FinancialAssessment.TotalIncome), new XElement("TotalExpenses", financialSummary.FinancialAssessment.TotalExpenses), new XElement("TotalExtraOrdinaryExpenses", financialSummary.FinancialAssessment.TotalExtraOrdinaryExpenses), new XElement("FamilySize", financialSummary.FinancialAssessment.FamilySize), new XElement("AdjustedGrossIncome", financialSummary.FinancialAssessment.AdjustedGrossIncome)) : null, new XElement("FinancialAssessmentDetails", financialSummary.FinancialAssessmentDetails != null ? from financialAssessmentDetails in financialSummary.FinancialAssessmentDetails select new XElement("FinancialAssessmentDetail", new XElement("CategoryTypeID", financialAssessmentDetails.CategoryTypeID), new XElement("Amount", financialAssessmentDetails.Amount), new XElement("CategoryID", financialAssessmentDetails.CategoryID), new XElement("FinanceFrequencyID", financialAssessmentDetails.FinanceFrequencyID)) : null), new XElement("Payors", financialSummary.Payors != null ? from payors in financialSummary.Payors select new XElement("Payor", new XElement("PolicyHolderName", payors.PolicyHolderName != null ? payors.PolicyHolderName : null), new XElement("EffectiveDate", payors.EffectiveDate != null ? payors.EffectiveDate : null), new XElement("ExpirationDate", payors.ExpirationDate != null ? payors.ExpirationDate : null), new XElement("PayorName", payors.PayorName), new XElement("RelationshipTypeID", payors.RelationshipTypeID != null ? payors.RelationshipTypeID : null), new XElement("PlanID", payors.PlanID != null ? payors.PlanID : null), new XElement("PlanName", payors.PlanName != null ? payors.PlanName : null), new XElement("GroupID", payors.GroupID != null ? payors.GroupID : null), new XElement("PolicyID", payors.PolicyID != null ? payors.PolicyID : null), new XElement("GroupName", payors.GroupName != null ? payors.GroupName : null)) : null), financialSummary.SelfPay != null ? new XElement("SelfPay", new XElement("ISChildInConservatorship", financialSummary.SelfPay.ISChildInConservatorship), new XElement("IsNotAttested", financialSummary.SelfPay.IsNotAttested), new XElement("IsEnrolledInPublicBenefits", financialSummary.SelfPay.IsEnrolledInPublicBenefits), new XElement("IsRequestingReconsideration", financialSummary.SelfPay.IsRequestingReconsideration), new XElement("IsNotGivingConsent", financialSummary.SelfPay.IsNotGivingConsent), new XElement("IsOtherChildEnrolled", financialSummary.SelfPay.IsOtherChildEnrolled), new XElement("IsApplyingForPublicBenefits", financialSummary.SelfPay.IsApplyingForPublicBenefits), new XElement("IsReconsiderationOfAdjustment", financialSummary.SelfPay.IsReconsiderationOfAdjustment), new XElement("MonthlyAbilities", from selfPay in financialSummary.SelfPay.MonthlyAbilities select new XElement("MonthlyAbility", new XElement("SelfPayID", selfPay.SelfPayID), new XElement("OrganizationDetailID", selfPay.OrganizationDetailID), new XElement("ContactID", selfPay.ContactID), new XElement("SelfPayAmount", selfPay.SelfPayAmount), new XElement("IsPercent", selfPay.IsPercent), new XElement("EffectiveDate", selfPay.EffectiveDate), new XElement("ExpirationDate", selfPay.ExpirationDate)))) : null); return(xmlString.ToString()); }
/// <summary> /// Updates the financial summary. /// </summary> /// <param name="financialAssessment">The financial assessment.</param> /// <returns></returns> public Response <FinancialSummaryModel> UpdateFinancialSummary(FinancialSummaryModel financialAssessment) { return(financialSummaryService.UpdateFinancialSummary(financialAssessment)); }
public IHttpActionResult UpdateFinancialSummary(FinancialSummaryModel financialSummary) { return(new HttpResult <Response <FinancialSummaryModel> >(financialSummaryRuleEngine.UpdateFinancialSummary(financialSummary), Request)); }
public Response <FinancialSummaryModel> UpdateFinancialSummary(FinancialSummaryModel financialSummary) { return(financialSummaryRepository.UpdateFinancialSummary(financialSummary)); }
public Response <FinancialSummaryModel> AddFinancialSummary(FinancialSummaryModel financialSummary) { return(financialSummaryRepository.AddFinancialSummary(financialSummary)); }
/// <summary> /// Updates the financial summary. /// </summary> /// <param name="financialSummary">The financial summary.</param> /// <returns></returns> public Response <FinancialSummaryModel> UpdateFinancialSummary(FinancialSummaryModel financialSummary) { string apiUrl = baseRoute + "UpdateFinancialSummary"; return(communicationManager.Put <FinancialSummaryModel, Response <FinancialSummaryModel> >(financialSummary, apiUrl)); }
/// <summary> /// Adds the financial summary. /// </summary> /// <param name="financialSummary">The financial assessment.</param> /// <returns></returns> public Response <FinancialSummaryModel> AddFinancialSummary(FinancialSummaryModel financialSummary) { string apiUrl = BaseRoute + "AddFinancialSummary"; return(communicationManager.Post <FinancialSummaryModel, Response <FinancialSummaryModel> >(financialSummary, apiUrl)); }
public IHttpActionResult UpdateFinancialSummary(FinancialSummaryModel financialSummary) { return(new HttpResult <Response <FinancialSummaryModel> >(financialAssessmentDataProvider.UpdateFinancialSummary(financialSummary), Request)); }