public void loadTables() { listBox1.Items.Clear(); if (cbTableType.SelectedItem != null) { int tableTypeId = ((itemObj)cbTableType.SelectedItem).Id_o; List <tablesInfo> tInfo = classesOfMetods.getTableOfType(tableTypeId); tInfo.Sort(new DinoComparer()); if (tInfo.Count > 0) { for (int i = 0; tInfo.Count > i; i++) { if (tInfo[i].nameMap.ToLower().IndexOf(textBox1.Text.ToLower()) > -1) { itemObj item = new itemObj(tInfo[i].idTable, tInfo[i].nameMap, tInfo[i].nameDB); listBox1.Items.Add(item); } } } listBox1_SelectedIndexChanged(listBox1, null); } label1.Text = changeTextOfCount(listBox1.Items.Count); }
public List <itemObj> GetGroupsWithTable(int id, bool with) { List <itemObj> list_of_tables = new List <itemObj>(); SqlWork sqlCmd = new SqlWork(); if (with) { sqlCmd.sql = "SELECT * FROM " + Program.scheme + ".get_group_list_for_table(" + id.ToString() + ")"; } else { sqlCmd.sql = "SELECT * FROM " + Program.scheme + ".get_group_list_no_for_table(" + id.ToString() + ")"; } try { sqlCmd.Execute(false); } catch (Exception ex) { MessageBox.Show(ex.Message); sqlCmd.Close(); return(null); } while (sqlCmd.CanRead()) { int id_table = sqlCmd.GetInt32(0); string name_group = sqlCmd.GetString(1); string descript = sqlCmd.GetString(2); itemObj io = new itemObj(id_table, name_group, descript); list_of_tables.Add(io); } sqlCmd.Close(); return(list_of_tables); }
private void comboBox9_SelectedIndexChanged(object sender, EventArgs e) { if (comboBox9.SelectedItem != null) { comboBox10.Items.Clear(); SqlWork sqlCmd = new SqlWork(); sqlCmd.sql = "SELECT id, name_db, name_map FROM " + Program.scheme + ".table_field_info WHERE (type_field = 1 OR type_field = 6) AND id_table = " + ((itemObj)comboBox9.SelectedItem).Id_o.ToString(); sqlCmd.Execute(false); while (sqlCmd.CanRead()) { itemObj item = new itemObj(sqlCmd.GetInt32(0), sqlCmd.GetValue <string>(1), sqlCmd.GetValue <string>(2)); comboBox10.Items.Add(item); } sqlCmd.Close(); comboBox11.Items.Clear(); sqlCmd = new SqlWork(); sqlCmd.sql = "SELECT id, name_db, name_map FROM " + Program.scheme + ".table_field_info WHERE type_field = 2 AND id_table = " + ((itemObj)comboBox9.SelectedItem).Id_o.ToString(); sqlCmd.Execute(false); while (sqlCmd.CanRead()) { itemObj item = new itemObj(sqlCmd.GetInt32(0), sqlCmd.GetValue <string>(1), sqlCmd.GetValue <string>(2)); comboBox11.Items.Add(item); } sqlCmd.Close(); } }
public itemObj GetGroup(int id_gr) { itemObj group = null; SqlWork sqlCmd = new SqlWork(); sqlCmd.sql = "SELECT name_group,descript FROM " + Program.scheme + ".table_groups WHERE id=" + id_gr.ToString(); try { sqlCmd.Execute(false); } catch (Exception ex) { MessageBox.Show(ex.Message); sqlCmd.Close(); return(null); } if (sqlCmd.CanRead()) { string name_gr = sqlCmd.GetString(0); string desc_gr = sqlCmd.GetString(1); group = new itemObj(id_gr, name_gr, desc_gr);//использую уже готовую структуру, вместо Layer там будет храниться описание } sqlCmd.Close(); return(group); }
private void cbRefTable_SelectedIndexChanged(object sender, EventArgs e) { if (cbRefTable.SelectedItem != null) { cbRefLink.Items.Clear(); cbRefFieldName.Items.Clear(); cbFileNameColumn.Items.Clear(); using (SqlWork sqlCmd = new SqlWork()) { sqlCmd.sql = "SELECT id, name_db, name_map, type_field FROM " + Program.scheme + ".table_field_info WHERE id_table = " + ((itemObj)cbRefTable.SelectedItem).Id_o.ToString(); sqlCmd.Execute(false); while (sqlCmd.CanRead()) { int type_field = sqlCmd.GetInt32("type_field"); itemObj item = new itemObj(sqlCmd.GetInt32(0), sqlCmd.GetValue <string>(1), sqlCmd.GetValue <string>(2)); if (type_field == 1 || type_field == 6) { cbRefLink.Items.Add(item); } else if (type_field == 2) { cbRefFieldName.Items.Add(item); cbFileNameColumn.Items.Add(item); } } } } }
private void loadTableStyleField() { cbRefStyleField.Items.Clear(); cbIntervalStyleField.Items.Clear(); cbAngleColumn.Items.Clear(); cbAngleColumn.Items.Add(new itemObj(-1, "<Не указано>", null)); cbAngleColumn.SelectedIndex = 0; SqlWork sqlCmd = new SqlWork(); sqlCmd.sql = String.Format(@"SELECT tfi.id, tfi.name_db, tfi.name_map FROM sys_scheme.table_field_info tfi INNER JOIN sys_scheme.table_info ti ON ti.id = tfi.id_table WHERE (tfi.type_field = 1 OR tfi.type_field = 6) AND tfi.id_table = {0} AND tfi.name_db <> ti.pk_fileld", id); sqlCmd.Execute(false); while (sqlCmd.CanRead()) { itemObj item = new itemObj(sqlCmd.GetInt32(0), sqlCmd.GetValue <string>(1), sqlCmd.GetValue <string>(2)); cbRefStyleField.Items.Add(item); cbIntervalStyleField.Items.Add(item); cbAngleColumn.Items.Add(item); } sqlCmd.Close(); }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { if (comboBox1.SelectedItem != null) { panel1.Visible = true; listBox1.Items.Clear(); listt = gf.GetListTablesInOrOutGroup((comboBox1.SelectedItem as itemObj).Id_o, true); itemObjOrdered[] it = new itemObjOrdered[listt.Count]; listt.CopyTo(it); listBox1.Items.AddRange(it); listBox2.Items.Clear(); List <itemObjOrdered> listt2 = gf.GetListTablesInOrOutGroup((comboBox1.SelectedItem as itemObj).Id_o, false); itemObjOrdered[] it2 = new itemObjOrdered[listt2.Count]; listt2.CopyTo(it2); listBox2.Items.AddRange(it2); itemObj gr = gf.GetGroup((comboBox1.SelectedItem as itemObj).Id_o); textBox2.Text = gr.Layer; label6.Text = changeTextOfCount(listBox1.Items.Count); label7.Text = changeTextOfCount(listBox2.Items.Count); } else { panel1.Visible = false; } }
private void loadTables() { cbRefTable.Items.Clear(); cbIntervalTable.Items.Clear(); SqlWork sqlCmd = new SqlWork(); sqlCmd.sql = "SELECT id, name_db, name_map, type FROM " + Program.scheme + ".table_info ti WHERE map_style = true ORDER BY name_db"; sqlCmd.Execute(false); int max_width_1 = 0, max_width_2 = 0; while (sqlCmd.CanRead()) { itemObj item = new itemObj(sqlCmd.GetInt32(0), String.Format("{0} ({1})", sqlCmd.GetValue <string>(1), sqlCmd.GetValue <string>(2)), sqlCmd.GetValue <string>(1)); Label tempLabel = new Label(); switch (sqlCmd.GetInt32(3)) { case 2: cbRefTable.Items.Add(item); tempLabel.Text = item.Name_o; if (tempLabel.PreferredWidth > max_width_1) { max_width_1 = tempLabel.PreferredWidth; } break; case 3: cbIntervalTable.Items.Add(item); tempLabel.Text = item.Name_o; if (tempLabel.PreferredWidth > max_width_2) { max_width_2 = tempLabel.PreferredWidth; } break; default: break; } } if (max_width_1 > cbRefTable.DropDownWidth) { cbRefTable.DropDownWidth = max_width_1; } if (max_width_2 > cbIntervalTable.DropDownWidth) { cbIntervalTable.DropDownWidth = max_width_2; } sqlCmd.Close(); }
private void loadTableTypes() { cbTableType.Items.Clear(); if (Program.tip_table.Count > 0) { for (int i = 0; Program.tip_table.Count > i; i++) { itemObj item = new itemObj(Program.tip_table[i].idTipTable, Program.tip_table[i].nameTip, Program.tip_table[i].mapLayer.ToString()); cbTableType.Items.Add(item); } } }
private void loadColumsForDiapazon(int id_table) { cbRangeValueField.Items.Clear(); SqlWork sqlCmd = new SqlWork(); sqlCmd.sql = "SELECT id, name_db, name_map FROM " + Program.scheme + ".table_field_info WHERE (type_field = 1 OR type_field = 6) AND id_table = " + id_table.ToString(); sqlCmd.Execute(false); while (sqlCmd.CanRead()) { itemObj item = new itemObj(sqlCmd.GetInt32(0), sqlCmd.GetValue <string>(2), sqlCmd.GetValue <string>(1)); cbRangeValueField.Items.Add(item); } sqlCmd.Close(); }
private void loadTableGeomField() { cbGeomField.Items.Clear(); SqlWork sqlCmd = new SqlWork(); sqlCmd.sql = "SELECT id, name_db, name_map FROM " + Program.scheme + ".table_field_info WHERE type_field = 5 AND id_table = " + id.ToString(); sqlCmd.Execute(false); while (sqlCmd.CanRead()) { itemObj item = new itemObj(sqlCmd.GetInt32(0), sqlCmd.GetValue <string>(1), sqlCmd.GetValue <string>(2)); cbGeomField.Items.Add(item); } sqlCmd.Close(); }
private void reload() { listBox1.Items.Clear(); listt = gf.GetGroupsWithTable(id, true);//((comboBox1.SelectedItem as itemObj).Id_o, true); itemObj[] it = new itemObj[listt.Count]; listt.CopyTo(it); listBox1.Items.AddRange(it); listBox2.Items.Clear(); List <itemObj> listt2 = gf.GetGroupsWithTable(id, false); itemObj[] it2 = new itemObj[listt2.Count]; listt2.CopyTo(it2); listBox2.Items.AddRange(it2); label1.Text = changeTextOfCount(listBox1.Items.Count); label2.Text = changeTextOfCount(listBox2.Items.Count); }
private void loadTipField() { comboBox1.Items.Clear(); if (Program.tip_data.Count > 0) { for (int i = 0; Program.tip_data.Count > i; i++) { if (Program.tip_data[i].idTipData == 5 && !upd) { continue; // пользовательский атрибут типа геометрия создать невозможно } itemObj item = new itemObj(Program.tip_data[i].idTipData, Program.tip_data[i].nameTipData, Program.tip_data[i].nameTipDataDB); comboBox1.Items.Add(item); } } }
private void loadTables() { comboBox1.Items.Clear(); comboBox4.Items.Clear(); comboBox9.Items.Clear(); SqlWork sqlCmd = new SqlWork(); sqlCmd.sql = "SELECT id, name_db, name_map FROM " + Program.scheme + ".table_info WHERE type = 2"; sqlCmd.Execute(false); while (sqlCmd.CanRead()) { itemObj item = new itemObj(sqlCmd.GetInt32(0), sqlCmd.GetValue <string>(2) + " (" + sqlCmd.GetValue <string>(1) + ")", sqlCmd.GetValue <string>(1)); comboBox1.Items.Add(item); } sqlCmd.Close(); sqlCmd = new SqlWork(); sqlCmd.sql = "SELECT id, name_db, name_map FROM " + Program.scheme + ".table_info WHERE type = 3"; sqlCmd.Execute(false); while (sqlCmd.CanRead()) { itemObj item = new itemObj(sqlCmd.GetInt32(0), sqlCmd.GetValue <string>(2) + " (" + sqlCmd.GetValue <string>(1) + ")", sqlCmd.GetValue <string>(1)); comboBox4.Items.Add(item); } sqlCmd.Close(); sqlCmd = new SqlWork(); sqlCmd.sql = "SELECT id, name_db, name_map FROM " + Program.scheme + ".table_info WHERE type = 1 OR type=4"; sqlCmd.Execute(false); while (sqlCmd.CanRead()) { itemObj item = new itemObj(sqlCmd.GetInt32(0), sqlCmd.GetValue <string>(2) + " (" + sqlCmd.GetValue <string>(1) + ")", sqlCmd.GetValue <string>(1)); comboBox9.Items.Add(item); } sqlCmd.Close(); }