Beispiel #1
0
        public double FastGILA_ICS(int year)
        {
            double  temp    = InvalidRate;
            ICSData TheData = FDataList.Find(delegate(ICSData FD) {
                return((FD.TheYear == year));
            });

            temp = TheData.ICS_GILA;
            return(temp);
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="DataDirectory"></param>
        /// <param name="Filename"></param>
        public UnitData_ICS(string DataDirectory, string Filename)
        {
            string errMessage = "";
            bool   isErr      = false;

            FDataDirectory = DataDirectory;
            FFilename      = Filename;
            UniDbConnection DbCon = new UniDbConnection(SQLServer.stText, "", FDataDirectory, "", "", "")
            {
                UseFieldHeaders = true
            };

            DbCon.Open();
            TheData = Tools.LoadTable(DbCon, FFilename, ref isErr, ref errMessage);
            if (isErr)
            {
                throw new Exception("Error loading Rate Data. " + errMessage);
            }
            // build data arrays
            int arraysize = TheData.Rows.Count;

            //
            FAZ_ICS      = new double[arraysize];
            FCA_ICS      = new double[arraysize];
            FIID_ICS     = new double[arraysize];
            FNV_ICS      = new double[arraysize];
            FSNWA_ICS    = new double[arraysize];
            FNVother_ICS = new double[arraysize];
            FTON_ICS     = new double[arraysize];
            FGILA_ICS    = new double[arraysize];

            foreach (DataRow DR in TheData.Rows)
            {
                // Get name and code
                // Setup to use region or state codes
                // string namestr = DR[FNameFieldStr].ToString();

                // Decided not to use code in DataTable
                // int codeint = Tools.ConvertToInt32(codestr,ref isErr,ref errMessage);


                if (!isErr)
                {
                    string rICS_AZ      = DR[FICS_AZ].ToString();
                    string rICS_CA      = DR[FICS_CA].ToString();
                    string rICS_IID     = DR[FICS_IID].ToString();
                    string rICS_NV      = DR[FICS_NV].ToString();
                    string rICS_SNWA    = DR[FICS_SNWA].ToString();
                    string rICS_NVother = DR[FICS_NVOther].ToString();
                    string rICS_TON     = DR[FICS_TON].ToString();
                    string rICS_GILA    = DR[FICS_GILA].ToString();
                    //
                    string ryearsstr = DR[FcurrentYearFieldStr].ToString();

                    double TempAZ = Tools.ConvertToDouble(rICS_AZ, ref isErr, ref errMessage);
                    if (!isErr)
                    {
                        double TempCA = Tools.ConvertToDouble(rICS_CA, ref isErr, ref errMessage);
                        if (!isErr)
                        {
                            double TempIID = Tools.ConvertToDouble(rICS_IID, ref isErr, ref errMessage);
                            if (!isErr)
                            {
                                double TempNV = Tools.ConvertToDouble(rICS_NV, ref isErr, ref errMessage);
                                if (!isErr)
                                {
                                    double TempSNWA = Tools.ConvertToDouble(rICS_SNWA, ref isErr, ref errMessage);
                                    if (!isErr)
                                    {
                                        double TempNVother = Tools.ConvertToDouble(rICS_NVother, ref isErr, ref errMessage);
                                        if (!isErr)
                                        {
                                            double TempTON = Tools.ConvertToDouble(rICS_TON, ref isErr, ref errMessage);
                                            if (!isErr)
                                            {
                                                double TempGILA = Tools.ConvertToDouble(rICS_GILA, ref isErr, ref errMessage);
                                                if (!isErr)
                                                {
                                                    int TempYear = Tools.ConvertToInt32(ryearsstr, ref isErr, ref errMessage);
                                                    if (!isErr)
                                                    {
                                                        // OK
                                                        ICSData ICS = new ICSData(TempAZ, TempCA, TempIID, TempNV, TempSNWA, TempNVother, TempTON, TempGILA, TempYear);
                                                        FDataList.Add(ICS);
                                                        //// add to dictionary
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }