public static bool UpdateDriverVehicle(VehicleDS vehicle) { //Update an existing driver vehicle bool result = false; try { result = Mediator.ExecuteNonQuery("", new object[] { vehicle }); } catch (Exception ex) { throw ex; } return(result); }
public static int CreateDriverVehicle(VehicleDS vehicle) { //Create a new driver vehicle int result = 0; try { result = (int)Mediator.ExecuteNonQueryWithReturn("", new object[] { vehicle }); } catch (Exception ex) { throw ex; } return(result); }
public static VehicleDS ViewDriverVehicles() { //Get a list of driver vehicles VehicleDS vehicles = new VehicleDS(); try { DataSet ds = Mediator.FillDataset("", "VehicleListTable", null); if (ds != null) { vehicles.Merge(ds.Tables["VehicleListTable"].Select("", "Description", DataViewRowState.CurrentRows)); } } catch (Exception ex) { throw ex; } return(vehicles); }
//Interface public dlgVehicleDetail(ref VehicleDS vehicle) { //Constructor try { // InitializeComponent(); this.btnOk.Text = CMD_OK; this.btnCancel.Text = CMD_CANCEL; //Set mediator service, data, and titlebar caption this.mVehicleDS = vehicle; if (this.mVehicleDS.VehicleDetailTable.Count > 0) { this.mVehicleID = this.mVehicleDS.VehicleDetailTable[0].VehicleID; this.Text = (this.mVehicleID > 0) ? "Driver Vehicle (" + this.mVehicleID + ")" : "Driver Vehicle (New)"; } else { this.Text = "Driver Vehicle (Data Unavailable)"; } } catch (Exception ex) { throw ex; } }
public static VehicleDS GetDriverVehicle(int vehicleID, string vehicleType) { //Get a new or existing vehicle VehicleDS vehicle = new VehicleDS(); try { if (vehicleID == 0) { //New VehicleDS.VehicleDetailTableRow row = vehicle.VehicleDetailTable.NewVehicleDetailTableRow(); row.VehicleID = vehicleID; row.Description = ""; row.VehicleType = vehicleType; row.LicPlateNumber = ""; //row.State = ""; row.CarrierID = EnterpriseFactory.CompanyID; //row.DriverID = 0; row.IsActive = true; row.LastUpdated = DateTime.Now; row.UserID = System.Environment.UserName; row.RowVersion = ""; vehicle.VehicleDetailTable.AddVehicleDetailTableRow(row); } else { //Existing DataSet ds = Mediator.FillDataset("", "VehicleDetailTable", new object[] { vehicleID, vehicleType }); if (ds != null) { vehicle.Merge(ds); } } } catch (Exception ex) { throw ex; } return(vehicle); }