private void listViewDemandSet_House_SelectedIndexChanged(object sender, EventArgs e) { if (listViewDemandSet_Apartment.SelectedItems.Count == 1) { DemandSet need = listViewDemandSet_Apartment.SelectedItems[0].Tag as DemandSet; comboBoxRealtors.SelectedItem = comboBoxRealtors.FindString(need.IdRealtor.ToString()); comboBoxClients.SelectedItem = comboBoxClients.FindString(need.IdClient.ToString()); textBoxMinPrice.Text = need.MinPrice.ToString(); textBoxMaxPrice.Text = need.MaxPrice.ToString(); textBoxMinArea.Text = need.MinArea.ToString(); textBoxMaxArea.Text = need.MaxArea.ToString(); textBoxMinRooms.Text = need.MinRooms.ToString(); textBoxMaxRooms.Text = need.MaxRooms.ToString(); textBoxMinFloors.Text = need.MinFloors.ToString(); textBoxMaxFloors.Text = need.MaxFloors.ToString(); } else { comboBoxRealtors.SelectedItem = null; comboBoxClients.SelectedItem = null; textBoxMinPrice.Text = ""; textBoxMaxPrice.Text = ""; textBoxMinArea.Text = ""; textBoxMaxArea.Text = ""; textBoxMinRooms.Text = ""; textBoxMaxRooms.Text = ""; textBoxMinFloors.Text = ""; textBoxMaxFloors.Text = ""; } }
private void buttonEdit_Click(object sender, EventArgs e) { if (comboBoxTypes.SelectedIndex == 0) { if (listViewDemandSet_Apartment.SelectedItems.Count == 1) { DemandSet need = listViewDemandSet_Apartment.SelectedItems[0].Tag as DemandSet; need.IdRealtor = Convert.ToInt32(comboBoxRealtors.SelectedItem.ToString().Split('.')[0]); need.IdClient = Convert.ToInt32(comboBoxClients.SelectedItem.ToString().Split('.')[0]); need.Type = Convert.ToInt32(comboBoxTypes.SelectedItem.ToString().Split('.')[0]); need.MinPrice = Convert.ToInt32(textBoxMinPrice.Text); need.MaxPrice = Convert.ToInt32(textBoxMaxPrice.Text); need.MinArea = Convert.ToInt32(textBoxMinArea.Text); need.MaxArea = Convert.ToInt32(textBoxMaxArea.Text); need.MinRooms = Convert.ToInt32(textBoxMinRooms.Text); need.MaxRooms = Convert.ToInt32(textBoxMaxRooms.Text); need.MinFloor = Convert.ToInt32(textBoxMinFloor.Text); need.MaxFloor = Convert.ToInt32(textBoxMaxFloor.Text); need.MinFloors = Convert.ToInt32(textBoxMinFloors.Text); need.MaxFloors = Convert.ToInt32(textBoxMaxFloors.Text); Program.wftDb.SaveChanges(); ShowDemandSet(); } } else if (comboBoxTypes.SelectedIndex == 1) { if (listViewDemandSet_House.SelectedItems.Count == 1) { DemandSet need = listViewDemandSet_House.SelectedItems[0].Tag as DemandSet; need.IdRealtor = Convert.ToInt32(comboBoxRealtors.SelectedItem.ToString().Split('.')[0]); need.IdClient = Convert.ToInt32(comboBoxClients.SelectedItem.ToString().Split('.')[0]); need.Type = Convert.ToInt32(comboBoxTypes.SelectedItem.ToString().Split('.')[0]); need.MinPrice = Convert.ToInt32(textBoxMinPrice.Text); need.MaxPrice = Convert.ToInt32(textBoxMaxPrice.Text); need.MinArea = Convert.ToInt32(textBoxMinArea.Text); need.MaxArea = Convert.ToInt32(textBoxMaxArea.Text); need.MinRooms = Convert.ToInt32(textBoxMinRooms.Text); need.MaxRooms = Convert.ToInt32(textBoxMaxRooms.Text); need.MinFloors = Convert.ToInt32(textBoxMinFloors.Text); need.MaxFloors = Convert.ToInt32(textBoxMaxFloors.Text); Program.wftDb.SaveChanges(); ShowDemandSet(); } } else { if (listViewDemandSet_Land.SelectedItems.Count == 1) { DemandSet need = listViewDemandSet_Land.SelectedItems[0].Tag as DemandSet; need.IdRealtor = Convert.ToInt32(comboBoxRealtors.SelectedItem.ToString().Split('.')[0]); need.IdClient = Convert.ToInt32(comboBoxClients.SelectedItem.ToString().Split('.')[0]); need.MinPrice = Convert.ToInt32(textBoxMinPrice.Text); need.MaxPrice = Convert.ToInt32(textBoxMaxPrice.Text); need.MinArea = Convert.ToInt32(textBoxMinArea.Text); need.MaxArea = Convert.ToInt32(textBoxMaxArea.Text); Program.wftDb.SaveChanges(); ShowDemandSet(); } } }
private void buttonAdd_Click(object sender, EventArgs e) { { DemandSet realEstate = new DemandSet(); realEstate.IdAgent = Convert.ToInt32(comboBoxAgent.SelectedItem.ToString().Split('.')[0]); realEstate.IdClient = Convert.ToInt32(comboBoxClients.SelectedItem.ToString().Split('.')[0]); realEstate.MinPrice = Convert.ToInt64(textBoxMinPrice.Text); realEstate.MaxPrice = Convert.ToInt64(textBoxMaxPrice.Text); realEstate.MinArea = Convert.ToDouble(textBoxMinArea.Text); realEstate.MaxArea = Convert.ToDouble(textBoxMaxArea.Text); if (comboBoxRealEstate.SelectedIndex == 0) { realEstate.Type = 0; realEstate.MinRooms = Convert.ToInt32(textBoxMinRooms.Text); realEstate.MaxRooms = Convert.ToInt32(textBoxMaxRooms.Text); realEstate.MinFloor = Convert.ToInt32(textBoxMinFloor.Text); realEstate.MaxFloor = Convert.ToInt32(textBoxMaxFloor.Text); } else if (comboBoxRealEstate.SelectedIndex == 1) { realEstate.Type = 1; realEstate.MinFloors = Convert.ToInt32(textBoxMinFloors.Text); realEstate.MaxFloors = Convert.ToInt32(textBoxMaxFloors.Text); } else { realEstate.Type = 2; } Program.wftDb.DemandSet.Add(realEstate); Program.wftDb.SaveChanges(); ShowRealEstateSet(); } }
private void buttonEdit_Click(object sender, EventArgs e) { { if (comboBoxType.SelectedIndex == 0) { if (listViewApartment.SelectedItems.Count == 1) { DemandSet demand = listViewApartment.SelectedItems[0].Tag as DemandSet; demand.IdAgent = Convert.ToInt32(comboBoxAgent.SelectedItem.ToString().Split('.')[0]); demand.IdClient = Convert.ToInt32(comboBoxClient.SelectedItem.ToString().Split('.')[0]); demand.MinPrice = Convert.ToInt32(textBoxMinPrice.Text); demand.MaxPrice = Convert.ToInt32(textBoxMaxPrice.Text); demand.MinArea = Convert.ToDouble(textBoxMinArea.Text); demand.MaxArea = Convert.ToDouble(textBoxMaxArea.Text); demand.MinFloor = Convert.ToInt32(textBoxMinFloor.Text); demand.MaxFloor = Convert.ToInt32(textBoxMaxFloor.Text); demand.MinRooms = Convert.ToInt32(textBoxMinRooms.Text); demand.MaxRooms = Convert.ToInt32(textBoxMaxRooms.Text); Program.eSoftDB.SaveChanges(); ShowDemandsSet(); } } else if (comboBoxType.SelectedIndex == 1) { if (listViewHouse.SelectedItems.Count == 1) { DemandSet demand = listViewApartment.SelectedItems[0].Tag as DemandSet; demand.IdAgent = Convert.ToInt32(comboBoxAgent.SelectedItem.ToString().Split('.')[0]); demand.IdClient = Convert.ToInt32(comboBoxClient.SelectedItem.ToString().Split('.')[0]); demand.MinPrice = Convert.ToInt32(textBoxMinPrice.Text); demand.MaxPrice = Convert.ToInt32(textBoxMaxPrice.Text); demand.MinArea = Convert.ToDouble(textBoxMinArea.Text); demand.MaxArea = Convert.ToDouble(textBoxMaxArea.Text); demand.MinFloors = Convert.ToInt32(textBoxMinFloors.Text); demand.MaxFloors = Convert.ToInt32(textBoxMaxFloors.Text); Program.eSoftDB.SaveChanges(); ShowDemandsSet(); } } else if (comboBoxType.SelectedIndex == 2) { if (listViewLands.SelectedItems.Count == 1) { DemandSet demand = listViewApartment.SelectedItems[0].Tag as DemandSet; demand.IdAgent = Convert.ToInt32(comboBoxAgent.SelectedItem.ToString().Split('.')[0]); demand.IdClient = Convert.ToInt32(comboBoxClient.SelectedItem.ToString().Split('.')[0]); demand.MinPrice = Convert.ToInt32(textBoxMinPrice.Text); demand.MaxPrice = Convert.ToInt32(textBoxMaxPrice.Text); demand.MinArea = Convert.ToDouble(textBoxMinArea.Text); demand.MaxArea = Convert.ToDouble(textBoxMaxArea.Text); Program.eSoftDB.SaveChanges(); ShowDemandsSet(); } } else { MessageBox.Show("Данные не выбраны", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private void buttonAdd_Click(object sender, EventArgs e) { DemandSet demandSet = new DemandSet(); demandSet.IdClient = Convert.ToInt32(comboBoxClient.SelectedItem.ToString().Split('.')[0]); demandSet.IdAgent = Convert.ToInt32(comboBoxAgent.SelectedItem.ToString().Split('.')[0]); demandSet.MinArea = Convert.ToDouble(numericUpDownMinArea.Text); demandSet.MaxArea = Convert.ToDouble(numericUpDownMaxArea.Text); demandSet.MinPrice = Convert.ToInt32(numericUpDownMinPrice.Text); demandSet.MaxPrice = Convert.ToInt32(numericUpDownMaxPrice.Text); if (comboBoxType.SelectedIndex == (int)EstateType.apartment) { demandSet.Type = (int)EstateType.apartment; demandSet.MinFloor = Convert.ToInt32(numericUpDownMinFloor.Text); demandSet.MaxFloor = Convert.ToInt32(numericUpDownMaxFloor.Text); demandSet.MinRooms = Convert.ToInt32(numericUpDownMinRooms.Text); demandSet.MaxRooms = Convert.ToInt32(numericUpDownMaxRooms.Text); } else if (comboBoxType.SelectedIndex == (int)EstateType.home) { demandSet.Type = (int)EstateType.home; demandSet.MaxFloors = Convert.ToInt32(numericUpDownMaxFloors.Text); demandSet.MinFloors = Convert.ToInt32(numericUpDownMinFloors.Text); } else { demandSet.Type = (int)EstateType.earth; } Program.wftDb.DemandSet.Add(demandSet); Program.wftDb.SaveChanges(); ShowDemand(); }
private void listViewRealEstateSet_Apartment_SelectedIndexChanged(object sender, EventArgs e) { if ((listViewRealEstateSet_Apartment.SelectedItems.Count == 1)) { DemandSet realEstate = listViewRealEstateSet_Apartment.SelectedItems[0].Tag as DemandSet; comboBoxAgent.SelectedIndex = comboBoxAgent.FindString(realEstate.IdAgent.ToString()); comboBoxClients.SelectedIndex = comboBoxClients.FindString(realEstate.IdClient.ToString()); textBoxMinPrice.Text = realEstate.MinPrice.ToString(); textBoxMaxPrice.Text = realEstate.MaxPrice.ToString(); textBoxMinArea.Text = realEstate.MinArea.ToString(); textBoxMaxPrice.Text = realEstate.MaxPrice.ToString(); textBoxMinRooms.Text = realEstate.MinRooms.ToString(); textBoxMaxRooms.Text = realEstate.MaxRooms.ToString(); textBoxMinFloor.Text = realEstate.MinFloor.ToString(); textBoxMaxFloor.Text = realEstate.MaxFloor.ToString(); } else { comboBoxAgent.SelectedItem = null; comboBoxClients.SelectedItem = null; textBoxMinPrice.Text = ""; textBoxMaxPrice.Text = ""; textBoxMinArea.Text = ""; textBoxMaxPrice.Text = ""; textBoxMinRooms.Text = ""; textBoxMaxRooms.Text = ""; textBoxMinFloor.Text = ""; textBoxMaxFloor.Text = ""; } }
void Deductions() { if (comboBoxSupply.SelectedItem != null && comboBoxDemand.SelectedItem != null) { SupplySet supplySet = Program.wftDb.SupplySet.Find(Convert.ToInt32(comboBoxSupply.SelectedItem.ToString().Split('.')[0])); DemandSet demand = Program.wftDb.DemandSet.Find(Convert.ToInt32(comboBoxDemand.SelectedItem.ToString().Split('.')[0])); double customerCompanyDeductions = supplySet.Price * 0.03; textBoxCustomerCompanyDeductions.Text = customerCompanyDeductions.ToString("0.00"); if (demand.AgentSet.DealShare != null) { double agentCustomerDeductions = customerCompanyDeductions * Convert.ToDouble(demand.AgentSet.DealShare) / 100.00; textBoxAgentCustomerDeductions.Text = agentCustomerDeductions.ToString("0.00"); } else { double agentCustomerDeductions = customerCompanyDeductions * 0.45; textBoxAgentCustomerDeductions.Text = agentCustomerDeductions.ToString("0.00"); } } if (comboBoxSupply.SelectedItem != null) { SupplySet supplySet = Program.wftDb.SupplySet.Find(Convert.ToInt32(comboBoxSupply.SelectedItem.ToString().Split('.')[0])); double sellerCompanyDeductions; if (supplySet.RealEstateSet.Type == 0) { sellerCompanyDeductions = 36000 + supplySet.Price * 0.01; textBoxSellerCompanyDeductions.Text = sellerCompanyDeductions.ToString("0.00"); } else if (supplySet.RealEstateSet.Type == 1) { sellerCompanyDeductions = 38000 + supplySet.Price * 0.01; textBoxSellerCompanyDeductions.Text = sellerCompanyDeductions.ToString("0.00"); } else { sellerCompanyDeductions = 38000 + supplySet.Price * 0.02; textBoxSellerCompanyDeductions.Text = sellerCompanyDeductions.ToString("0.00"); } if (supplySet.AgentSet.DealShare != null) { double agentSellerDeductions = sellerCompanyDeductions * Convert.ToDouble(supplySet.AgentSet.DealShare) / 100.00; textBoxAgentSellerDeductions.Text = agentSellerDeductions.ToString("0.00"); } else { double agentSellerDeductions = sellerCompanyDeductions * 0.45; textBoxAgentSellerDeductions.Text = agentSellerDeductions.ToString("0.00"); } } else { textBoxSellerCompanyDeductions.Text = ""; textBoxAgentSellerDeductions.Text = ""; textBoxCustomerCompanyDeductions.Text = ""; textBoxAgentCustomerDeductions.Text = ""; } }
private void buttonAdd_Click(object sender, EventArgs e) { DemandSet demand = new DemandSet(); demand.MinPrice = Convert.ToInt32(textBoxMinPrice.Text); demand.MaxPrice = Convert.ToInt32(textBoxMaxPrice.Text); demand.MinArea = Convert.ToInt32(textBoxMinArea.Text); demand.MaxArea = Convert.ToInt32(textBoxMaxArea.Text); if (comboBoxType.SelectedIndex == 0) { demand.Type = 0; demand.MinRooms = Convert.ToInt32(textBoxMinRooms.Text); demand.MaxRooms = Convert.ToInt32(textBoxMaxRooms.Text); demand.MinFloor = Convert.ToInt32(textBoxMinFloor.Text); demand.MaxFloor = Convert.ToInt32(textBoxMaxFloor.Text); } else if (comboBoxType.SelectedIndex == 1) { demand.Type = 1; demand.MinFloors = Convert.ToInt32(textBoxMinFloors.Text); demand.MaxFloors = Convert.ToInt32(textBoxMaxFloors.Text); } else { demand.Type = 2; } Program.агенство_Недвижимости.DemandSet.Add(demand); Program.агенство_Недвижимости.SaveChanges(); ShowDemandSet(); }
private void listViewApartments_SelectedIndexChanged(object sender, EventArgs e) { if (listViewApartments.SelectedItems.Count == 1) { DemandSet demandSet = listViewApartments.SelectedItems[0].Tag as DemandSet; comboBoxClients.Text = demandSet.ClientsSet.LastName + " " + demandSet.ClientsSet.FirstName + " " + demandSet.ClientsSet.MiddleName.ToString(); comboBoxAgents.Text = demandSet.AgentSet.LastName + " " + demandSet.AgentSet.FirstName + " " + demandSet.AgentSet.MiddleName.ToString(); textBoxMinArea.Text = demandSet.MinArea.ToString(); textBoxMaxArea.Text = demandSet.MaxArea.ToString(); textBoxMinRooms.Text = demandSet.MinRooms.ToString(); textBoxMaxRooms.Text = demandSet.MaxRooms.ToString(); textBoxMinFloor.Text = demandSet.MinFloor.ToString(); textBoxMaxFloor.Text = demandSet.MaxFloor.ToString(); textBoxMinPrice.Text = demandSet.MinPrice.ToString(); textBoxMaxPrice.Text = demandSet.MaxPrice.ToString(); } else { textBoxMinPrice.Text = ""; textBoxMaxPrice.Text = ""; textBoxMinArea.Text = ""; textBoxMaxArea.Text = ""; textBoxMinRooms.Text = ""; textBoxMaxRooms.Text = ""; textBoxMinFloor.Text = ""; textBoxMaxFloor.Text = ""; comboBoxClients.Text = ""; comboBoxAgents.Text = ""; } }
private void buttonAdd_Click(object sender, EventArgs e) { DemandSet demandSet = new DemandSet(); demandSet.idClient = Convert.ToInt32(comboBoxClients.SelectedItem.ToString().Split('.')[0]); demandSet.idAgent = Convert.ToInt32(comboBoxAgents.SelectedItem.ToString().Split('.')[0]); demandSet.MinPrice = Convert.ToInt64(textBoxMinPrice.Text); demandSet.MaxPrice = Convert.ToInt64(textBoxMaxPrice.Text); demandSet.MinArea = Convert.ToInt32(textBoxMinArea.Text); demandSet.MaxArea = Convert.ToInt32(textBoxMaxArea.Text); if (comboBoxType.SelectedIndex == 0) { demandSet.Type = 0; demandSet.MinRooms = Convert.ToInt32(textBoxMinRooms.Text); demandSet.MaxRooms = Convert.ToInt32(textBoxMaxRooms.Text); demandSet.MinFloor = Convert.ToInt32(textBoxMinFloor.Text); demandSet.MaxFloor = Convert.ToInt32(textBoxMaxFloor.Text); } else if (comboBoxType.SelectedIndex == 1) { demandSet.Type = 1; demandSet.MinFloors = Convert.ToInt32(textBoxMinFloors.Text); demandSet.MaxFloors = Convert.ToInt32(textBoxMaxFloors.Text); } else { demandSet.Type = 2; } Program.wftDb.DemandSet.Add(demandSet); Program.wftDb.SaveChanges(); ShowDemandSet(); }
private void listViewRealEstateSet_Apartment_SelectedIndexChanged(object sender, EventArgs e) { if (listViewRealEstateSet_Apartment.SelectedItems.Count == 1) { //Ищем элемент из таблицы по тегу DemandSet demand = listViewRealEstateSet_Apartment.SelectedItems[0].Tag as DemandSet; //Обновляем данные на форме //Ищем в comboBoxAgents строку по ID риелтора и отображаем её comboBoxAgents.SelectedIndex = comboBoxAgents.FindString(demand.IdAgent.ToString()); //Тоже для comboBoxClients comboBoxClients.SelectedIndex = comboBoxClients.FindString(demand.IdClient.ToString()); textBoxMaxPrice.Text = demand.MaxPrice.ToString(); textBoxMinPrice.Text = demand.MinPrice.ToString(); textBoxMaxArea.Text = demand.MaxArea.ToString(); textBoxMinArea.Text = demand.MinArea.ToString(); textBoxMaxRooms.Text = demand.MaxRooms.ToString(); textBoxMinRooms.Text = demand.MinRooms.ToString(); textBoxMaxFloor.Text = demand.MaxFloor.ToString(); textBoxMinFloor.Text = demand.MinFloor.ToString(); } else { //Если ничего не выбрано, очищаем поля textBoxMaxPrice.Text = ""; textBoxMinPrice.Text = ""; textBoxMaxArea.Text = ""; textBoxMinArea.Text = ""; textBoxMaxRooms.Text = ""; textBoxMinRooms.Text = ""; textBoxMaxFloor.Text = ""; textBoxMinFloor.Text = ""; } }
private void listView_House_SelectedIndexChanged(object sender, EventArgs e) { if (listView_House.SelectedItems.Count == 1) { DemandSet demand = listView_House.SelectedItems[0].Tag as DemandSet; comboBoxAgents.SelectedIndex = comboBoxAgents.FindString(demand.IdAgent.ToString()); comboBoxClients.SelectedIndex = comboBoxClients.FindString(demand.IdClient.ToString()); textBoxMinPrice.Text = demand.MinPrice.ToString(); textBoxMaxPrice.Text = demand.MaxPrice.ToString(); textBoxMinArea.Text = demand.MinArea.ToString(); textBoxMaxArea.Text = demand.MaxArea.ToString(); textBoxMinFloors.Text = demand.MaxFloors.ToString(); textBoxMaxFloors.Text = demand.MaxFloors.ToString(); } else { comboBoxAgents.SelectedItem = null; comboBoxClients.SelectedItem = null; textBoxMinPrice.Text = ""; textBoxMaxPrice.Text = ""; textBoxMinArea.Text = ""; textBoxMaxArea.Text = ""; textBoxMinFloors.Text = ""; textBoxMaxFloors.Text = ""; } }
private void listViewDemand_Apartment_SelectedIndexChanged(object sender, EventArgs e) { if (listViewDemand_Apartment.SelectedItems.Count == 1) { DemandSet demand = listViewDemand_Apartment.SelectedItems[0].Tag as DemandSet; textBoxMinPrice.Text = demand.MinPrice.ToString(); textBoxMaxPrise.Text = demand.MaxPrice.ToString(); textBoxMaxPl.Text = demand.MaxArea.ToString(); textBoxminPl.Text = demand.MinArea.ToString(); textBoxmaxAtag.Text = demand.MaxFloor.ToString(); textBoxminAtag.Text = demand.MinFloor.ToString(); textBoxmaxKolK.Text = demand.MaxRooms.ToString(); textBoxminKoiK.Text = demand.MaxRooms.ToString(); } else { textBoxMinPrice.Text = ""; textBoxMaxPrise.Text = ""; textBoxMaxPl.Text = ""; textBoxminPl.Text = ""; textBoxmaxAtag.Text = ""; textBoxminAtag.Text = ""; textBoxmaxKolK.Text = ""; textBoxminKoiK.Text = ""; } }
private void buttonDel_Click(object sender, EventArgs e) { try { if (listViewDemandSet.SelectedItems.Count == 1) { DemandSet demand = listViewDemandSet.SelectedItems[0].Tag as DemandSet; Program.wftDb.DemandSet.Remove(demand); Program.wftDb.SaveChanges(); ShowDemandSet(); } comboBoxAgents.SelectedItem = null; comboBoxClients.SelectedItem = null; textBoxType.Text = ""; textBoxMinPrice.Text = ""; textBoxMaxPrice.Text = ""; textBoxMinArea.Text = ""; textBoxMaxArea.Text = ""; textBoxMinRooms.Text = ""; textBoxMaxRooms.Text = ""; textBoxMinFloor.Text = ""; textBoxMaxFloor.Text = ""; textBoxMinFloors.Text = ""; textBoxMaxFloors.Text = ""; } catch { MessageBox.Show("Невозможно удалить, эта запись используется!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void buttonAdd_Click(object sender, EventArgs e) { if (comboBoxAgents.SelectedItem != null && comboBoxClients.SelectedItem != null && textBoxType.Text != "") { { DemandSet demand = new DemandSet(); demand.IdAgent = Convert.ToInt32(comboBoxAgents.SelectedItem.ToString().Split('.')[0]); demand.IdClient = Convert.ToInt32(comboBoxClients.SelectedItem.ToString().Split('.')[0]); demand.Type = textBoxType.Text; demand.MinPrice = textBoxMinPrice.Text; demand.MaxPrice = textBoxMaxPrice.Text; demand.MinArea = textBoxMinArea.Text; demand.MaxArea = textBoxMaxArea.Text; demand.MinRooms = textBoxMinRooms.Text; demand.MaxRooms = textBoxMaxRooms.Text; demand.MinFloor = textBoxMinFloor.Text; demand.MaxFloor = textBoxMaxFloor.Text; demand.MinFloors = textBoxMinFloors.Text; demand.MaxFloors = textBoxMaxFloors.Text; Program.wftDb.DemandSet.Add(demand); Program.wftDb.SaveChanges(); ShowDemandSet(); } } else { MessageBox.Show("Данные не выбраны!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void listViewDemandSetLand_SelectedIndexChanged(object sender, EventArgs e) { //если в listView выбран элемент if (listViewDemandSetLand.SelectedItems.Count == 1) { //ищем элемент из таблицы по тегу DemandSet demand = listViewDemandSetLand.SelectedItems[0].Tag as DemandSet; //указываем, что может быть изменено //находим в comboBoxAgents необходимую строку по Id риэлтора из demand.IdAgent и задаем ее отображение comboBox-y comboBoxAgents.SelectedIndex = comboBoxAgents.FindString(demand.IdAgent.ToString()); //точно также с остальными comboBoxClients.SelectedIndex = comboBoxClients.FindString(demand.IdClient.ToString()); textBoxMinPrice.Text = demand.MinPrice.ToString(); textBoxMaxPrice.Text = demand.MaxPrice.ToString(); textBoxMinSquare.Text = demand.MinArea.ToString(); textBoxMaxSquare.Text = demand.MaxArea.ToString(); } else { //если не выбран ни один элемент, задаем пустые элементы comboBoxAgents.SelectedItem = null; comboBoxClients.SelectedItem = null; textBoxMinPrice.Text = ""; textBoxMaxPrice.Text = ""; textBoxMinSquare.Text = ""; textBoxMaxSquare.Text = ""; } }
private void listViewDemandSet_Land_SelectedIndexChanged(object sender, EventArgs e) { //если выбран один элемент if (listViewDemandSet_Land.SelectedItems.Count == 1) { //ищем элемент из таблицы по тегу DemandSet demandSet = listViewDemandSet_Land.SelectedItems[0].Tag as DemandSet; //указываем, что может быть изменено textBoxMinPrice.Text = demandSet.MinPrice.ToString(); textBoxMaxPrice.Text = demandSet.MaxPrice.ToString(); textBoxMinArea.Text = demandSet.MinArea.ToString(); textBoxMaxArea.Text = demandSet.MaxArea.ToString(); comboBoxClients.Text = demandSet.ClientsSet.LastName + " " + demandSet.ClientsSet.FirstName + " " + demandSet.ClientsSet.MiddleName.ToString(); comboBoxAgents.Text = demandSet.AgentsSet.LastName + " " + demandSet.AgentsSet.FirstName + " " + demandSet.AgentsSet.MiddleName.ToString(); } else { //если не выбран ни один элемент, задаем пустые поля textBoxMinPrice.Text = ""; textBoxMaxPrice.Text = ""; textBoxMinArea.Text = ""; textBoxMaxArea.Text = ""; comboBoxClients.Text = ""; comboBoxAgents.Text = ""; } }
private void listViewApartament_SelectedIndexChanged_1(object sender, EventArgs e) { if (listViewApartament.SelectedItems.Count == 1) { DemandSet demandSet = listViewApartament.SelectedItems[0].Tag as DemandSet; comboBoxAgent.SelectedIndex = comboBoxAgent.FindString(demandSet.IdAgent.ToString()); comboBoxClient.SelectedIndex = comboBoxClient.FindString(demandSet.IdClient.ToString()); textBoxMinRooms.Text = demandSet.MinRooms.ToString(); textBoxMaxRooms.Text = demandSet.MaxRooms.ToString(); textBoxMinFloor.Text = demandSet.MinFloor.ToString(); textBoxMaxFloor.Text = demandSet.MaxFloor.ToString(); textBoxMaxArea.Text = demandSet.MaxArea.ToString(); textBoxMinArea.Text = demandSet.MinArea.ToString(); textBoxMaxPrice.Text = demandSet.MaxPrice.ToString(); textBoxMinPrice.Text = demandSet.MinPrice.ToString(); } else { textBoxMinRooms.Text = ""; textBoxMaxRooms.Text = ""; textBoxMinFloor.Text = ""; textBoxMaxFloor.Text = ""; textBoxMaxArea.Text = ""; textBoxMinArea.Text = ""; textBoxMaxPrice.Text = ""; textBoxMinPrice.Text = ""; comboBoxAgent.SelectedItem = null; comboBoxClient.SelectedItem = null; } }
private void buttonDel_Click(object sender, EventArgs e) { if (comboBoxType.SelectedItem.ToString() == "Квартира") { if (listViewApartament.SelectedItems.Count == 1) { DemandSet demandSet = listViewApartament.SelectedItems[0].Tag as DemandSet; Program.wftDb.DemandSet.Remove(demandSet); Program.wftDb.SaveChanges(); } } else if (comboBoxType.SelectedItem.ToString() == "Дом") { if (listViewHouse.SelectedItems.Count == 1) { DemandSet demandSet = listViewHouse.SelectedItems[0].Tag as DemandSet; Program.wftDb.DemandSet.Remove(demandSet); Program.wftDb.SaveChanges(); } } else if (comboBoxType.SelectedItem.ToString() == "Земля") { if (listViewLand.SelectedItems.Count == 1) { DemandSet demandSet = listViewLand.SelectedItems[0].Tag as DemandSet; Program.wftDb.DemandSet.Remove(demandSet); Program.wftDb.SaveChanges(); } } ShowListViewLand(); ShowListViewApartament(); ShowListViewHouse(); }
private void buttonDel_Click(object sender, EventArgs e) { try { if (comboBoxType.SelectedIndex == 0) { if (listViewDemandSet_Apartment.SelectedItems.Count == 1) { DemandSet demand = listViewDemandSet_Apartment.SelectedItems[0].Tag as DemandSet; Program.агенство_Недвижимости.DemandSet.Remove(demand); Program.агенство_Недвижимости.SaveChanges(); ShowDemandSet(); } textBoxMinPrice.Text = ""; textBoxMaxPrice.Text = ""; textBoxMinArea.Text = ""; textBoxMaxArea.Text = ""; textBoxMinRooms.Text = ""; textBoxMaxRooms.Text = ""; textBoxMinFloor.Text = ""; textBoxMaxFloor.Text = ""; } else if (comboBoxType.SelectedIndex == 1) { if (listViewDemandSet_House.SelectedItems.Count == 1) { DemandSet demand = listViewDemandSet_House.SelectedItems[0].Tag as DemandSet; Program.агенство_Недвижимости.DemandSet.Remove(demand); Program.агенство_Недвижимости.SaveChanges(); ShowDemandSet(); } textBoxMinPrice.Text = ""; textBoxMaxPrice.Text = ""; textBoxMinArea.Text = ""; textBoxMaxArea.Text = ""; textBoxMinFloors.Text = ""; textBoxMaxFloors.Text = ""; } else { if (listViewDemandSet_Land.SelectedItems.Count == 1) { DemandSet demand = listViewDemandSet_Land.SelectedItems[0].Tag as DemandSet; Program.агенство_Недвижимости.DemandSet.Remove(demand); Program.агенство_Недвижимости.SaveChanges(); ShowDemandSet(); } textBoxMinPrice.Text = ""; textBoxMaxPrice.Text = ""; textBoxMinArea.Text = ""; textBoxMaxArea.Text = ""; } } catch { MessageBox.Show("Невозможно удалить!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void buttonDel_Click(object sender, EventArgs e) { try { if (comboBoxType.SelectedIndex == 0) { if (listViewDemand_Apartment.SelectedItems.Count == 1) { DemandSet demand = listViewDemand_Apartment.SelectedItems[0].Tag as DemandSet; Program.wfedb.DemandSet.Remove(demand); Program.wfedb.SaveChanges(); ShowDemand(); } textBoxMinPrice.Text = ""; textBoxMaxPrise.Text = ""; textBoxMaxPl.Text = ""; textBoxminPl.Text = ""; textBoxmaxAtag.Text = ""; textBoxminAtag.Text = ""; textBoxmaxKolK.Text = ""; textBoxminKoiK.Text = ""; } else if (comboBoxType.SelectedIndex == 1) { if (listViewDemand_House.SelectedItems.Count == 1) { DemandSet demand = listViewDemand_House.SelectedItems[0].Tag as DemandSet; Program.wfedb.DemandSet.Remove(demand); Program.wfedb.SaveChanges(); ShowDemand(); } textBoxMinPrice.Text = ""; textBoxMaxPrise.Text = ""; textBoxMaxPl.Text = ""; textBoxminPl.Text = ""; textBoxminAtagD.Text = ""; textBoxmaxAtagD.Text = ""; } else { if (listViewDemand_Land.SelectedItems.Count == 1) { DemandSet demand = listViewDemand_Land.SelectedItems[0].Tag as DemandSet; Program.wfedb.DemandSet.Remove(demand); Program.wfedb.SaveChanges(); ShowDemand(); } textBoxMinPrice.Text = ""; textBoxMaxPrise.Text = ""; textBoxMaxPl.Text = ""; textBoxminPl.Text = ""; } } catch { MessageBox.Show("Невозможно удалить, эта запись используется", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void buttonEdit_Click(object sender, EventArgs e) { if (comboBoxType.SelectedIndex == (int)EstateType.apartment) { if (listViewApartment.SelectedItems.Count == 1) { DemandSet demandSet = (DemandSet)listViewApartment.SelectedItems[0].Tag; demandSet.IdClient = Convert.ToInt32(comboBoxClient.SelectedItem.ToString().Split('.')[0]); demandSet.IdAgent = Convert.ToInt32(comboBoxAgent.SelectedItem.ToString().Split('.')[0]); demandSet.MinArea = Convert.ToDouble(numericUpDownMinArea.Text); demandSet.MaxArea = Convert.ToDouble(numericUpDownMaxArea.Text); demandSet.MinPrice = Convert.ToInt32(numericUpDownMinPrice.Text); demandSet.MaxPrice = Convert.ToInt32(numericUpDownMaxPrice.Text); demandSet.Type = (int)EstateType.apartment; demandSet.MinFloor = Convert.ToInt32(numericUpDownMinFloor.Text); demandSet.MaxFloor = Convert.ToInt32(numericUpDownMaxFloor.Text); demandSet.MinRooms = Convert.ToInt32(numericUpDownMinRooms.Text); demandSet.MaxRooms = Convert.ToInt32(numericUpDownMaxRooms.Text); Program.wftDb.SaveChanges(); ShowDemand(); } } else if (comboBoxType.SelectedIndex == (int)EstateType.home) { if (listViewHome.SelectedItems.Count == 1) { DemandSet demandSet = (DemandSet)listViewHome.SelectedItems[0].Tag; demandSet.IdClient = Convert.ToInt32(comboBoxClient.SelectedItem.ToString().Split('.')[0]); demandSet.IdAgent = Convert.ToInt32(comboBoxAgent.SelectedItem.ToString().Split('.')[0]); demandSet.MinArea = Convert.ToDouble(numericUpDownMinArea.Text); demandSet.MaxArea = Convert.ToDouble(numericUpDownMaxArea.Text); demandSet.MinPrice = Convert.ToInt32(numericUpDownMinPrice.Text); demandSet.MaxPrice = Convert.ToInt32(numericUpDownMaxPrice.Text); demandSet.Type = (int)EstateType.home; demandSet.MaxFloors = Convert.ToInt32(numericUpDownMaxFloors.Text); demandSet.MinFloors = Convert.ToInt32(numericUpDownMinFloors.Text); Program.wftDb.SaveChanges(); ShowDemand(); } } else { if (listViewEarth.SelectedItems.Count == 1) { DemandSet demandSet = (DemandSet)listViewEarth.SelectedItems[0].Tag; demandSet.IdClient = Convert.ToInt32(comboBoxClient.SelectedItem.ToString().Split('.')[0]); demandSet.IdAgent = Convert.ToInt32(comboBoxAgent.SelectedItem.ToString().Split('.')[0]); demandSet.MinArea = Convert.ToDouble(numericUpDownMinArea.Text); demandSet.MaxArea = Convert.ToDouble(numericUpDownMaxArea.Text); demandSet.MinPrice = Convert.ToInt32(numericUpDownMinPrice.Text); demandSet.MaxPrice = Convert.ToInt32(numericUpDownMaxPrice.Text); demandSet.Type = (int)EstateType.earth; Program.wftDb.SaveChanges(); ShowDemand(); } } }
private void buttonEdit_Click(object sender, EventArgs e) { if (comboBoxType.SelectedIndex == 0) { if (listViewApartament.SelectedItems.Count == 1) { DemandSet demand = listViewApartament.SelectedItems[0].Tag as DemandSet; demand.IDRieltor = Convert.ToInt32(comboBoxRieltor.SelectedItem.ToString().Split('.')[0]); demand.IDClient = Convert.ToInt32(comboBoxClient.SelectedItem.ToString().Split('.')[0]); demand.MinPrise = Convert.ToInt64(textBoxMinPrise.Text); demand.MaxPrise = Convert.ToInt64(textBoxMaxPrise.Text); demand.MinArea = Convert.ToInt64(textBoxMinArea.Text); demand.MaxArea = Convert.ToInt64(textBoxMaxArea.Text); demand.MinRooms = Convert.ToInt32(textBoxMinRooms.Text); demand.MaxRooms = Convert.ToInt32(textBoxMaxRooms.Text); demand.MinFloor = Convert.ToInt32(textBoxMinFloor.Text); demand.MaxFloor = Convert.ToInt32(textBoxMaxFloor.Text); Program.wtfDb.SaveChanges(); ShowDemandSet(); } } else if (comboBoxType.SelectedIndex == 1) { if (listViewHouse.SelectedItems.Count == 1) { DemandSet demand = listViewHouse.SelectedItems[0].Tag as DemandSet; demand.IDRieltor = Convert.ToInt32(comboBoxRieltor.SelectedItem.ToString().Split('.')[0]); demand.IDClient = Convert.ToInt32(comboBoxClient.SelectedItem.ToString().Split('.')[0]); demand.MinPrise = Convert.ToInt64(textBoxMinPrise.Text); demand.MaxPrise = Convert.ToInt64(textBoxMaxPrise.Text); demand.MinArea = Convert.ToInt64(textBoxMinArea.Text); demand.MaxArea = Convert.ToInt64(textBoxMaxArea.Text); demand.MinFloors = Convert.ToInt32(textBoxMinFloors.Text); demand.MaxFloors = Convert.ToInt32(textBoxMaxFloors.Text); demand.MinRooms = Convert.ToInt32(textBoxMinRooms.Text); demand.MaxRooms = Convert.ToInt32(textBoxMaxRooms.Text); Program.wtfDb.SaveChanges(); ShowDemandSet(); } } else { if (listViewLand.SelectedItems.Count == 1) { DemandSet demand = listViewLand.SelectedItems[0].Tag as DemandSet; demand.IDRieltor = Convert.ToInt32(comboBoxRieltor.SelectedItem.ToString().Split('.')[0]); demand.IDClient = Convert.ToInt32(comboBoxClient.SelectedItem.ToString().Split('.')[0]); demand.MinPrise = Convert.ToInt64(textBoxMinPrise.Text); demand.MaxPrise = Convert.ToInt64(textBoxMaxPrise.Text); demand.MinArea = Convert.ToInt64(textBoxMinArea.Text); demand.MaxArea = Convert.ToInt64(textBoxMaxArea.Text); Program.wtfDb.SaveChanges(); ShowDemandSet(); } } }
private void buttonEdit_Click(object sender, EventArgs e) { if (comboBoxType.SelectedIndex == 0) { if (listViewDemand_Apartment.SelectedItems.Count == 1) { DemandSet demand = listViewDemand_Apartment.SelectedItems[0].Tag as DemandSet; demand.IdAgent = Convert.ToInt32(comboBoxAgent.SelectedItem.ToString().Split('.')[0]); demand.IdClient = Convert.ToInt32(comboBoxClient.SelectedItem.ToString().Split('.')[0]); demand.MinPrice = Convert.ToInt64(textBoxMinPrice.Text); demand.MaxPrice = Convert.ToInt64(textBoxMaxPrise.Text); demand.MinRooms = Convert.ToInt32(textBoxminKoiK.Text); demand.MaxRooms = Convert.ToInt32(textBoxmaxKolK.Text); demand.MinArea = Convert.ToInt64(textBoxminPl.Text); demand.MaxArea = Convert.ToInt64(textBoxMaxPl.Text); demand.MinFloor = Convert.ToInt32(textBoxminAtag.Text); demand.MaxFloor = Convert.ToInt32(textBoxmaxAtag.Text); Program.wfedb.SaveChanges(); ShowDemand(); } } else if (comboBoxType.SelectedIndex == 1) { if (listViewDemand_House.SelectedItems.Count == 1) { DemandSet demand = listViewDemand_House.SelectedItems[0].Tag as DemandSet; demand.IdAgent = Convert.ToInt32(comboBoxAgent.SelectedItem.ToString().Split('.')[0]); demand.IdClient = Convert.ToInt32(comboBoxClient.SelectedItem.ToString().Split('.')[0]); demand.MinPrice = Convert.ToInt64(textBoxMinPrice.Text); demand.MaxPrice = Convert.ToInt64(textBoxMaxPrise.Text); demand.MinArea = Convert.ToInt64(textBoxminPl.Text); demand.MaxArea = Convert.ToInt64(textBoxMaxPl.Text); demand.MinFloors = Convert.ToInt32(textBoxminAtagD.Text); demand.MaxFloors = Convert.ToInt32(textBoxminAtagD.Text); } Program.wfedb.SaveChanges(); ShowDemand(); } else { if (listViewDemand_Land.SelectedItems.Count == 1) { DemandSet demand = listViewDemand_Land.SelectedItems[0].Tag as DemandSet; demand.IdAgent = Convert.ToInt32(comboBoxAgent.SelectedItem.ToString().Split('.')[0]); demand.IdClient = Convert.ToInt32(comboBoxClient.SelectedItem.ToString().Split('.')[0]); demand.MinPrice = Convert.ToInt64(textBoxMinPrice.Text); demand.MaxPrice = Convert.ToInt64(textBoxMaxPrise.Text); demand.MinArea = Convert.ToInt64(textBoxminPl.Text); demand.MaxArea = Convert.ToInt64(textBoxMaxPl.Text); Program.wfedb.SaveChanges(); ShowDemand(); } } }
private void buttonAdd_Click(object sender, EventArgs e) { if (comboBoxRealtors.SelectedItem != null && comboBoxClients.SelectedItem != null) { DemandSet need = new DemandSet(); need.IdRealtor = Convert.ToInt32(comboBoxRealtors.SelectedItem.ToString().Split('.')[0]); need.IdClient = Convert.ToInt32(comboBoxClients.SelectedItem.ToString().Split('.')[0]); need.MinPrice = Convert.ToInt32(textBoxMinPrice.Text); need.MaxPrice = Convert.ToInt32(textBoxMaxPrice.Text); need.MinArea = Convert.ToInt32(textBoxMinArea.Text); need.MaxArea = Convert.ToInt32(textBoxMaxArea.Text); need.MinRooms = Convert.ToInt32(textBoxMinRooms.Text); need.MaxRooms = Convert.ToInt32(textBoxMaxRooms.Text); need.MinFloors = Convert.ToInt32(textBoxMinFloors.Text); need.MaxFloors = Convert.ToInt32(textBoxMaxFloors.Text); if (comboBoxTypes.SelectedIndex == 0) { need.Type = 0; } else if (comboBoxTypes.SelectedIndex == 1) { need.Type = 1; if (textBoxMinFloor.Text != "") { need.MinFloor = Convert.ToInt32(textBoxMinFloor.Text); } else { need.MinFloor = null; } if (textBoxMaxFloor.Text != "") { need.MaxFloor = Convert.ToInt32(textBoxMaxFloor.Text); } else { need.MaxFloor = null; } } else { need.Type = 2; } Program.wftDb.DemandSet.Add(need); Program.wftDb.SaveChanges(); ShowDemandSet(); } else { MessageBox.Show("Данные не выбраны", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void listViewLand_SelectedIndexChanged(object sender, EventArgs e) { if (listViewLand.SelectedItems.Count == 1) { DemandSet demandSet = listViewLand.SelectedItems[0].Tag as DemandSet; comboBoxAgents.SelectedIndex = comboBoxAgents.FindString(demandSet.IdAgent.ToString()); comboBoxClients.SelectedIndex = comboBoxClients.FindString(demandSet.IdClient.ToString()); textBoxMinPrice.Text = demandSet.MinPrice.ToString(); textBoxMaxPrice.Text = demandSet.MaxPrice.ToString(); textBoxMinArea.Text = demandSet.MinArea.ToString(); textBoxMaxArea.Text = demandSet.MaxArea.ToString(); } }
private void buttonAdd_Click(object sender, EventArgs e) { if (comboBoxAgents.SelectedItem != null && comboBoxClients.SelectedItem != null && comboBoxType.SelectedItem != null) { //Новый экземпляр класса Потребности DemandSet demand = new DemandSet(); //Из выбранной строки в comboBoxAgents отделяем ID риелтора(после него точка) и делаем ссылку demand.IdAgent demand.IdAgent = Convert.ToInt32(comboBoxAgents.SelectedItem.ToString().Split('.')[0]); //Так же отделяем ID клиента demand.IdClient = Convert.ToInt32(comboBoxClients.SelectedItem.ToString().Split('.')[0]); //Деньги лучше держать в Int64 demand.MinPrice = Convert.ToInt64(textBoxMinPrice.Text); demand.MaxPrice = Convert.ToInt64(textBoxMaxPrice.Text); demand.MinArea = Convert.ToDouble(textBoxMinArea.Text); demand.MaxArea = Convert.ToDouble(textBoxMaxArea.Text); //Дополнительные поля типа Квартира if (comboBoxType.SelectedIndex == 0) { demand.Type = 0; demand.MinFloor = Convert.ToInt32(textBoxMinFloor.Text); demand.MaxFloor = Convert.ToInt32(textBoxMaxFloor.Text); demand.MinRooms = Convert.ToInt32(textBoxMinRooms.Text); demand.MaxRooms = Convert.ToInt32(textBoxMaxRooms.Text); } //Дополнительные поля типа Дом else if (comboBoxType.SelectedIndex == 1) { demand.Type = 1; demand.MinFloors = Convert.ToInt32(textBoxMinFloors.Text); demand.MaxFloors = Convert.ToInt32(textBoxMaxFloors.Text); } //Дополнительные поля типа Земля else if (comboBoxType.SelectedIndex == 2) { demand.Type = 2; } //Добавляем новый объект недвижимости demand в таблицу DemandSet Program.wftDB.DemandSet.Add(demand); //Сохраняем изменения Program.wftDB.SaveChanges(); ShowDemandsSet(); } else { MessageBox.Show("Данные не выбраны", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void buttonEdit_Click(object sender, EventArgs e) { if (comboBoxType.SelectedIndex == 0) { if (listViewDemandSet_Apartment.SelectedItems.Count == 1) { DemandSet demand = listViewDemandSet_Apartment.SelectedItems[0].Tag as DemandSet; demand.MinPrice = Convert.ToInt32(textBoxMinPrice.Text); demand.MaxPrice = Convert.ToInt32(textBoxMaxPrice.Text); demand.MinArea = Convert.ToInt32(textBoxMinArea.Text); demand.MaxArea = Convert.ToInt32(textBoxMaxArea.Text); demand.MinRooms = Convert.ToInt32(textBoxMinRooms.Text); demand.MaxRooms = Convert.ToInt32(textBoxMaxRooms.Text); demand.MinFloor = Convert.ToInt32(textBoxMinFloor.Text); demand.MaxFloor = Convert.ToInt32(textBoxMaxFloor.Text); Program.агенство_Недвижимости.SaveChanges(); ShowDemandSet(); } } else if (comboBoxType.SelectedIndex == 1) { if (listViewDemandSet_House.SelectedItems.Count == 1) { DemandSet demand = listViewDemandSet_House.SelectedItems[0].Tag as DemandSet; demand.MinPrice = Convert.ToInt32(textBoxMinPrice.Text); demand.MaxPrice = Convert.ToInt32(textBoxMaxPrice.Text); demand.MinArea = Convert.ToInt32(textBoxMinArea.Text); demand.MaxArea = Convert.ToInt32(textBoxMaxArea.Text); demand.MinFloors = Convert.ToInt32(textBoxMinFloors.Text); demand.MaxFloors = Convert.ToInt32(textBoxMaxFloors.Text); Program.агенство_Недвижимости.SaveChanges(); ShowDemandSet(); } } else { if (listViewDemandSet_Land.SelectedItems.Count == 1) { DemandSet demand = listViewDemandSet_Land.SelectedItems[0].Tag as DemandSet; demand.MinPrice = Convert.ToInt32(textBoxMinPrice.Text); demand.MaxPrice = Convert.ToInt32(textBoxMaxPrice.Text); demand.MinArea = Convert.ToInt32(textBoxMinArea.Text); demand.MaxArea = Convert.ToInt32(textBoxMaxArea.Text); Program.агенство_Недвижимости.SaveChanges(); ShowDemandSet(); } } }
private void listViewEarth_SelectedIndexChanged(object sender, EventArgs e) { if (listViewEarth.SelectedItems.Count == 1) { DemandSet demandSet = (DemandSet)listViewEarth.SelectedItems[0].Tag; comboBoxAgent.SelectedIndex = comboBoxAgent.FindString(demandSet.IdAgent.ToString()); comboBoxClient.SelectedIndex = comboBoxClient.FindString(demandSet.IdClient.ToString()); numericUpDownMinArea.Text = demandSet.MinArea.ToString(); numericUpDownMaxArea.Text = demandSet.MaxArea.ToString(); numericUpDownMinPrice.Text = demandSet.MinPrice.ToString(); numericUpDownMaxPrice.Text = demandSet.MaxPrice.ToString(); } else { clearAllInput(); } }
private void listViewDemand_Land_SelectedIndexChanged(object sender, EventArgs e) { if (listViewDemand_Land.SelectedItems.Count == 1) { DemandSet demand = listViewDemand_Land.SelectedItems[0].Tag as DemandSet; textBoxMinPrice.Text = demand.MinPrice.ToString(); textBoxMaxPrise.Text = demand.MaxPrice.ToString(); textBoxMaxPl.Text = demand.MaxArea.ToString(); textBoxminPl.Text = demand.MinArea.ToString(); } else { textBoxMinPrice.Text = ""; textBoxMaxPrise.Text = ""; textBoxMaxPl.Text = ""; textBoxminPl.Text = ""; } }