public BatteryItems GetUnassignedBatteryItems(long terminalID) { //Get unassigned batteries for the specified terminal BatteryItems items = null; try { items = new BatteryItems(); DataSet ds = fillDataset(USP_BATTERY_UNASSIGNED, TBL_BATTERY_UNASSIGNED, new object[] {}); if (ds != null) { ItemDS itemDS = new ItemDS(); itemDS.Merge(ds); for (int i = 0; i < itemDS.BatteryItemTable.Rows.Count; i++) { BatteryItem item = new BatteryItem(itemDS.BatteryItemTable[i]); if (item.TerminalID == terminalID) { items.Add(item); } } } } catch (Exception ex) { throw new FaultException <TerminalsFault>(new TerminalsFault(new ApplicationException("Unexpected error while reading unassigned battery items.", ex))); } return(items); }
public BatteryItems GetBatteryItems() { //Update collection of battery items BatteryItems items = null; try { items = new BatteryItems();; DataSet ds = fillDataset(USP_BATTERY_VIEW, TBL_BATTERY_VIEW, new object[] {}); if (ds != null) { ItemDS itemDS = new ItemDS(); itemDS.Merge(ds); for (int i = 0; i < itemDS.BatteryItemTable.Rows.Count; i++) { BatteryItem item = new BatteryItem(itemDS.BatteryItemTable[i]); item.DriverName = itemDS.BatteryItemTable[i].IsLastNameNull() ? "" : itemDS.BatteryItemTable[i].LastName.Trim(); item.DriverName += !itemDS.BatteryItemTable[i].IsLastNameNull() && !itemDS.BatteryItemTable[i].IsFirstNameNull() ? ", " : ""; item.DriverName += itemDS.BatteryItemTable[i].IsFirstNameNull() ? "" : itemDS.BatteryItemTable[i].FirstName.Trim(); items.Add(item); } } } catch (Exception ex) { throw new FaultException <TerminalsFault>(new TerminalsFault(new ApplicationException("Unexpected error while reading battery items.", ex))); } return(items); }