Esempio n. 1
0
        public void SetCount(string value)
        {
            Mileage mileage = GetPrev();

            int count;

            if (!int.TryParse(value.Replace(" ", ""), out count))
            {
                throw new InvalidCastException();
            }

            int prevCount = 0;

            if (mileage != null)
            {
                int.TryParse(mileage.Count, out prevCount);

                if ((count < prevCount) && (Date > mileage.Date))
                {
                    throw new InvalidConstraintException();
                }
            }

            if (count >= 1000000)
            {
                throw new OverflowException();
            }

            _count = count;
        }
Esempio n. 2
0
        public string PrevToString()
        {
            Mileage mileage = GetPrev();

            return((mileage == null) ? "0" : mileage.ToString());
        }