public void PopulateBasisOfCoverTest()
        {
            var document = new UnitTestDocument {
                MockBookmarks = new List <string> {
                    "aBookMark", "bBookMark", "cBookMark"
                }
            };

            var view   = new UnitTestDocumentView();
            var target = new InsuranceRenewealReportWizardPresenter(document, view);
            var frags  = new List <IPolicyClass>();


            for (int i = 0; i < 2; i++)
            {
                var newFrag = new PolicyClass {
                    MajorClass = "A", Title = "A" + i, Url = "http//A" + i
                };
                frags.Add(newFrag);
            }

            for (int i = 0; i < 3; i++)
            {
                var newFrag = new PolicyClass {
                    MajorClass = "B", Title = "B" + i, Url = "http//B" + i
                };
                frags.Add(newFrag);
            }
            target.PopulateBasisOfCover(frags, "http://templates.oamps.com.au/Fragments/Class%20of%20Insurance.docx");
        }
Beispiel #2
0
        public IInsuranceManual LoadIncludedPolicyClasses(IInsuranceManual template)
        {
            //load selected policy classes
            template.SelectedPolicyClasses = new List <IPolicyClass>();
            string items = Document.GetPropertyValue(Constants.WordDocumentProperties.IncludedPolicyTypes);

            // var regex = new Regex(Constants.Seperators.Lineseperator);
            //  var split = regex.Split(items);
            foreach (string i in items.Split(';'))
            //foreach (var i in split)
            {
                string[] d = i.Split('_');
                if (d.Length == 3)
                {
                    var p = new PolicyClass
                    {
                        Id = (d.Length == 0) ? string.Empty : d[0].ToString(CultureInfo.InvariantCulture),
                        RecommendedInsurer   = Document.ReadContentControlValue(d[2]),
                        CurrentInsurer       = Document.ReadContentControlValue(d[1]),
                        RecommendedInsurerId = d[2].Substring(0, d[2].IndexOf("r", StringComparison.Ordinal)),
                        CurrentInsurerId     = d[1].Substring(0, d[1].IndexOf("c", StringComparison.Ordinal)),
                        Order = int.Parse(d[2].Substring(d[2].IndexOf("r", StringComparison.Ordinal) + 1))
                    };
                    template.SelectedPolicyClasses.Add(p);
                }
            }
            return(template);
        }
Beispiel #3
0
        public IInsuranceRenewalReport LoadIncludedPolicyClasses(IInsuranceRenewalReport template)
        {
            //load selected policy classes
            template.SelectedDocumentFragments = new List <IPolicyClass>();
            var items = Document.GetPropertyValue(Helpers.Constants.WordDocumentProperties.IncludedPolicyTypes);

            foreach (var i in items.Split(';'))
            {
                var d = i.Split('_');
                if (d.Length == 3)
                {
                    var p = new PolicyClass
                    {
                        Id = (d.Length == 0) ? string.Empty : d[0].ToString(CultureInfo.InvariantCulture),
                        RecommendedInsurer   = Document.ReadContentControlValue(d[1].ToString()),
                        CurrentInsurer       = Document.ReadContentControlValue(d[2].ToString()),
                        RecommendedInsurerId = d[2].Substring(0, d[2].IndexOf("r")),
                        CurrentInsurerId     = d[1].Substring(0, d[1].IndexOf("c")),
                        Order = int.Parse(d[2].Substring(d[2].IndexOf("r") + 1))
                    };
                    template.SelectedDocumentFragments.Add(p);
                }
            }
            return(template);
        }
Beispiel #4
0
        ///-------------------------------------------------------------------------------------------------
        /// <summary> Method that is called before each annual run. </summary>
        /// <param name="year"> The year about to be run. </param>
        /// <param name="WSim"> The WaterSimManager that is making call. </param>
        /// <returns> true if it succeeds, false if it fails. Error should be placed in FErrorMessage.
        ///     </returns>
        ///-------------------------------------------------------------------------------------------------

        public override bool PreProcess(int year, WaterSimManagerClass WSimClass)
        {
            WaterSimManager WSim = (WSimClass as WaterSimManager);
            //               ProviderIntArray NewPopOff = new ProviderIntArray(0);

            bool TempLock = WSim.isLocked();

            WSim.UnLockSimulation();


            //bool ManagingPop = false;
            // for 2000 to 2010 just grab the projections
            if (year < 2015)
            {
            }        //WSim.Simulation_Start_Year + 1))
            else
            {
                ProviderIntArray YearForZero = WSim.ParamManager.Model_ParameterBaseClass(eModelParam.epYearCreditsGoesNeg).ProviderProperty.getvalues();
                ProviderIntArray IsTriggered = new ProviderIntArray(0);
                // Check which are in unassured year range
                for (int i = 0; i < YearForZero.Length; i++)
                {
                    if (TestPolicy(YearForZero[i], (WSim as WaterSimManager)))
                    {
                        ConsecutiveDeficitYears[i]++;
                        if (ConsecutiveDeficitYears[i] > Max_Years_Deficit_Trigger)
                        {
                            IsTriggered[i] = 1;
                            // Once triggered always being managed
                            BeingManaged[i] = 1;
                        }
                    }
                    else
                    {
                        ConsecutiveDeficitYears[i] = 0;
                    }
                }
                PolicyClass.ManagePolicies(WSim, year, BeingManaged, IsTriggered);
                //PopulationClass.LimitAndReallocateGrowth(WSim, year, BeingManaged, IsTriggered, FMaxUnassuredYears, ref NewPopOn, ref NewPopOff);
            }
            // Ok Set PopOverride Values
            //    for (int i = 0; i < NewPopOn.Length; i++)
            //    {
            //        WSim.Population_Override_On[i] = NewPopOn[i];
            //    }
            //    for (int i = 0; i < NewPopOff.Length; i++)
            //    {
            //        WSim.Population_Override_Other[i] = NewPopOff[i];
            //    }
            //    if (TempLock) WSim.LockSimulation();

            return(base.PreProcess(year, WSim));
        }
        public List <IPolicyClass> ReadPoliciesInDocument()
        {
            var items = new List <IPolicyClass>();

            int rowcount = Document.TableRowOrColumnCount(false, Constants.WordTables.RenewalLetterPolicies);

            for (int i = 1; i <= rowcount; i++)
            {
                var item = new PolicyClass
                {
                    Title = Document.ReadTableCell(i, 1, Constants.WordTables.RenewalLetterPolicies)
                };
                items.Add(item);
            }
            return(items);
        }
        public IInsuranceRenewalReport LoadIncludedPolicyClasses(IInsuranceRenewalReport template)
        {
            //load selected policy classes
            template.SelectedDocumentFragments = new List <IPolicyClass>();
            var items = Document.GetPropertyValue(Helpers.Constants.WordDocumentProperties.IncludedPolicyTypes);

            foreach (var i in items.Split(';'))
            {
                if (!string.IsNullOrEmpty(i))
                {
                    var p = new PolicyClass
                    {
                        //Title = i.ToString(CultureInfo.InvariantCulture)
                        Id = i
                    };
                    template.SelectedDocumentFragments.Add(p);
                }
            }
            return(template);
        }
        private void StoreSelectedPolicies()
        {
            //tvaPolicies.AllNodes.ToList().ForEach(
            //    (x) =>
            foreach (var x in tvaPolicies.AllNodes)
            {
                var nodeControl = tvaPolicies.GetNodeControls(x);
                var checkbox    = nodeControl.FirstOrDefault(y => (y.Control is NodeCheckBox));

                //checkbox found
                var dCheckBox = (NodeCheckBox)checkbox.Control;
                if (dCheckBox != null)
                {
                    object value = dCheckBox.GetValue(x);

                    if ((bool)value)
                    {
                        NodeControlInfo policyClass =
                            nodeControl.FirstOrDefault(
                                y =>
                                (y.Control is NodeTextBox && y.Control.ParentColumn.Header == @"Policy Class"));
                        object policyClassValue = ((NodeTextBox)policyClass.Control).GetValue(x);

                        NodeControlInfo currentInsurer =
                            nodeControl.FirstOrDefault(
                                y =>
                                (y.Control is NodeTextBox && y.Control.ParentColumn.Header == @"Insurer/s"));
                        object currentInsurerValue = ((NodeTextBox)currentInsurer.Control).GetValue(x);


                        NodeControlInfo currentId =
                            nodeControl.FirstOrDefault(
                                y => (y.Control is NodeTextBox && y.Control.ParentColumn.Header == @"InsurerId"));
                        object currentIdValue = ((NodeTextBox)currentId.Control).GetValue(x);

                        NodeControlInfo order =
                            nodeControl.FirstOrDefault(
                                y => (y.Control is NodeTextBox && y.Control.ParentColumn.Header == @"Order"));
                        object orderValue = ((NodeTextBox)order.Control).GetValue(x);


                        NodeControlInfo policyNumber =
                            nodeControl.FirstOrDefault(
                                y => (y.Control is NodeTextBox && y.Control.ParentColumn.Header == @"Policy Number"));
                        object policyNumberValue = ((NodeTextBox)policyNumber.Control).GetValue(x);


                        NodeControlInfo policyId =
                            nodeControl.FirstOrDefault(
                                y => (y.Control is NodeTextBox && y.Control.ParentColumn.Header == @"HiddenPolicyId"));
                        object policyIdValue = ((NodeTextBox)policyId.Control).GetValue(x);

                        //var item = MinorItems.Find(i => i.Title == policyClassValue.ToString());
                        // var item = MinorItems.Find(i => i.Title == policyClassValue.ToString() && i.MajorClass == x.Parent.Tag.ToString());
                        var item = new PolicyClass();
                        //if (item != null)


                        if (currentInsurerValue != null)
                        {
                            item.CurrentInsurer = currentInsurerValue.ToString();
                        }

                        var outOrder = 0;
                        int.TryParse(orderValue.ToString(), out outOrder);
                        //if (!String.IsNullOrEmpty(orderValue.ToString()) && int.TryParse(orderValue.ToString(), out outOrder))
                        //{

                        //}

                        //if (item != null)
                        //{

                        item.Order = outOrder;
                        item.Title = policyClassValue.ToString();

                        if (policyNumberValue != null)
                        {
                            item.PolicyNumber = policyNumberValue.ToString();
                        }

                        if (currentIdValue != null)
                        {
                            item.CurrentInsurerId = currentIdValue.ToString();
                        }


                        item.Id = policyIdValue.ToString();

                        var foundItem = MinorItems.Find(i => i.Title == policyClassValue.ToString() && i.MajorClass == x.Parent.Tag.ToString());

                        item.Id = foundItem == null ? "o" : policyIdValue.ToString();

                        //todo update listname to settings
                        if (policyClassValue != null)
                        {
                            var ps = LoadClaimsProcedure(Settings.Default.SharePointContextUrl, "Insurance Manual Claims Procedures", policyClassValue.ToString());
                            if (ps != null && ps.Url != null)
                            {
                                item.FragmentPolicyUrl = ps.Url;
                            }
                        }
                        _selectedPolicyClasses.Add(item);
                        //   }
                    }
                }
            }

            if (_selectedPolicyClasses != null)
            {
                _selectedPolicyClasses.Sort((x, y) => x.Order.CompareTo(y.Order));
            }
        }