private void RefreshGrid() { _dataTable = Utility.ToDataTable(RefillData.GetList()); bindingSource.DataSource = _dataTable; dataGridView.DataSource = bindingSource; dataGridView.Update(); dataGridView.Refresh(); dataGridView.Columns[0].Visible = dataGridView.Columns[2].Visible = false; dataGridView.Columns[3].HeaderText = "Vehicle Name"; dataGridViewSearch.SetColumns(dataGridView.Columns); }
public static List <RefillData> GetList() { List <RefillData> items = new List <RefillData>(); foreach (var item in RefillBl.GetList()) { RefillData refillData = new RefillData(); refillData.Id = item.Id; refillData.Date = item.DateAndTime.ToString("dddd dd MMM yyyy"); refillData.VehicleId = item.VehicleId; refillData.VehicleName = string.Format("{0}({1})", new VehicleBl().GetById(item.VehicleId).Name, new VehicleBl().GetById(item.VehicleId).RegistrationNumber); refillData.Amount = item.Amount; refillData.Litreage = item.Litreage; refillData.Mileage = item.Mileage; items.Add(refillData); } return(items); }
public static List<RefillData> GetList() { List<RefillData> items = new List<RefillData>(); foreach(var item in RefillBl.GetList()) { RefillData refillData = new RefillData(); refillData.Id = item.Id; refillData.Date = item.DateAndTime.ToString("dddd dd MMM yyyy"); refillData.VehicleId = item.VehicleId; refillData.VehicleName = string.Format("{0}({1})", new VehicleBl().GetById(item.VehicleId).Name, new VehicleBl().GetById(item.VehicleId).RegistrationNumber); refillData.Amount = item.Amount; refillData.Litreage = item.Litreage; refillData.Mileage = item.Mileage; items.Add(refillData); } return items; }