public PavilionPage(EditCenter main) { this.main = main; InitializeComponent(); foreach (dataBase.Pavilions pav in main.center.center.Pavilions) { Pavilion record = new Pavilion(); record.centerName = pav.centerName; record.centerState = main.center.center.state; record.floorNum = pav.floor.ToString(); record.pavilionNum = pav.pavilionNum; record.square = pav.square.ToString(); record.pavilionState = pav.state; record.priceCoefficient = pav.priceCoefficient.ToString(); record.meterPrice = pav.meterPrice.ToString(); record.pavilion = pav; pavilions.Items.Add(record); } foreach (dataBase.Pavilions floor in main.center.center.Pavilions) { bool check = true; foreach (ComboBoxItem i in floorFilter.Items) { if (i.Content.ToString() == floor.floor.ToString()) { check = false; } } if (check) { ComboBoxItem item = new ComboBoxItem(); item.Content = floor.floor.ToString(); floorFilter.Items.Add(item); } } }
public EditPavilion(EditCenter main, Pavilion pavilion = null) { this.main = main; this.pavilion = pavilion; InitializeComponent(); if (pavilion != null) { floorNum.Text = pavilion.floorNum.ToString(); pavNum.Text = pavilion.pavilionNum; square.Text = pavilion.square; coeff.Text = pavilion.priceCoefficient; price.Text = pavilion.meterPrice; foreach (ComboBoxItem item in state.Items) { if (item.Content.ToString() == pavilion.pavilionState) { state.SelectedItem = item; } } } }
private void CityFilter_SelectionChanged(object sender, SelectionChangedEventArgs e) { pavilions.Items.Clear(); floor = ((ComboBoxItem)((ComboBox)sender).SelectedItem).Content.ToString(); foreach (dataBase.Pavilions pav in main.center.center.Pavilions) { if ((state == pav.state || state == "Показате все") && (floor == pav.floor.ToString() || floor == "Показать все") && (fromNum < pav.square) && (toNum > pav.square)) { Pavilion record = new Pavilion(); record.centerName = pav.centerName; record.centerState = main.center.center.state; record.floorNum = pav.floor.ToString(); record.pavilionNum = pav.pavilionNum; record.square = pav.square.ToString(); record.pavilionState = pav.state; record.priceCoefficient = pav.priceCoefficient.ToString(); record.meterPrice = pav.meterPrice.ToString(); record.pavilion = pav; pavilions.Items.Add(record); } } }
private void FromFilter_TextChanged(object sender, TextChangedEventArgs e) { bool check = true; try { toNum = Convert.ToDouble(toSquare.Text); } catch { check = false; } if (check) { pavilions.Items.Clear(); foreach (dataBase.Pavilions pav in main.center.center.Pavilions) { if ((state == pav.state || state == "Показате все") && (floor == pav.floor.ToString() || floor == "Показать все") && (fromNum < pav.square) && (toNum > pav.square)) { Pavilion record = new Pavilion(); record.centerName = pav.centerName; record.centerState = main.center.center.state; record.floorNum = pav.floor.ToString(); record.pavilionNum = pav.pavilionNum; record.square = pav.square.ToString(); record.pavilionState = pav.state; record.priceCoefficient = pav.priceCoefficient.ToString(); record.meterPrice = pav.meterPrice.ToString(); record.pavilion = pav; pavilions.Items.Add(record); } } } }