Example #1
0
 public override void GenerateAnnex(int annexNumber)
 {
     if (Data.Count == 2)
     {
         var facility = (Data[0].IsActualSite) ? Data[1] : Data[0];
         MergeFacilityToMainDocument(FacilityViewModel
                                     .GetSeeAnnexInstructionForFacilityCaseTwoFacilities(facility, annexNumber), properties);
     }
     else
     {
         //The main document should show "See Annex" for all data if there is an annex.
         MergeFacilityToMainDocument(FacilityViewModel.GetSeeAnnexInstructionForFacility(annexNumber), properties);
     }
 }
Example #2
0
        public virtual void GenerateAnnex(int annexNumber)
        {
            var properties = PropertyHelper.GetPropertiesForViewModel(typeof(FacilityViewModel));

            TocText = "Annex " + annexNumber + " - Disposal or recovery facility";

            if (data.Count == 2)
            {
                //if the user enters two facilities:
                //the facility that is the "actual site" goes into an annex
                //the other site goes onto the notification document in block 10
                if (data[0].IsActualSite)
                {
                    MergeFacilityToMainDocument(FacilityViewModel.GetSeeAnnexInstructionForFacilityCaseTwoFacilities(data[1], annexNumber), properties);
                }
                else
                {
                    MergeFacilityToMainDocument(FacilityViewModel.GetSeeAnnexInstructionForFacilityCaseTwoFacilities(data[0], annexNumber), properties);
                }
            }
            else
            {
                //The main document should show "See Annex" for all data if there is an annex.
                MergeFacilityToMainDocument(FacilityViewModel.GetSeeAnnexInstructionForFacility(annexNumber), properties);
            }

            var indexOfActualSite = data.Where(x => x.IsActualSite).Select(data.IndexOf).Single();

            MergeActualSiteOfTreatmentInAnnex(data[indexOfActualSite], properties);
            data.RemoveAt(indexOfActualSite);

            MergeAnnexNumber(annexNumber);

            //If we only need actual site of treatment in the annex, clear the remaining annex fields and exit at this point.
            if (data.Count < 2)
            {
                ClearMultipleFacilitiesTable();
                return;
            }

            //Finally merge the remaining facilities into the multiple facilities table and set the annex title.
            MergeMultipleFacilitiesTable(properties);
        }