Beispiel #1
0
        public void Add(Mileage mileage)
        {
            if (list.Exists(item => item == mileage))
                return;

            list.Add(mileage);
        }
Beispiel #2
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;
        }
Beispiel #3
0
        public Mileage_AddEdit(Mileage mileage)
        {
            InitializeComponent();

            _mileage = mileage;
        }
Beispiel #4
0
        public Mileage getItem(Car car, Mileage current)
        {
            var mileages = list.Where(item => item.Car.ID == car.ID && item != current).OrderByDescending(item => item.Date);

            return getItem(mileages);
        }
Beispiel #5
0
        protected override void loadFromSql()
        {
            DataTable dt = _provider.Select("Mileage");

            foreach (DataRow row in dt.Rows)
            {
                Mileage mileage = new Mileage(row);
                Add(mileage);
            }
        }
Beispiel #6
0
        public string PrevToString()
        {
            Mileage mileage = GetPrev();

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