public void Add(Mileage mileage) { if (list.Exists(item => item == mileage)) return; list.Add(mileage); }
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; }
public Mileage_AddEdit(Mileage mileage) { InitializeComponent(); _mileage = mileage; }
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); }
protected override void loadFromSql() { DataTable dt = _provider.Select("Mileage"); foreach (DataRow row in dt.Rows) { Mileage mileage = new Mileage(row); Add(mileage); } }
public string PrevToString() { Mileage mileage = GetPrev(); return((mileage == null) ? "0" : mileage.ToString()); }