public void LoadCases()
        {
            Connection.Open();

            MySqlCommand    cmd    = new MySqlCommand("SELECT City, PostalCode, Zone, PriceFactor FROM AreaPrices", Connection);
            MySqlDataReader Reader = cmd.ExecuteReader();

            while (Reader.Read())
            {
                Estimations _estimator = new Estimations(Connection)
                {
                    City        = Reader.GetString(0),
                    PostalCode  = Reader.GetUInt32(1),
                    Zone        = Reader.GetUInt32(2),
                    PriceFactor = Reader.GetFloat(3)
                };
                EstimatorList.Add(_estimator);
            }

            Reader.Close();
            Connection.Close();
        }
Example #2
0
        public void Estimate(string City, uint PostalCode, uint Zone, ref uint Price)
        {
            Estimations estimation = Estimations.EstimatorList.FirstOrDefault(e => e.City == City && e.PostalCode == PostalCode && e.Zone == Zone);

            Price = (uint)(Price * estimation.PriceFactor);
        }