//обновление данных private void reboot(ComboBox cmb1, ComboBox cmb2) { cmb1.Items.Clear(); string s = ""; @base @base = new @base(izm_zapr("select distinct potr.Id, potr.mincena, potr.maxcena, potr.agent, potr.klient, potr.city, potr.street, filter_h.minetag, filter_h.maxetag, filter_h.minrooms, filter_h.maxrooms, filter_h.mins, filter_h.maxs from potr, filter_h, sdelka where potr.dop_info = filter_h.Id and potr.obj = N'Дом' and not potr.Id in (select potr from sdelka)")); s += @base.vuvod_zakazov("house"); @base.smena_zaprosa(izm_zapr("select distinct potr.Id, potr.mincena, potr.maxcena, potr.agent, potr.klient, potr.city, potr.street, filter_kw.minetag, filter_kw.maxetag, filter_kw.minrooms, filter_kw.maxrooms, filter_kw.mins, filter_kw.maxs from potr, filter_kw, sdelka where potr.dop_info = filter_kw.Id and potr.obj = N'Квартира' and not potr.Id in (select potr from sdelka)")); s += @base.vuvod_zakazov("kw"); @base.smena_zaprosa(izm_zapr("select distinct potr.Id, potr.mincena, potr.maxcena, potr.agent, potr.klient, potr.city, potr.street, filter_l.mins, filter_l.maxs from potr, filter_l, sdelka where potr.dop_info = filter_l.Id and potr.obj = N'Земля' and not potr.Id in (select potr from sdelka)")); s += @base.vuvod_zakazov("land"); cmb1.Items.Clear(); if (s == "") { cmb1.Items.Add("Отсутствуют данные в БД"); } else { s = s.Remove(s.Length - 1); arr = s.Split('&'); cmb1.Items.AddRange(get_fio(arr)); } s = ""; arr = null; cmb2.Items.Clear(); @base.smena_zaprosa(izm_zapr("select distinct predlog.Id, obj.city, obj.street, obj.nm_h, house.etag, house.rooms, house.s, predlog.agent, predlog.klient from obj, house, predlog, sdelka where obj.dop_inf = house.Id and obj.Id = predlog.obj and obj.nm_kw is null and not predlog.Id in (select predl from sdelka)")); s += @base.vuvod_obj("house", true); @base.smena_zaprosa(izm_zapr("select distinct predlog.Id, obj.city, obj.street, obj.nm_h, obj.nm_kw, kw.etag, kw.rooms, kw.s, predlog.agent, predlog.klient from obj, kw, predlog, sdelka where obj.dop_inf = kw.Id and obj.Id = predlog.obj and obj.nm_kw is not null and not predlog.Id in (select predl from sdelka)")); s += @base.vuvod_obj("kw", true); @base.smena_zaprosa(izm_zapr("select distinct predlog.Id, obj.city, obj.street, land.s, predlog.agent, predlog.klient from obj, land, predlog, sdelka where obj.dop_inf = land.Id and obj.Id = predlog.obj and obj.nm_kw is null and obj.nm_h is null and not predlog.Id in (select predl from sdelka)")); s += @base.vuvod_obj("land", true); if (s == "") { cmb2.Items.Add("Отсутствуют данные в БД"); } else { s = s.Remove(s.Length - 1); arr = s.Split('&'); cmb2.Items.AddRange(get_cena(arr)); } }
//получение данных private void get_data(ComboBox cmb1, ComboBox cmb2, ComboBox cmb3) { @base @base = new @base("select distinct agent.Id, man.fam, man.name, man.otch from man, agent, klient where man.dop_info = agent.Id and agent.Id <> klient.Id"); znachenia = @base.vuvod(); zapis_v_combobox(cmb1); @base.smena_zaprosa("select distinct klient.Id, man.fam, man.name, man.otch from man, klient, agent where man.dop_info = klient.Id and agent.Id <> klient.Id"); znachenia = @base.vuvod(); zapis_v_combobox(cmb2); @base.smena_zaprosa("select obj.Id, obj.city, obj.street, obj.nm_h, obj.nm_kw, kw.etag, kw.rooms, kw.s from obj, kw where obj.dop_inf = kw.Id"); znachenia = @base.vuvod_obj("kw", false); @base.smena_zaprosa("select obj.Id, obj.city, obj.street, obj.nm_h, house.etag, house.rooms, house.s from obj, house where obj.dop_inf = house.Id"); znachenia += @base.vuvod_obj("house", false); @base.smena_zaprosa("select obj.Id, obj.city, obj.street, land.s from obj, land where obj.dop_inf = land.Id"); znachenia += @base.vuvod_obj("land", false); if (znachenia == "") { znachenia = "Отсутствую данные в БД"; } zapis_v_combobox(cmb3); }
//получение данных из БД и запись из в comboBox3, comboBox4 private void tab2() { reboot(comboBox3, comboBox4); if (idTextBox.Text == "") { comboBox3.Enabled = false; comboBox4.Enabled = false; sdelkaBindingNavigator.Enabled = false; } else { string s = ""; bool b; @base @base = new @base("select predlog.Id, obj.city, obj.street, obj.nm_h, house.etag, house.rooms, house.s, predlog.agent, predlog.klient from obj, house, predlog where obj.dop_inf = house.Id and obj.Id = predlog.obj and obj.nm_kw is null and predlog.Id = " + predlTextBox.Text + ""); b = @base.proverka_znachenei_v_bd(); if (b == true) { s = @base.vuvod_obj("house", true); } else { @base.smena_zaprosa("select predlog.Id, obj.city, obj.street, obj.nm_h, obj.nm_kw, kw.etag, kw.rooms, kw.s, predlog.agent, predlog.klient from obj, kw, predlog where obj.dop_inf = kw.Id and obj.Id = predlog.obj and obj.nm_kw is not null and predlog.Id = " + predlTextBox.Text + ""); b = @base.proverka_znachenei_v_bd(); if (b == true) { s = @base.vuvod_obj("kw", true); } else { @base.smena_zaprosa("select predlog.Id, obj.city, obj.street, land.s, predlog.agent, predlog.klient from obj, land, predlog where obj.dop_inf = land.Id and obj.Id = predlog.obj and obj.nm_kw is null and obj.nm_h is null and predlog.Id = " + predlTextBox.Text + ""); s = @base.vuvod_obj("land", true); } } s = s.Remove(s.Length - 1); arr = s.Split('&'); arr = get_cena(arr); comboBox4.Items.Add(arr[0]); comboBox4.SelectedItem = arr[0]; @base.smena_zaprosa("select potr.Id, potr.mincena, potr.maxcena, potr.agent, potr.klient, potr.city, potr.street, filter_h.minetag, filter_h.maxetag, filter_h.minrooms, filter_h.maxrooms, filter_h.mins, filter_h.maxs from potr, filter_h, sdelka where potr.dop_info = filter_h.Id and potr.obj = N'Дом' and potr.Id = " + potrTextBox.Text + " and sdelka.potr = " + potrTextBox.Text + ""); b = @base.proverka_znachenei_v_bd(); if (b == true) { s = @base.vuvod_zakazov("house"); } else { @base.smena_zaprosa("select potr.Id, potr.mincena, potr.maxcena, potr.agent, potr.klient, potr.city, potr.street, filter_kw.minetag, filter_kw.maxetag, filter_kw.minrooms, filter_kw.maxrooms, filter_kw.mins, filter_kw.maxs from potr, filter_kw, sdelka where potr.dop_info = filter_kw.Id and potr.obj = N'Квартира' and potr.Id = " + potrTextBox.Text + " and sdelka.potr = " + potrTextBox.Text + ""); b = @base.proverka_znachenei_v_bd(); if (b == true) { s = @base.vuvod_zakazov("kw"); } else { @base.smena_zaprosa("select potr.Id, potr.mincena, potr.maxcena, potr.agent, potr.klient, potr.city, potr.street, filter_l.mins, filter_l.maxs from potr, filter_l, sdelka where potr.dop_info = filter_l.Id and potr.obj = N'Земля' and potr.Id = " + potrTextBox.Text + " and sdelka.potr = " + potrTextBox.Text + ""); s = @base.vuvod_zakazov("land"); } } s = s.Remove(s.Length - 1); arr = s.Split('&'); arr = get_fio(arr); comboBox3.Items.Add(arr[0]); comboBox3.SelectedItem = arr[0]; } }