private void Switch_CarRent_OnValuechange(object sender, EventArgs e) { if (Switch_CarRent.Value == true) { comboBox_selectCarType.Enabled = true; //Call procedure to get all data for renting cars try { DAL.Dal_RentCars.Get_Cars_Rent(Form1.ReserveRoom.Hotel_ID); } catch (OracleException ex) { DAL.Log.LogMessage(ex); } comboBox_selectCarType.Sorted = true; foreach (Entities.RentCars cars in DAL.Dal_RentCars.Rents) { comboBox_selectCarType.Items.Add(GetAproximatedPriceString(cars)); } } else if (Switch_CarRent.Value == false) { comboBox_selectCarType.Enabled = false; comboBox_selectCarType.Text = null; rentedCar = null; comboBox_selectCarType.Items.Clear(); AllTextboxReservation_Update(); } }
private void ComboBox_selectCarType_SelectedIndexChanged(object sender, EventArgs e) { //Get price of car from combobox foreach (var rent in DAL.Dal_RentCars.Rents) { if (comboBox_selectCarType.Text == GetAproximatedPriceString(rent)) { rentedCar = rent; break; } } AllTextboxReservation_Update(); }
string GetAproximatedPriceString(Entities.RentCars cars) { return(String.Format("{0} ({1} {2})", cars.CAR_NAME_TYPE, AproximatePrice(Convert.ToDouble(CurrencyConversion(Convert.ToDecimal(cars.RENT_PRICE), Standard_currency, GetHotelRegionCurrencyISO(country_name)))), currency)); }