private void button1_Click(object sender, EventArgs e)
        {
            parent.CloseElemsAfter(this, false);
            AddEditAtributs aea = new AddEditAtributs(false, 0, id, parent, this);

            parent.AddNewElemModal(aea, Rekod.Properties.Resources.FELC_CreatingFields);
        }
        public propertyTableControl(int id1, DBTablesGroups par, TableEdit table_edit_frm)
        {
            InitializeComponent();
            id         = id1;
            geom       = getGeomTable(id);
            parent     = par;
            table_edit = table_edit_frm;
            if (!geom)
            {
                MessageBox.Show(Rekod.Properties.Resources.PTC_TableIsNotLayer);
                parent.CloseElemsAfter(this, true);
            }

            cbRefType.SelectedIndex = 0;

            loadTableGeomField();
            loadTableStyleField();
            loadTables();
            loadInfo();
            loadDaipazonInfo(id);

            SetControlVisibility();

            if (!Rekod.DBTablesEdit.SyncController.HasRight(id))
            {
                button2.Enabled = false;
            }
        }
Пример #3
0
        private void btnCaptions_Click(object sender, EventArgs e)
        {
            LabelControl sc = new LabelControl(parent, table_edit.idT);

            parent.CloseElemsAfter(this, false);
            parent.AddNewElem(sc, Rekod.Properties.Resources.AWT_EditLabel);
        }
Пример #4
0
        private void groupsOrderButton_Click(object sender, EventArgs e)
        {
            parent.CloseElemsAfter(this, false);
            //AddEditGroup aeg = new AddEditGroup(-1, parent, this);
            EditGroupsOrder ego = new EditGroupsOrder(parent, this);

            parent.AddNewElemModal(ego, "");
        }
Пример #5
0
 protected override void OnClick(EventArgs e)
 {
     base.OnClick(e);
     if (controlForClose is ActionWithTables)
     {
         (controlForClose as ActionWithTables).table_edit.prev_selected = false;
         //(controlForClose as ActionWithTables).table_edit.act_tables = null;
     }
     form.CloseElemsAfter(controlForClose, true);
 }
Пример #6
0
        private void button3_Click(object sender, EventArgs e)
        {
            List <itemObj> listt2 = new List <itemObj>(listt);

            foreach (itemObj it in listt)
            {
                bool del = true;
                foreach (itemObj it2 in listBox1.Items)
                {
                    if (it.Id_o == it2.Id_o)
                    {
                        del = false;
                        break;
                    }
                }
                if (del)
                {
                    gf.DeleteTableFromGroup(it.Id_o, id);
                }
            }

            foreach (itemObj it in listBox1.Items)
            {
                bool add = true;
                foreach (itemObj it2 in listt)
                {
                    if (it.Id_o == it2.Id_o)
                    {
                        add = false;
                        break;
                    }
                }
                if (add)
                {
                    gf.MoveTableToGroup(it.Id_o, id);
                }
            }
            if (parent != null)
            {
                parent.CloseElemsAfter(this, true);
            }
        }
