/// <summary> /// Class constructor /// </summary> /// <param name="date">Date of the trip</param> /// <param name="trainId">ID of the train associated to this trip</param> public Trip(string date = null, string trainId = null) { DAO = new TripDAO(); Date = date is null ? DateTime.Now : DateTime.Parse(date); Train = new Train(trainId); TonsTransported = 1; }
/// <summary> /// Constructor /// </summary> public MostProfitableTripDialog() { InitializeComponent(); var information = new TripDAO().QueryMostProfitableTrip(); this.trainIdTextBox.Text = (string)information["TrainID"]; this.trainDescriptionTextBox.Text = (string)information["TrainTypeDescription"]; this.productIdTextBox.Text = ((long)information["ProductID"]).ToString(); this.productDescriptionTextBox.Text = (string)information["ProductDescription"]; this.pricePerTonneTextBox.Text = ((double)information["EurosPerTon"]).ToString("N") + " €/t"; this.dateTextBox.Text = (string)information["TripDate"]; this.tonnesTransportedTextBox.Text = ((long)information["TonsTransported"]).ToString("N0") + " t"; this.totalProfitTextBox.Text = ((double)information["TripValue"]).ToString("N") + " €"; }
/// <summary> /// Initializes the trips tab /// </summary> /// <param name="path"></param> public TripsTab(string path = null) { this.dao = new TripDAO(path); Text = "Trips"; RenderItems(); }