private void b_choose_Click(object sender, RoutedEventArgs e) { if (lv_lista.SelectedItem != null) { StationObject selected = (StationObject)lv_lista.SelectedItem; if (isAvgang) { parentWindow.departure_address = selected.street_address; parentWindow.departure_city = selected.city; parentWindow.departure_country = selected.country; parentWindow.tb_departure.Text = selected.street_address + ", " + selected.city + ", " + selected.country; } else { parentWindow.arrival_address = selected.street_address; parentWindow.arrival_city = selected.city; parentWindow.arrival_country = selected.country; parentWindow.tb_arrival.Text = selected.street_address + ", " + selected.city + ", " + selected.country; } Close(); } else { MessageBox.Show("Nothing selected.", "Error!", MessageBoxButton.OK, MessageBoxImage.Warning); } }
private void b_save_Click(object sender, RoutedEventArgs e) { if (tb_gatuaddress.Text == "" || tb_city.Text == "" || tb_country.Text == "") { MessageBox.Show("Empty fields are not allowed.", "Error!", MessageBoxButton.OK, MessageBoxImage.Warning); return; } StationObject newObject = new StationObject(tb_gatuaddress.Text, tb_city.Text, tb_country.Text); int rowsChanged = -1; if (newstation) { rowsChanged = DBConnection.InsertStation(newObject); } else { rowsChanged = DBConnection.UpdateStation(newObject, oldObject); } if (rowsChanged > 0) { parentWindow.parentWindow.UpdateAllChain(); Close(); } }
public ChangeStationWindow(HandleStationWindow _parent, StationObject _oldObject) { InitializeComponent(); Title = "Edit Station - " + Authenticator.GetUserInfo(); oldObject = _oldObject; tb_gatuaddress.Text = oldObject.street_address; tb_city.Text = oldObject.city; tb_country.Text = oldObject.country; parentWindow = _parent; newstation = false; }
// Get references to StationObjects on this tile. void checkSurroundings() { contents.Clear(); hasObstacle = false; foreach (var collider in Physics2D.OverlapCircleAll((Vector2)transform.position, 0.0f, maskDefault)) { StationObject stationObject = collider.gameObject.GetComponent <StationObject>(); if (stationObject.isObstacle) { hasObstacle = true; } contents.Add(stationObject); } }
void UpgradeWorker(int i, string w) { StationObject stationObject = stations[i].target.GetComponent <StationObject>(); if (stations[i].target.GetComponent <StationObject>().workerSpawn != null) { if (!stationObject.jobFull) { GameObject worker = Instantiate(Resources.Load <GameObject>("Prefabs/" + w)); WorkerObject workerObject = worker.GetComponent <WorkerObject>(); worker.transform.position = stationObject.workerSpawn.position; worker.transform.parent = stationObject.workerSpawn; stationObject.jobFull = true; workerObject.id = i; ProfitRate(); } } }
public static int DeleteStation(StationObject oldObject) { int bookingsCount = 0; bookingsCount = ExecuteAndGetScalar("SELECT count(*) FROM booking WHERE booking.busride_id IN (SELECT busride.busride_id FROM busride WHERE (busride.departure_address = :p0 AND busride.departure_city = :p1 AND busride.departure_country = :p2) OR (busride.arrival_address = :p0 AND busride.arrival_city = :p1 AND busride.arrival_country = :p2));", oldObject.street_address, oldObject.city, oldObject.country); int busridesCount = 0; busridesCount = ExecuteAndGetScalar("SELECT count(*) FROM busride WHERE (busride.departure_address = :p0 AND busride.departure_city = :p1 AND busride.departure_country = :p2) OR (busride.arrival_address = :p0 AND busride.arrival_city = :p1 AND busride.arrival_country = :p2);", oldObject.street_address, oldObject.city, oldObject.country); int affectedRows = -1; MessageBoxResult result = MessageBox.Show("If you remove this station a total of " + busridesCount + " busrides and " + bookingsCount + " bookings will also be removed! Do you still wish to remove this station?", "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning); if (result == MessageBoxResult.Yes) { ExecuteAndGetNonQuery("DELETE FROM booking WHERE booking.busride_id IN (SELECT busride.busride_id FROM busride WHERE (busride.departure_address = :p0 AND busride.departure_city = :p1 AND busride.departure_country = :p2) OR (busride.arrival_address = :p0 AND busride.arrival_city = :p1 AND busride.arrival_country = :p2));", oldObject.street_address, oldObject.city, oldObject.country); ExecuteAndGetNonQuery("DELETE FROM busride WHERE (busride.departure_address = :p0 AND busride.departure_city = :p1 AND busride.departure_country = :p2) OR (busride.arrival_address = :p0 AND busride.arrival_city = :p1 AND busride.arrival_country = :p2);", oldObject.street_address, oldObject.city, oldObject.country); affectedRows = ExecuteAndGetNonQuery("DELETE FROM station WHERE street_address = :p0 AND city = :p1 AND country = :p2;", oldObject.street_address, oldObject.city, oldObject.country); } return(affectedRows); }
public static int UpdateStation(StationObject newObject, StationObject oldObject) { return(ExecuteAndGetNonQuery("UPDATE station SET street_address = :p0, city = :p1, country = :p2 WHERE street_address = :p3 AND city = :p4 AND country = :p5;", newObject.street_address, newObject.city, newObject.country, oldObject.street_address, oldObject.city, oldObject.country)); }
public static int InsertStation(StationObject newObject) { return(ExecuteAndGetNonQuery("INSERT INTO station (street_address, city, country) VALUES (:p0, :p1, :p2);", newObject.street_address, newObject.city, newObject.country)); }
protected override RISObject GetRISObject(DICOMObject dicomObject) { SeriesObject risSeries = new SeriesObject(); DICOMSeriesObject dicomSeries = (DICOMSeriesObject)dicomObject; risSeries.SeriesInstance.Value = dicomSeries.SeriesInstance.Value; risSeries.SeriesNumber.Value = dicomSeries.SeriesNumber.Value; risSeries.SeriesDate.Value = DatabaseUtility.GetDateTime(dicomSeries.SeriesDate.Value, dicomSeries.SeriesTime.Value); risSeries.Description.Value = dicomSeries.Description.Value; risSeries.PatientPosition.Value = dicomSeries.PatientPosition.Value; risSeries.Contrast.Value = dicomSeries.ContrastBo.Value; risSeries.ProtocolName.Value = dicomSeries.ProtocolNa.Value; risSeries.FrameOfReference.Value = dicomSeries.FrameOfRef.Value; risSeries.BodyPartExamined.Value = dicomSeries.BodyPartEx.Value; ModalityObject risModality = new ModalityObject(); risModality.Name.Value = dicomSeries.Modality.Value; risModality.Load(); if (!risModality.IsLoaded) { risModality.Save(); } ModalityDetailObject modalityDetail = new ModalityDetailObject(); modalityDetail.ModalityId.Value = risModality.GetPrimaryKey().Value; modalityDetail.Manufacturer.Value = dicomSeries.Manufactur.Value; modalityDetail.ModelName.Value = dicomSeries.ModelName.Value; modalityDetail.Load(); if (!modalityDetail.IsLoaded) { modalityDetail.Save(); } risSeries.ModalityDetailId.Value = modalityDetail.GetPrimaryKey().Value; risStudy = new StudyObject(); risStudy.StudyInstance.Value = dicomSeries.StudyInsta.Value; risStudy.Load(); if (risStudy.IsLoaded) { risSeries.StudyId.Value = risStudy.StudyId.Value; if (dicomSeries.StationName.Value != null) { StationObject station = new StationObject(); station.ModalityId.Value = risModality.GetPrimaryKey().Value; station.StationName.Value = dicomSeries.StationName.Value; station.Instituition.Value = dicomSeries.Instituition.Value; station.Load(); if (!station.IsLoaded) { station.Save(); } risStudy.StationId.Value = station.GetPrimaryKey().Value; if (station.HospitalId.Value != null) { risStudy.HospitalId.Value = station.HospitalId.Value; } if (station.ClientId.Value != null) { risStudy.ClientId.Value = station.ClientId.Value; } risStudy.Save(); } } else { risSeries = null; } return risSeries; }