Beispiel #1
0
        //=========================
        //
        public double Fast_D_RCN(string lclu)
        {
            double        temp    = InvalidRCN;
            DataStructRCN TheData = FRCNDataList.Find(delegate(DataStructRCN AD)
            {
                return(AD.LCLU == lclu);
            });

            temp = TheData.Clay;
            return(temp);
        }
Beispiel #2
0
        //
        public DataClassRCN(string DataDirectory, string Filename)
        {
            string errMessage = "";
            bool   isErr      = false;

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

            DbCon.UseFieldHeaders = true;
            DbCon.Open();
            TheData = Tools.LoadTable(DbCon, FFilename, ref isErr, ref errMessage);
            if (isErr)
            {
                throw new Exception("Error loading Runoff Curve Number Data- file RCNbyLCLU" + errMessage);
            }
            // build data arrays
            int arraysize = TheData.Rows.Count;

            //
            FOrderArray = new string[arraysize];
            FSandArray  = new string[arraysize];
            FLoamArray  = new string[arraysize];
            FSCLArray   = new string[arraysize];
            FClayArray  = new string[arraysize];
            FLCLUArray  = new string[arraysize];
            //
            foreach (DataRow DR in TheData.Rows)
            {
                string codestr = DR[FRCNlcluFieldStr].ToString();
                // END EDIT

                // Decided not to use code in DataTable
                int codeint = Tools.ConvertToInt32(codestr, ref isErr, ref errMessage);
                if (!isErr)
                {
                    string orderStr = DR[FRCNOrderFieldStr].ToString();
                    string sandStr  = DR[FRCNSandFieldStr].ToString();
                    string loamStr  = DR[FRCNLOAMFieldStr].ToString();
                    string sclStr   = DR[FRCNSCLFieldStr].ToString();
                    string clayStr  = DR[FRCNClayFieldStr].ToString();
                    string lcluStr  = DR[FRCNlcluFieldStr].ToString();
                    //
                    int tempOrder = Tools.ConvertToInt32(orderStr, ref isErr, ref errMessage);
                    if (!isErr)
                    {
                        double tempSand = Tools.ConvertToDouble(sandStr, ref isErr, ref errMessage);
                        if (!isErr)
                        {
                            double tempLoam = Tools.ConvertToDouble(loamStr, ref isErr, ref errMessage);
                            if (!isErr)
                            {
                                double tempSCL = Tools.ConvertToDouble(sclStr, ref isErr, ref errMessage);
                                if (!isErr)
                                {
                                    double tempClay = Tools.ConvertToDouble(clayStr, ref isErr, ref errMessage);
                                    if (!isErr)
                                    {
                                        string tempLCLU = clayStr;//, ref isErr, ref errMessage);
                                        if (!isErr)
                                        {
                                            DataStructRCN AD = new DataStructRCN(tempOrder, tempSand, tempLoam, tempSCL, tempClay, tempLCLU);
                                            FRCNDataList.Add(AD);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }