public static Service_agreement_package GetServiceAgreementPackage(int _service_agreement_package_id) { Service_agreement_package sap = new Service_agreement_package(); DataTable table = new DataTable(); SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM Service_agreement_package WHERE Service_agreement_package_id = @id", connection); adapter.SelectCommand.Parameters.Add(CreateParam("@id", _service_agreement_package_id, SqlDbType.Int)); try { adapter.Fill(table); } catch (Exception) { MessageBox.Show("GetServiceAgreementPackage failed", "Warning", MessageBoxButton.OK, MessageBoxImage.Error); } foreach (DataRow row in table.Rows) { sap = new Service_agreement_package(row); } return(sap); }
public static Ventilator_status GetSingleVentilatorStatus(int _statusID) { ObservableCollection <Ventilator_status> status = new ObservableCollection <Ventilator_status>(); DataTable table = new DataTable(); SqlDataAdapter adapter = new SqlDataAdapter("SELECT Ventilator_status.*, Company.*, Ventilator.*, Service_agreement_package.* FROM Ventilator_status INNER JOIN Ventilator ON Ventilator.Ventilator_id = Ventilator_status.FK_Ventilator_id INNER JOIN Company ON Company.Company_id = Ventilator.FK_Company_id INNER JOIN Service_agreement_package ON Ventilator.FK_Service_agreement_package_id = Service_agreement_package.Service_agreement_package_id WHERE Ventilator_status.Ventilator_status_id = @id", connection); adapter.SelectCommand.Parameters.Add(CreateParam("@id", _statusID, SqlDbType.Int)); try { adapter.Fill(table); } catch (Exception) { MessageBox.Show("GetSingleVentilatorStatus failed", "Warning", MessageBoxButton.OK, MessageBoxImage.Error); } foreach (DataRow row in table.Rows) { Company company = new Company(row); Service_agreement_package service_Agreement_Package = new Service_agreement_package(row); Ventilator ventilator = new Ventilator(row, company, service_Agreement_Package); status.Add(new Ventilator_status(row, ventilator)); } Ventilator_status _status = status[0]; return(_status); }
public static ObservableCollection <Ventilator_status> GetVentilatorStatus() { ObservableCollection <Ventilator_status> status = new ObservableCollection <Ventilator_status>(); DataTable table = new DataTable(); SqlDataAdapter adapter = new SqlDataAdapter("SELECT Ventilator_status.*, Company.*, Ventilator.*, Service_agreement_package.* FROM Ventilator_status INNER JOIN Ventilator ON Ventilator.Ventilator_id = Ventilator_status.FK_Ventilator_id INNER JOIN Company ON Company.Company_id = Ventilator.FK_Company_id INNER JOIN Service_agreement_package ON Ventilator.FK_Service_agreement_package_id = Service_agreement_package.Service_agreement_package_id WHERE Ventilator_status.Validated IS NULL; ", connection); try { adapter.Fill(table); } catch (Exception) { MessageBox.Show("GetVentilatorStatus failed", "Warning", MessageBoxButton.OK, MessageBoxImage.Error); } foreach (DataRow row in table.Rows) { Company company = new Company(row); Service_agreement_package service_Agreement_Package = new Service_agreement_package(row); Ventilator ventilator = new Ventilator(row, company, service_Agreement_Package); status.Add(new Ventilator_status(row, ventilator)); } return(status); }
public static ObservableCollection <Ventilator> GetAllVentilators() { ObservableCollection <Ventilator> ventilators = new ObservableCollection <Ventilator>(); DataTable table = new DataTable(); SqlDataAdapter adapter = new SqlDataAdapter("SELECT Ventilator.*, Service_agreement_package.* FROM Ventilator INNER JOIN Service_agreement_package ON Ventilator.FK_Service_agreement_package_id = Service_agreement_package.Service_agreement_package_id;", connection); try { adapter.Fill(table); } catch (Exception) { MessageBox.Show("GetSpareParts failed", "Warning", MessageBoxButton.OK, MessageBoxImage.Error); } foreach (DataRow row in table.Rows) { Service_agreement_package service_Agreement_Package = new Service_agreement_package(row); ventilators.Add(new Ventilator(row, service_Agreement_Package)); } return(ventilators); }
public void NewCelciusTest_ValidateIfNumberIsValid_ReturnsFalse() { // Arrange Service_agreement_package sap = new Service_agreement_package(); sap.Celcius = 60; bool result = false; // Act result = sap.NewCelcius(0); // Assert Assert.IsTrue(result, "result is " + result.ToString()); }
public UpdateSAPValues(int _service_agreement_package_id) { InitializeComponent(); service_agreement_package_id = _service_agreement_package_id; sap = DB.GetServiceAgreementPackage(service_agreement_package_id); lbl_package.Content = "Service aggrement package - " + sap.Name; lbl_package_description.Content = sap.Description; lbl_celcius.Content = sap.Celcius + " C"; lbl_hertz.Content = sap.Hertz + " Hz"; lbl_kwh.Content = sap.kWh + " kWh"; lbl_amps.Content = sap.Amps + " A"; }