Ejemplo n.º 1
0
        /// <summary>
        /// Persist EIC
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="userDataId"></param>
        /// <param name="eicData"></param>
        /// <returns></returns>
        public long PersitEarnedIncomeCredit(long userId, TaxReturnData taxReturnData, int year)
        {
            try
            {
                BusinessObject.Tax1040 taxObject;
                EIC eic = JsonConvert.DeserializeObject <EIC>(taxReturnData.TaxData);

                if (eic != null)
                {
                    taxObject = Utilities.GetTaxObjectByUserIdAndUserDataId(userId, taxReturnData.UserDataId);

                    if (taxObject == null)
                    {
                        taxObject = new BusinessObject.Tax1040();
                    }

                    if (taxObject.Credits == null)
                    {
                        taxObject.Credits = new Credits();
                    }
                    taxObject.Credits.EIC = eic;

                    //Initializing Out Parameter
                    if (taxObject.ErrorMessages == null)
                    {
                        taxObject.ErrorMessages = new List <ErrorMessage>();
                    }

                    //Retrieving Error Message list from Database
                    //var errorMessage = messageRepository.GetErrorMessages();
                    var errorMessage  = HttpRuntime.Cache["ErrorMessageCollection"] as Dictionary <string, ErrorMessage>;
                    var errorMessages = new ErrorMessages(errorMessage);

                    // Clear the Error messages
                    messageRepository.ClearErrorMessages(taxObject.ErrorMessages, Constants.TOPIC_EARNED_INCOME_CREDIT);

                    BusinessValidation(taxObject.Credits.EIC, taxObject.ErrorMessages, errorMessages, year, (taxObject != null && taxObject.PersonalDetails != null &&
                                                                                                             taxObject.PersonalDetails.PrimaryTaxPayer != null &&
                                                                                                             taxObject.PersonalDetails.PrimaryTaxPayer.FilingStatus != null ? taxObject.PersonalDetails.PrimaryTaxPayer.FilingStatus : FilingStatus.None));

                    //Invoking Business Rules Validation Workflow
                    dynamic input = new Microsoft.Activities.Extensions.WorkflowArguments();
                    input.Tax1040Object = taxObject;

                    //Getting the AGI value from output forms porperty.
                    //25Jun2014 Sathish called AGI work flow with no validation to avoid error message update for the defect #TAX1040-14036
                    var outputGetData = Microsoft.Activities.Extensions.WorkflowArguments.FromDictionary(WorkflowInvoker.Invoke(new F1040EZAdjustedGrossIncomeWithNoValidation(), input));

                    //30thJune2014 Ashok added for Form 8862 Pdf Binding
                    if (taxObject != null && taxObject.Credits != null && taxObject.Credits.EIC != null)
                    {
                        if (taxObject.Income == null)
                        {
                            taxObject.Income = new Income();
                        }
                        if (taxObject.Income.Form8862 == null)
                        {
                            taxObject.Income.Form8862 = new Form8862();
                        }

                        if (taxObject.Credits.EIC.HasClaimedAsQualifyingChild.HasValue)
                        {
                            taxObject.Income.Form8862.HasClaimedAsQualifyingChild = taxObject.Credits.EIC.HasClaimedAsQualifyingChild.Value;
                        }
                        else
                        {
                            taxObject.Income.Form8862.HasClaimedAsQualifyingChild = false;
                        }

                        if (taxObject.Credits.EIC.HasIncorrectlyReportedEarnedIncome.HasValue)
                        {
                            taxObject.Income.Form8862.HasReportedIncorrectIncome = taxObject.Credits.EIC.HasIncorrectlyReportedEarnedIncome.Value;
                        }
                        else
                        {
                            taxObject.Income.Form8862.HasReportedIncorrectIncome = false;
                        }

                        // 01Jul2014 Sathish checked nullable value and set zero
                        taxObject.Income.Form8862.DaysLivedInUS       = (taxObject.Credits.EIC.NumberOfDaysTaxPayerLivedInUS.HasValue) ? taxObject.Credits.EIC.NumberOfDaysTaxPayerLivedInUS.Value : 0;
                        taxObject.Income.Form8862.DaysSpouseLivedInUS = (taxObject.Credits.EIC.NumberOfDaysSpouseLivedInUS.HasValue) ? taxObject.Credits.EIC.NumberOfDaysSpouseLivedInUS.Value : 0;
                        taxObject.Income.Form8862.FormFilingTaxYear   = 2013;
                        taxObject.Income.IsForm8862Required           = true;
                    }

                    input.ErrorMessages = errorMessages;
                    //Checking EIC Eligibility check
                    var output = Microsoft.Activities.Extensions.WorkflowArguments.FromDictionary(WorkflowInvoker.Invoke(new F1040EZEICEligibilityRuleCheck(), input));


                    taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.TAX_AND_WRAP_UP_TAXABLE_INCOME);
                    taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.TAX_AND_WRAP_UP_REQUIRED_REFUND_DETAIL);
                    taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.TAX_AND_WRAP_UP_MISSING_INCOME);
                    taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.OTHERINCOME_TAXABLE_SOCIAL_SECURITY_AND_RAILROAD_BENEFITS);

                    dynamic federalSummaryInput = new Microsoft.Activities.Extensions.WorkflowArguments();
                    federalSummaryInput.Tax1040Object             = taxObject;
                    federalSummaryInput.IsRefundAvailableCheck    = true;
                    federalSummaryInput.IsIncomeAndRefundAllZeros = true;
                    //25 Aug 2014-Vincent- Added the SSB and RRB check in FederalSummaryWithNoValidation
                    federalSummaryInput.IsSSBAndRRBCheck = true;
                    federalSummaryInput.ErrorMessages    = errorMessages;
                    output = Microsoft.Activities.Extensions.WorkflowArguments.FromDictionary(
                        WorkflowInvoker.Invoke(new FederalSummaryWithNoValidation(), federalSummaryInput));

                    //Persist TaxObject.
                    taxReturnData.UserDataId = Utilities.PersistTaxObject(userId, taxReturnData.UserDataId, taxObject);

                    //Vincent, 2-sep-14, Persist Audit information
                    string description = "Persit EarnedIncomeCredit, ClassName: {0}, Method Name: {1}";
                    Utilities.PersistAuditInfo(userId, taxReturnData.UserDataId, description, this.GetType().Name, Constants.Tab_EARNED_INCOME_CREDITS, Constants.TOPIC_EARNED_INCOME_CREDIT);
                }

                return(taxReturnData.UserDataId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Delete and then Persist Form1099G.
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="userDataId"></param>
        /// <param name="form1099GId"></param>
        /// <param name="errorMessageList"></param>
        public void DeleteAndPersistUnemployment(UserDTO userDTO, Tax1040.BusinessObject.Tax1040 refTaxObject = null) // 05Jun2014 Sathish added optional parameter taxobject used in delete spouse info while changing filling status MFJ to single
        {
            try
            {
                // 05Jun2014 Sathish check optional parameter which is used in deleting spouse info
                if (refTaxObject == null)
                {
                    //Retrieving TaxObject from database
                    taxObject = Utilities.GetTaxObjectByUserIdAndUserDataId(userDTO.UserId, userDTO.UserDataId);
                }
                else
                {
                    taxObject = refTaxObject;
                }

                //Converting Json to Form1099G by DeSerializing
                if (taxObject != null && taxObject.Income != null && taxObject.Income.Form1099G != null)
                {
                    int index = taxObject.Income.Form1099G.FindIndex(form => form.Form1099GId == userDTO.FormId);

                    if (index >= 0)
                    {
                        //Delete the current Form1099G object.
                        taxObject.Income.Form1099G.RemoveAt(index);

                        // Clear the Error messages
                        messageRepository.ClearErrorMessages(taxObject.ErrorMessages, Constants.TOPIC_UNEMPLOYMENT_COMPENSATION, userDTO.FormId);
                    }


                    //10Jul2014 Sathish added coded to check Taxable Income Eligibility
                    dynamic input = new Microsoft.Activities.Extensions.WorkflowArguments();
                    input.Tax1040Object = taxObject;

                    //Obtain the List of Error Messages from DB.
                    //var errorMessagesFromDB = messageRepository.GetErrorMessages();
                    var errorMessagesFromDB = HttpRuntime.Cache["ErrorMessageCollection"] as Dictionary <string, ErrorMessage>;
                    var errorMessagesAll    = new ErrorMessages(errorMessagesFromDB);
                    //Assisn error message list into workflow input param.
                    input.ErrorMessages = errorMessagesAll;

                    //10Jul2014 Sathish added coded to check Taxable Income Eligibility
                    taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.TAX_AND_WRAP_UP_TAXABLE_INCOME);

                    taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.TAX_AND_WRAP_UP_REQUIRED_REFUND_DETAIL);
                    taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.TAX_AND_WRAP_UP_MISSING_INCOME);
                    taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.OTHERINCOME_TAXABLE_SOCIAL_SECURITY_AND_RAILROAD_BENEFITS);

                    // var taxableIncome = Microsoft.Activities.Extensions.WorkflowArguments.FromDictionary(WorkflowInvoker.Invoke(new F1040EZTaxableIncomeEligibilityCheck(), input));
                    dynamic federalSummaryInput = new Microsoft.Activities.Extensions.WorkflowArguments();
                    federalSummaryInput.Tax1040Object = taxObject;
                    federalSummaryInput.IsTaxableIncomeExceedCheck = true;
                    federalSummaryInput.IsRefundAvailableCheck     = true;
                    federalSummaryInput.IsIncomeAndRefundAllZeros  = true;
                    //25 Aug 2014-Vincent- Added the SSB and RRB check in FederalSummaryWithNoValidation
                    federalSummaryInput.IsSSBAndRRBCheck = true;
                    federalSummaryInput.ErrorMessages    = errorMessagesAll;
                    var output = Microsoft.Activities.Extensions.WorkflowArguments.FromDictionary(
                        WorkflowInvoker.Invoke(new FederalSummaryWithNoValidation(), federalSummaryInput));

                    //Added by Ashok for EIC Eligibility Check
                    // Clear the Error messages
                    //messageRepository.ClearErrorMessages(taxObject.ErrorMessages, Constants.TOPIC_EARNED_INCOME_CREDIT);

                    //03Sep2014-Thileep Changed code to Remove EIC errormessages which has Message Type EI only
                    taxObject.ErrorMessages.RemoveAll(err => err.Topic == Constants.TOPIC_EARNED_INCOME_CREDIT && (err.MessageType == Constants.MESSAGE_TYPE_EI));

                    dynamic eicEligbilityInput = new Microsoft.Activities.Extensions.WorkflowArguments();
                    eicEligbilityInput.Tax1040Object = taxObject;
                    eicEligbilityInput.ErrorMessages = errorMessagesAll;
                    //Check if EIC with espect to AGI
                    output = AGICheck(taxObject, input);
                    //02Sep2014-  Thileep added  to Remove EIC Error messages when EIC Eligibility fails
                    if (!output.HasEarnedIncomeCredit)
                    {
                        taxObject.ErrorMessages.RemoveAll(err => err.Topic == Constants.TOPIC_EARNED_INCOME_CREDIT &&
                                                          (err.MessageType == Constants.MESSAGE_TYPE_RF || err.MessageType == Constants.MESSAGE_TYPE_V || err.MessageType == Constants.MESSAGE_TYPE_BR));
                    }
                }

                //Persist latest TaxObject.
                Utilities.PersistTaxObject(userDTO.UserId, userDTO.UserDataId, taxObject);

                //02-Sep-2014 Bhavani Audit functionality implementation
                var description = "Delete Unemployment: " + userDTO.FormId + ", ClassName: {0}, Method Name: {1}";
                Utilities.PersistAuditInfo(userDTO.UserId, userDTO.UserDataId, description, GetType().Name, Constants.Tab_INCOME, Constants.TOPIC_UNEMPLOYMENT_COMPENSATION);
            }
            catch (Exception ex)
            {
                ExceptionHandling.LogException(userDTO.UserId, "Class:UnemploymentRepository,Method Name:DeleteAndPersistUnemployment", ex);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="taxReturnData"></param>
        /// <returns></returns>
        public Tuple <long, bool> PersistTaxesAndWrapUpData(long userId, TaxReturnData taxReturnData)
        {
            Tuple <long, bool> userData = null;

            try
            {
                JTL.Tax1040.BusinessObject.Tax1040 taxObject;

                //Retrieving TaxObject from database
                taxObject = Utilities.GetTaxObjectByUserIdAndUserDataId(userId, taxReturnData.UserDataId);


                //28May2014 Sathish Creat person if person detail not updated. Used in federal tax and wrap up work flow for line 10 calc.
                if (taxObject == null || taxObject.PersonalDetails == null || taxObject.PersonalDetails.PrimaryTaxPayer == null)
                {
                    if (taxObject == null)
                    {
                        taxObject = new BusinessObject.Tax1040()
                        {
                            PersonalDetails = new PersonalDetails()
                            {
                                PrimaryTaxPayer = new PrimaryTaxPayer()
                                {
                                    FilingStatus = FilingStatus.Single,
                                    Person       = new Person()
                                }
                            }
                        }
                    }
                    ;

                    if (taxObject.PersonalDetails == null)
                    {
                        taxObject.PersonalDetails = new PersonalDetails()
                        {
                            PrimaryTaxPayer = new PrimaryTaxPayer()
                            {
                                FilingStatus = FilingStatus.Single,
                                Person       = new Person()
                            }
                        };
                    }

                    if (taxObject.PersonalDetails.PrimaryTaxPayer == null)
                    {
                        taxObject.PersonalDetails.PrimaryTaxPayer = new PrimaryTaxPayer()
                        {
                            FilingStatus = FilingStatus.Single,
                            Person       = new Person()
                        };
                    }

                    Tuple <long, bool> userDataId = personalInfoRepository.PersistPrimaryTaxPayer(taxObject.PersonalDetails.PrimaryTaxPayer, userId, taxReturnData.UserDataId, Constants.TOPIC_PERSONAL_FILINGSTATUS);

                    taxReturnData.UserDataId = userDataId.Item1;

                    //Retrieving TaxObject from database
                    //26Aug2014 Sathish Get Tax object after personal info persist to get the error message list
                    taxObject = Utilities.GetTaxObjectByUserIdAndUserDataId(userId, taxReturnData.UserDataId);
                }



                //Converting Json to OtherIncome by DeSerializing
                TaxesAndPenalties taxesAndPenalties = JsonConvert.DeserializeObject <TaxesAndPenalties>(taxReturnData.TaxData);

                if (taxObject != null && taxesAndPenalties != null)
                {
                    taxObject.TaxesAndPenalties = new TaxesAndPenalties();
                    taxObject.TaxesAndPenalties = taxesAndPenalties;
                }

                if (taxObject.ErrorMessages == null)
                {
                    taxObject.ErrorMessages = new List <ErrorMessage>();
                }


                // Clear the Error messages exist for this topic.
                messageRepository.ClearErrorMessages(taxObject.ErrorMessages, Constants.TOPIC_TAX_AND_WRAPUP);


                //Workflow Validation Section
                dynamic input = new Microsoft.Activities.Extensions.WorkflowArguments();
                input.Tax1040Object = taxObject;

                //var errorMessage = messageRepository.GetErrorMessages();
                var errorMessage  = HttpRuntime.Cache["ErrorMessageCollection"] as Dictionary <string, ErrorMessage>;
                var errorMessages = new ErrorMessages(errorMessage);
                input.ErrorMessages = errorMessages;


                //BusinessFieldValidations(otherIncome, taxObject.ErrorMessages, errorMessages);
                if (taxObject.TaxesAndPenalties != null)
                {
                    var output = Microsoft.Activities.Extensions.WorkflowArguments.FromDictionary(WorkflowInvoker.Invoke(new TaxAndWrapUpEligibilityCheck(), input));
                    hasEligibilityDiagnostics = taxObject.ErrorMessages.Any(em => em.Topic == Constants.TOPIC_TAX_AND_WRAPUP && em.ErrorCode.StartsWith(Constants.TOPIC_TAX_AND_WRAPUP + "_ER"));

                    taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.TAX_AND_WRAP_UP_REQUIRED_REFUND_DETAIL);
                    taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.TAX_AND_WRAP_UP_MISSING_INCOME);
                    dynamic federalSummaryInput = new Microsoft.Activities.Extensions.WorkflowArguments();
                    federalSummaryInput.Tax1040Object = taxObject;
                    federalSummaryInput.IsTaxableIncomeExceedCheck = true;
                    federalSummaryInput.IsRefundAvailableCheck     = true;
                    federalSummaryInput.IsIncomeAndRefundAllZeros  = true;
                    federalSummaryInput.ErrorMessages = errorMessages;
                    output = Microsoft.Activities.Extensions.WorkflowArguments.FromDictionary(
                        WorkflowInvoker.Invoke(new FederalSummaryWithNoValidation(), federalSummaryInput));
                }

                BusinessValidation(taxObject.TaxesAndPenalties, taxObject.ErrorMessages, errorMessages);

                taxReturnData.UserDataId = Utilities.PersistTaxObject(userId, taxReturnData.UserDataId, taxObject);


                userData = new Tuple <long, bool>(taxReturnData.UserDataId, hasEligibilityDiagnostics);

                //vincent, 2-sep-14, Persist Audit information
                string description = "Persist TaxesAndWrapUpData, ClassName: {0}, Method Name: {1}";
                Utilities.PersistAuditInfo(userId, taxReturnData.UserDataId, description, this.GetType().Name, Constants.Tab_TAX_AND_WRAPUP, Constants.TOPIC_TAX_AND_WRAPUP);
            }
            catch (Exception ex)
            {
                ExceptionHandling.LogException(userId, "Class:TaxesAndWrapUpRepository,Method Name:PersistTaxesAndWrapUpData", ex);
            }
            return(userData);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Create and Persist Unemployment
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="taxReturnData"></param>
        /// <returns></returns>
        public dynamic CreateAndPersistUnemployment(long userId, TaxReturnData taxReturnData)
        {
            dynamic userDataIDand1099GId = new ExpandoObject();
            long    form1099GId          = 0;

            try
            {
                //Retrieving TaxObject from database
                taxObject = Utilities.GetTaxObjectByUserIdAndUserDataId(userId, taxReturnData.UserDataId);

                //Converting Json to Form1099G by DeSerializing
                Form1099G form1099g = JsonConvert.DeserializeObject <Form1099G>(taxReturnData.TaxData);
                if (taxObject != null)
                {
                    //Get TaxPayer and Spouse Names.
                    taxPayerAndSpouseNames = Utilities.GetTaxPayerAndSpouseName(taxObject);

                    if (taxObject.Income == null)
                    {
                        taxObject.Income = new Income();
                    }
                }

                if (taxObject.Income.Form1099G != null && taxObject.Income.Form1099G.Any())
                {
                    int index = taxObject.Income.Form1099G.FindIndex(form => form.Form1099GId == form1099g.Form1099GId);

                    if (index < 0)
                    {
                        //Saravanan N - 3rd April, 2014 - Current Form1099G is new one. So created ID for this.
                        form1099g.Form1099GId = taxObject.Income.Form1099G.Max(frm => frm.Form1099GId) + 1;

                        //Adding new Form1099G to the TaxObject Form1099GList
                        taxObject.Income.Form1099G.Add(form1099g);
                        form1099GId = 0;
                    }
                    else
                    {
                        taxObject.Income.Form1099G[index] = form1099g;
                        form1099GId = form1099g.Form1099GId;
                    }
                }
                else
                {
                    //Saravanan N - 3rd April, 2014 - Form1099G doesn't exists for this user. Hence, assign 1 as its ID.
                    form1099g.Form1099GId = 1;

                    //Creating Instance if Form1099GList section is Null
                    taxObject.Income.Form1099G = new List <Form1099G> {
                        form1099g
                    };
                    form1099GId = 0;
                    //Adding new Form1099G to the TaxObject W2List
                }

                if (taxObject.ErrorMessages == null)
                {
                    taxObject.ErrorMessages = new List <ErrorMessage>();
                }

                //Retrieving Error Message list from Database
                messageRepository = new MessagesRepository();
                //var errorMessage = messageRepository.GetErrorMessages();

                var errorMessage  = HttpRuntime.Cache["ErrorMessageCollection"] as Dictionary <string, ErrorMessage>;
                var errorMessages = new ErrorMessages(errorMessage);

                // Clear the Error messages
                messageRepository.ClearErrorMessages(taxObject.ErrorMessages, Constants.TOPIC_UNEMPLOYMENT_COMPENSATION);

                //Required and Validation check for current Form1099G.
                FilingStatus filingStatus = FilingStatus.None;
                if (taxObject.PersonalDetails != null && taxObject.PersonalDetails.PrimaryTaxPayer != null)
                {
                    filingStatus = taxObject.PersonalDetails.PrimaryTaxPayer.FilingStatus;
                }
                if (taxObject.Income.Form1099G != null && taxObject.Income.Form1099G.Any())
                {
                    BusinessFieldValidations(taxObject.Income.Form1099G, filingStatus, taxObject.ErrorMessages, errorMessages);
                }

                // Clear the Error messages
                //messageRepository.ClearErrorMessages(taxObject.ErrorMessages, Constants.TOPIC_EARNED_INCOME_CREDIT);
                //02Sep2014-Thileep Changed code to Remove EIC errormessages which has Message Type EI only
                taxObject.ErrorMessages.RemoveAll(err => err.Topic == Constants.TOPIC_EARNED_INCOME_CREDIT && (err.MessageType == Constants.MESSAGE_TYPE_EI));


                //14thJuly2014 Ashok - Added logic for Clearing EIC Worksheet, Form 8862 and EIC classes when failing EIC eligibility
                dynamic input = new Microsoft.Activities.Extensions.WorkflowArguments();
                input.Tax1040Object = taxObject;
                input.ErrorMessages = errorMessages;

                //Check if EIC with espect to AGI
                var output = AGICheck(taxObject, input);

                //Invoking Business Rules Validation Workflow
                //dynamic input = new Microsoft.Activities.Extensions.WorkflowArguments();
                //input.Tax1040Object = taxObject;
                input.ErrorMessages = errorMessages;
                output = Microsoft.Activities.Extensions.WorkflowArguments.FromDictionary(WorkflowInvoker.Invoke(new
                                                                                                                 F1099GBusinessValidationRule(), input));


                //10Jul2014 Sathish added coded to check Taxable Income Eligibility
                taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.TAX_AND_WRAP_UP_TAXABLE_INCOME);

                taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.TAX_AND_WRAP_UP_REQUIRED_REFUND_DETAIL);
                taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.TAX_AND_WRAP_UP_MISSING_INCOME);
                taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.OTHERINCOME_TAXABLE_SOCIAL_SECURITY_AND_RAILROAD_BENEFITS);

                // var taxableIncome = Microsoft.Activities.Extensions.WorkflowArguments.FromDictionary(WorkflowInvoker.Invoke(new F1040EZTaxableIncomeEligibilityCheck(), input));
                dynamic federalSummaryInput = new Microsoft.Activities.Extensions.WorkflowArguments();
                federalSummaryInput.Tax1040Object = taxObject;
                federalSummaryInput.IsTaxableIncomeExceedCheck = true;
                federalSummaryInput.IsRefundAvailableCheck     = true;
                federalSummaryInput.IsIncomeAndRefundAllZeros  = true;
                //25 Aug 2014-Vincent- Added the SSB and RRB check in FederalSummaryWithNoValidation
                federalSummaryInput.IsSSBAndRRBCheck = true;
                federalSummaryInput.ErrorMessages    = errorMessages;
                output = Microsoft.Activities.Extensions.WorkflowArguments.FromDictionary(
                    WorkflowInvoker.Invoke(new FederalSummaryWithNoValidation(), federalSummaryInput));


                //Saravanan N - 7th May, 2014 - Check if any hard stop (Eligibility Check found) in workflow for Unemployment.
                var isEligibilityCheckFailed = taxObject.ErrorMessages.Any(errMsg => errMsg.Topic ==
                                                                           Constants.TOPIC_UNEMPLOYMENT_COMPENSATION && errMsg.ErrorCode.Equals(Constants.F1099G__REPAID_AMOUNT_FOR_EARLIER_YEAR));

                //Added by Ashok for EIC Eligibility Check
                // Clear the Error messages
                //messageRepository.ClearErrorMessages(taxObject.ErrorMessages, Constants.TOPIC_EARNED_INCOME_CREDIT);

                //03Sep2014-Thileep Changed code to Remove EIC errormessages which has Message Type EI only
                taxObject.ErrorMessages.RemoveAll(err => err.Topic == Constants.TOPIC_EARNED_INCOME_CREDIT && (err.MessageType == Constants.MESSAGE_TYPE_EI));

                dynamic eicEligbilityInput = new Microsoft.Activities.Extensions.WorkflowArguments();
                eicEligbilityInput.Tax1040Object = taxObject;
                eicEligbilityInput.ErrorMessages = errorMessages;
                //Check if EIC with espect to AGI
                output = AGICheck(taxObject, input);

                //02Sep2014-  Thileep added  to Remove EIC Error messages when EIC Eligibility fails
                if (!output.HasEarnedIncomeCredit)
                {
                    taxObject.ErrorMessages.RemoveAll(err => err.Topic == Constants.TOPIC_EARNED_INCOME_CREDIT &&
                                                      (err.MessageType == Constants.MESSAGE_TYPE_RF || err.MessageType == Constants.MESSAGE_TYPE_V || err.MessageType == Constants.MESSAGE_TYPE_BR));
                }

                taxReturnData.UserDataId = Utilities.PersistTaxObject(userId, taxReturnData.UserDataId, taxObject);

                userDataIDand1099GId.UserDataId  = taxReturnData.UserDataId;
                userDataIDand1099GId.Form1099GId = form1099g.Form1099GId;
                userDataIDand1099GId.isEligibilityCheckFailed = isEligibilityCheckFailed;

                //02-Sep-2014 Bhavani Audit functionality implementation
                var description = form1099GId <= 0 ? "Persist Unemployment: " + form1099GId + ", ClassName: {0}, Method Name: {1}"
                                                   : "Update Unemployment: " + form1099GId + ", ClassName: {0}, Method Name: {1}";
                Utilities.PersistAuditInfo(userId, taxReturnData.UserDataId, description, GetType().Name, Constants.Tab_INCOME, Constants.TOPIC_UNEMPLOYMENT_COMPENSATION);
            }
            catch (Exception ex)
            {
                ExceptionHandling.LogException(userId, "Class:UnemploymentRepository,Method Name:CreateAndPersistUnemployment", ex);
            }

            return(userDataIDand1099GId);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Delete and then Persist Form1099G.
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="userDataId"></param>
        /// <param name="form1099GId"></param>
        /// <param name="errorMessageList"></param>
        public void DeleteAndPersistOtherIncome(long userId, long userDataId, OtherIncomeType otherIncomeType)
        {
            JTL.Tax1040.BusinessObject.Tax1040 taxObject;
            try
            {
                //Retrieving TaxObject from database
                taxObject = Utilities.GetTaxObjectByUserIdAndUserDataId(userId, userDataId);

                //Converting Json to Form1099G by DeSerializing
                if (taxObject != null && taxObject.Income != null && taxObject.Income.OtherIncome != null)
                {
                    switch (otherIncomeType)
                    {
                    case OtherIncomeType.SocialSecurityAndRailRoadBenefits:
                        taxObject.Income.OtherIncome.SSB          = null;
                        taxObject.Income.OtherIncome.RRB          = null;
                        taxObject.Income.OtherIncome.HasSsbAndRrb = false;
                        // Clear the Error messages
                        messageRepository.ClearErrorMessages(taxObject.ErrorMessages, Constants.TOPIC_OTHER_INCOME_SSB_RRB);

                        //Vincent - 17 June, 2014 - Clear Eligibility HardStopper Errors.
                        messageRepository.ClearErrorMessages(taxObject.ErrorMessages, Constants.TOPIC_OTHER_INCOME, 0, "OtherIncome_ER2");
                        //Yogalakshmi - 2nd July 2014 - To clear the datas in SSB & RRB Worksheet when the records are deleted.
                        if (taxObject.F1040EZ != null && taxObject.F1040EZ.F1040EZWorkSheets != null &&
                            taxObject.F1040EZ.F1040EZWorkSheets.SSBWorkSheet != null)
                        {
                            taxObject.F1040EZ.F1040EZWorkSheets.SSBWorkSheet = null;
                            Utilities.PersistTaxObject(userId, userDataId, taxObject);
                        }
                        break;

                    case OtherIncomeType.AlaskaDividendIncome:
                        taxObject.Income.OtherIncome.AlaskaPermanentFundDividend = null;
                        taxObject.Income.OtherIncome.HasAlaskaPermanantFund      = false;
                        // Clear the Error messages
                        messageRepository.ClearErrorMessages(taxObject.ErrorMessages, Constants.TOPIC_OTHER_INCOME_Alaska);

                        break;

                    //Added by prasana on 15.07.2014 after Income spec update 2.3
                    case OtherIncomeType.StateTaxRefund:
                        taxObject.Income.OtherIncome.StateOrLocalIncomeTaxRefunds          = null;
                        taxObject.Income.OtherIncome.HasStateTaxRefund                     = false;
                        taxObject.Income.OtherIncome.HasStateAndLocalTaxDeductionPriorYear = false;
                        // Clear the Error messages
                        messageRepository.ClearErrorMessages(taxObject.ErrorMessages, Constants.TOPIC_OTHER_INCOME_State_And_Local);
                        break;
                    }

                    //10Jul2014 Sathish added coded to check Taxable Income Eligibility
                    dynamic input = new Microsoft.Activities.Extensions.WorkflowArguments();
                    input.Tax1040Object = taxObject;

                    //Obtain the List of Error Messages from DB.
                    //var errorMessagesFromDB = messageRepository.GetErrorMessages();
                    var errorMessagesFromDB = HttpRuntime.Cache["ErrorMessageCollection"] as Dictionary <string, ErrorMessage>;
                    var errorMessagesAll    = new ErrorMessages(errorMessagesFromDB);
                    //Assisn error message list into workflow input param.
                    input.ErrorMessages = errorMessagesAll;

                    //10Jul2014 Sathish added coded to check Taxable Income Eligibility
                    taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.TAX_AND_WRAP_UP_TAXABLE_INCOME);
                    var taxableIncome = Microsoft.Activities.Extensions.WorkflowArguments.FromDictionary(WorkflowInvoker.Invoke
                                                                                                             (new F1040EZTaxableIncomeEligibilityCheck(), input));

                    //02-Sep-2014 Bhavani Audit functionality implementation

                    var topicName = string.Empty;
                    switch (otherIncomeType)
                    {
                    case OtherIncomeType.AlaskaDividendIncome:
                        topicName = Constants.TOPIC_OTHER_INCOME_Alaska;
                        break;

                    case OtherIncomeType.StateTaxRefund:
                        topicName = Constants.TOPIC_OTHER_INCOME_State_And_Local;
                        break;

                    case OtherIncomeType.SocialSecurityAndRailRoadBenefits:
                        topicName = Constants.TOPIC_OTHER_INCOME_SSB_RRB;
                        break;
                    }
                    var description = "Delete OtherIncome: " + otherIncomeType + ", ClassName: {0}, Method Name: {1}";
                    Utilities.PersistAuditInfo(userId, userDataId, description, GetType().Name, Constants.Tab_INCOME, topicName);
                }


                //Persist latest TaxObject.
                taxReturnDataService.PersistTaxReturnData(userId, string.Empty, Utilities.ConvertTaxObjectToJSON(taxObject), string.Empty, userDataId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }