//----------------------------------------------------
        /// <summary>
        /// This is the ProcessMethod that keeps track of Deficits by provider
        /// </summary>
        /// <param name="year">Simulation Year (not used)</param>
        /// <param name="WSim">The WaterSimManager object (used to get data)</param>
        /// <returns></returns>
        override public bool PostProcess(int year, WaterSimManagerClass WSimClass)
        {
            WaterSimManager WSim = (WSimClass as WaterSimManager);

            ProviderIntArray Deficits       = new ProviderIntArray();
            ProviderIntArray CreditDeficits = new ProviderIntArray();

            // get the deficit data
            Deficits       = WSim.Demand_Deficit.getvalues();
            CreditDeficits = WSim.AF_water_CreditDeficits.getvalues();

            foreach (eProvider ep in ProviderClass.providers())
            {
                if (Deficits[ep] > FMaxDeficit)
                {
                    CountList[ep]++;
                    TotalList[ep] += Deficits[ep];
                    ContinuousList[ep]++;
                    if (LongestContinuous[ep] < ContinuousList[ep])
                    {
                        LongestContinuous[ep] = ContinuousList[ep];
                    }
                }
                else
                {
                    ContinuousList[ep] = 0;
                }
                //
                if (CreditDeficits[ep] > FMaxCreditDeficit)
                {
                    CountList_2[ep]++;
                    TotalList_2[ep] += CreditDeficits[ep];
                    ContinuousList_2[ep]++;
                    if (LongestContinuous_2[ep] < ContinuousList_2[ep])
                    {
                        LongestContinuous_2[ep] = ContinuousList_2[ep];
                    }
                }
            }
            return(true);
        }
Пример #2
0
        public bool WriteResults(SimulationResults SR, string ScenarioName, myVariables mine, System.IO.StreamWriter SW)
        {
            bool   result = false;
            string IDS    = "";
            string build  = wsim.ModelBuild;
            // get the start year
            int FirstYear = SR.StartYear;

            // loop through all years in SR
            for (int yeari = 0; yeari < SR.Length; yeari++)
            {
                // Set the calender year
                int ThisYear = FirstYear + yeari;
                if (ThisYear < 2060)
                {
                    // get results for this year
                    AnnualSimulationResults ASR = SR.ByYear(ThisYear);

                    // set the key, the scenario name and the year
                    string BaseStr = RecCount.ToString() + "," + '"' + build + '"' + "," + ScenarioName + ThisYear.ToString();
                    // now loop through base outputs and set those
                    int index = 0;
                    foreach (int emp in ASR.Outputs.BaseOutputModelParam)
                    {
                        // check if this is one of the output fields
                        if (isOutPutParam(mine, emp))
                        {
                            BaseStr += "," + ASR.Outputs.BaseOutput.Values[index].ToString();
                        }
                        index++;
                    }
                    // lopp through base inputs
                    index = 0;
                    foreach (int emp in ASR.Inputs.BaseInputModelParam)
                    {
                        if (isOutPutParam(mine, emp))
                        {
                            BaseStr += "," + ASR.Inputs.BaseInput.Values[index].ToString();
                        }
                        index++;
                    }
                    // OK, have all base stuff, now loop through providers
                    eProvider ep = eProvider.Regional;
                    //foreach (eProvider ep in ProviderClass.providersAll())
                    {
                        // Increment the rec count
                        RecCount++;
                        // set the base string
                        IDS = BaseStr + "," + '"' + ProviderClass.FieldName(ep) + '"';
                        // loop through provider outputs
                        index = 0;
                        foreach (int emp in ASR.Outputs.ProviderOutputModelParam)
                        {
                            // check if for output
                            if (isOutPutParam(mine, emp))
                            {
                                if ((ep < eProvider.Regional) || (ASR.Outputs.ProviderOutput[index].IncludesAggregates))
                                {
                                    IDS += "," + ASR.Outputs.ProviderOutput[index].Values[ProviderClass.index(ep, true)].ToString();
                                }
                                else
                                {
                                    IDS += "," + SpecialValues.MissingIntValue.ToString();
                                }
                            }
                            index++;
                        }
                        // loop through provider inputs
                        index = 0;
                        foreach (int emp in ASR.Inputs.ProviderInputModelParam)
                        {
                            // check if for output
                            if (isOutPutParam(mine, emp))
                            {
                                if ((ep < eProvider.Regional) || (ASR.Inputs.ProviderInput[index].IncludesAggregates))
                                {
                                    IDS += "," + ASR.Inputs.ProviderInput[index].Values[ProviderClass.index(ep, true)].ToString();
                                }
                                else
                                {
                                    IDS += "," + SpecialValues.MissingIntValue.ToString();
                                }
                            }
                            index++;
                        }
                        // ok write it out
                        SW.WriteLine(IDS);
                    } // provider
                }
            }         // year
            SW.Flush();
            result = true;
            return(result);
        }