Пример #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (cbTableType.SelectedItem != null)
            {
                type = ((itemObj)cbTableType.SelectedItem).Id_o;
            }
            else
            {
                type = 1;
            }

            /*EditTable frm = new EditTable(conn, false, 0, type); // Varyag
             * frm.Text = "Создание таблицы";
             * frm.ShowDialog();*/
            prev_selected = false;
            parent.CloseElemsAfter(this, false);
            AddEditTable aet = new AddEditTable(false, 0, type, parent, this);

            parent.AddNewElem(aet, Rekod.Properties.Resources.AET_CreatingTable);
        }
        private void button2_Click(object sender, EventArgs e)
        {
            if (cbGeomField.SelectedItem != null)
            {
                //if (radioButton1.Checked)
                if (cbStyleType.SelectedIndex == 0)
                { // одинаково для всех
                    String sql = String.Format(@"
UPDATE {0}.table_field_info SET is_style = false WHERE id_table = {1};
UPDATE {0}.table_info SET geom_field = '{2}', default_style = true, range_colors=false WHERE id = {1};",
                                               Program.scheme, id, cbGeomField.Text);

                    using (SqlWork sqlCmd = new SqlWork())
                    {
                        sqlCmd.sql = sql;
                        sqlCmd.Execute(true);
                    }

                    setStyleSetting(1);
                    classesOfMetods.reloadLayer(id);
                    parent.CloseElemsAfter(this, true);
                }
                //if (radioButton2.Checked)
                if (cbStyleType.SelectedIndex == 1)
                { // по справочнику
                    if (cbRefStyleField.SelectedItem != null &&
                        cbRefTable.SelectedItem != null &&
                        cbRefLink.SelectedItem != null &&
                        cbRefFieldName.SelectedItem != null)
                    {
                        String sql = String.Format(@"
UPDATE {0}.table_field_info SET is_style = false WHERE id_table = {1};
UPDATE {0}.table_info SET geom_field = '{2}', default_style = false, style_field = '{3}' WHERE id = {1};",
                                                   Program.scheme, id, cbGeomField.Text, cbRefStyleField.Text);

                        if (cbStyleType.SelectedIndex == 1 &&
                            cbRefType.SelectedIndex == 1)
                        {
                            if (cbFileNameColumn.SelectedItem != null)
                            {
                                sql += String.Format(@"UPDATE {0}.table_info SET image_column='{2}' , angle_column='{3}' WHERE id = {1};",
                                                     Program.scheme, id, cbFileNameColumn.Text, cbAngleColumn.SelectedIndex == 0 ? "" : cbAngleColumn.Text);
                            }
                            else
                            {
                                MessageBox.Show(Rekod.Properties.Resources.PFC_AllFieldsFill);
                                return;
                            }
                        }

                        using (SqlWork sqlCmd = new SqlWork())
                        {
                            sqlCmd.sql = sql;
                            sqlCmd.Execute(true);
                        }

                        setStyleSetting(2);
                        classesOfMetods.reloadLayer(id);
                        parent.CloseElemsAfter(this, true);
                    }
                    else
                    {
                        MessageBox.Show(Rekod.Properties.Resources.PFC_AllFieldsFill);
                        return;
                    }
                }
                if (cbStyleType.SelectedIndex == 2)
                //if (radioButton3.Checked)
                { // по интервалу
                    if (cbIntervalStyleField.SelectedItem != null &&
                        cbIntervalTable.SelectedItem != null &&
                        cbIntervalStart.SelectedItem != null &&
                        cbIntervalEnd.SelectedItem != null &&
                        cbIntervalName.SelectedItem != null)
                    {
                        String sql = String.Format(@"
UPDATE {0}.table_field_info SET is_style = false WHERE id_table = {1};
UPDATE {0}.table_info SET geom_field = '{2}', default_style = false, style_field = '{3}' WHERE id = {1};",
                                                   Program.scheme, id, cbGeomField.Text, cbIntervalStyleField.Text);

                        using (SqlWork sqlCmd = new SqlWork())
                        {
                            sqlCmd.sql = sql;
                            sqlCmd.Execute(true);
                        }

                        setStyleSetting(3);
                        classesOfMetods.reloadLayer(id);
                        parent.CloseElemsAfter(this, true);
                    }
                    else
                    {
                        MessageBox.Show(Rekod.Properties.Resources.PFC_AllFieldsFill);
                        return;
                    }
                }
                if (cbStyleType.SelectedIndex == 3)
                { // по диапазону
                    if (cbRangeValueField.SelectedItem != null &&
                        cbRangeColorChange.SelectedItem != null)
                    {
                        if (numericUpDownRangeMinValue.Value > numericUpDownRangeMaxValue.Value && checkBoxRangeMin.Checked && checkBoxRangeMax.Checked)
                        {
                            MessageBox.Show(Rekod.Properties.Resources.PTC_ErrorMaxMin,
                                            Rekod.Properties.Resources.DGBH_ErrorHeader, MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }

                        String sql = String.Format(@"
UPDATE {0}.table_field_info SET is_style = false WHERE id_table = {1};
UPDATE {0}.table_info SET geom_field = '{2}', default_style = true, range_colors=true WHERE id = {1};",
                                                   Program.scheme, id, cbGeomField.Text);

                        using (SqlWork sqlCmd = new SqlWork())
                        {
                            sqlCmd.sql = sql;
                            sqlCmd.Execute(true);
                        }

                        setStyleSetting(4);
                        classesOfMetods.reloadLayer(id);
                        //MessageBox.Show("Операция прошла успешно!");
                        parent.CloseElemsAfter(this, true);
                        //Close();
                    }
                    else
                    {
                        MessageBox.Show(Rekod.Properties.Resources.PFC_AllFieldsFill);
                        return;
                    }
                }
            }
            else
            {
                MessageBox.Show(Rekod.Properties.Resources.PTC_ErrorNotSelectGeom);
                return;
            }

            DBTablesEdit.SyncController.ReloadStyle(id);

            Program.mainFrm1.axMapLIb1.mapRepaint();
        }