Пример #3
0
 public void ThenTheProviderDetailsShouldBeUpdatedWithTheEmail()
 {
     Pages.ProviderPage ProviderPage = new Pages.ProviderPage(webDriver);
     ProviderPage.AccessProviderDetails();
     PageInteractionHelper.VerifyEditFieldText(OpenQA.Selenium.By.Id("Email"), ProviderClass.GetProviderInstance().EmailValue);
 }
Пример #4
0
 public void GivenIHaveAddedEmailToTheProviderDetailsAndClickedSave()
 {
     Pages.ProviderPage ProviderPage = new Pages.ProviderPage(webDriver);
     ProviderClass.GetProviderInstance().EmailValue = RandomDataGenerator.GenerateRandomEmail();
     ProviderPage.UpdateProvider(ProviderClass.GetProviderInstance().GetEmail(), ProviderClass.GetProviderInstance().EmailValue);
 }
Пример #5
0
 public ClassUnderTest(ProviderClass provider)
 {
     this.Provider = provider;
 }
Пример #6
0
        ///-------------------------------------------------------------------------------------------------
        /// <summary>   Exports the given file. </summary>
        ///
        /// <param name="Filename">     Filename of the file to write to. </param>
        /// <param name="TheFormat">    the format to use when write to the file. </param>
        /// <param name="Colwidth">     The colwidth of the column if DataFormat.FixedWidth </param>
        /// <param name="WriteHeader">  true to write header usng fieldnames. </param>
        /// <param name="ErrMessage">   [out] Message describing the error. </param>
        /// <param name="UseFields">    The use fields an array of fieldnames to write to the file. if null or 0 length all fields written. </param>
        ///
        /// <returns>   true if it succeeds, false if it fails. </returns>
        ///-------------------------------------------------------------------------------------------------

        public bool ExportText(string Filename, string ScenarioName, UniDB.Tools.DataFormat TheFormat, int Colwidth, bool WriteHeader, out string ErrMessage, string[] UseFields)
        {
            bool writeResult = false;

            ErrMessage = "";
            if (FSimResult != null)
            {
                try
                {
                    using (StreamWriter SW = new StreamWriter(Filename))
                    {
                        // Write HEader
                        if (WriteHeader)
                        {
                            string[] BaseFields = new string[5] {
                                "ID", "SCN_NAME", "SIMYEAR", "PRVDCODE", "PRVDLABEL"
                            };

                            string HeaderStr = UniDB.Tools.PutDataInTextLine(BaseFields, TheFormat, Colwidth);
                            // Do Base Inputs
                            string BaseInStr = "";
                            if (FSimResult[0].Inputs.BaseInputModelParam.Length > 0)
                            {
                                BaseInStr = GetFields(FSimResult[0].Inputs.BaseInputModelParam, UseFields, TheFormat, Colwidth);
                            }
                            // DO Provider Inputs
                            string ProviderInStr = "";
                            if (FSimResult[0].Inputs.ProviderInputModelParam.Length > 0)
                            {
                                ProviderInStr = GetFields(FSimResult[0].Inputs.ProviderInputModelParam, UseFields, TheFormat, Colwidth);
                            }
                            // Do Base Outputs
                            string BaseOutStr = "";
                            if (FSimResult[0].Outputs.BaseOutputModelParam.Length > 0)
                            {
                                BaseOutStr = GetFields(FSimResult[0].Outputs.BaseOutputModelParam, UseFields, TheFormat, Colwidth);
                            }
                            // Do Provider Outputs
                            string ProviderOutStr = "";
                            if (FSimResult[0].Outputs.ProviderOutputModelParam.Length > 0)
                            {
                                ProviderOutStr = GetFields(FSimResult[0].Outputs.ProviderOutputModelParam, UseFields, TheFormat, Colwidth);
                            }

                            string[] AllStrings = new string[5];
                            AllStrings[0] = HeaderStr;
                            AllStrings[1] = BaseInStr;
                            AllStrings[2] = ProviderInStr;
                            AllStrings[3] = BaseOutStr;
                            AllStrings[4] = ProviderOutStr;

                            string OutStr = UniDB.Tools.PutDataInTextLine(AllStrings, TheFormat, Colwidth);
                            SW.WriteLine(OutStr);
                        }
                        // Write Data
                        Int64 ID = UniDB.Tools.CreatePrimaryIDIntSeed();

                        foreach (AnnualSimulationResults ASR in FSimResult.GetAllYears())
                        {
                            foreach (eProvider ep in ProviderClass.providers())
                            {
                                string[] BaseData = new string[5];
                                BaseData[0] = ID.ToString();
                                BaseData[1] = ScenarioName;
                                BaseData[2] = ASR.year.ToString();
                                BaseData[3] = ProviderClass.FieldName(ep);
                                BaseData[4] = ProviderClass.Label(ep);


                                string DataStr = UniDB.Tools.PutDataInTextLine(BaseData, TheFormat, Colwidth);

                                // Do Base Inputs
                                string DataBaseInStr = "";
                                if (ASR.Inputs.BaseInputModelParam.Length > 0)
                                {
                                    DataBaseInStr = GetDataString(ASR.Inputs.BaseInput.Values, ASR.Inputs.BaseInputModelParam, UseFields, TheFormat, Colwidth);
                                }
                                // DO Provider Inputs
                                string DataProviderInStr = "";
                                if (ASR.Inputs.ProviderInputModelParam.Length > 0)
                                {
                                    if (ASR.Inputs.ProviderInput.Values.Length > 0)
                                    {
                                        DataProviderInStr = GetDataString(ASR.Inputs.ProviderInput.Values[(int)ep].Values, ASR.Inputs.ProviderInputModelParam, UseFields, TheFormat, Colwidth);
                                    }
                                }
                                // Do Base Outputs
                                string DataBaseOutStr = "";
                                if (ASR.Outputs.BaseOutputModelParam.Length > 0)
                                {
                                    DataBaseOutStr = GetDataString(ASR.Outputs.BaseOutput.Values, ASR.Outputs.BaseOutputModelParam, UseFields, TheFormat, Colwidth);
                                }
                                // Do Provider Outputs
                                string DataProviderOutStr = "";
                                if (ASR.Outputs.ProviderOutputModelParam.Length > 0)
                                {
                                    if (ASR.Outputs.ProviderOutput.Values.Length > 0)
                                    {
                                        DataProviderOutStr = GetDataString(ASR.Outputs.ProviderOutput.Values[(int)ep].Values, ASR.Outputs.ProviderOutputModelParam, UseFields, TheFormat, Colwidth);
                                    }
                                }
                                string[] AllStrings = new string[5];
                                AllStrings[0] = DataStr;
                                AllStrings[1] = DataBaseInStr;
                                AllStrings[2] = DataProviderInStr;
                                AllStrings[3] = DataBaseOutStr;
                                AllStrings[4] = DataProviderOutStr;

                                string OutStr = UniDB.Tools.PutDataInTextLine(AllStrings, TheFormat, Colwidth);

                                SW.WriteLine(OutStr);
                                ID++;
                            }
                        }
                    }
                    writeResult = true;
                }
                catch (Exception ex)
                {
                    ErrMessage = ex.Message;
                }
            }
            return(writeResult);
        }