예제 #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            List <itemObjOrdered> listt2 = new List <itemObjOrdered>(listt);

            gf.SaveGroup((comboBox1.SelectedItem as itemObj).Id_o, (comboBox1.SelectedItem as itemObj).Name_o, textBox2.Text);
            foreach (itemObjOrdered it in listt)
            {
                bool del = true;
                foreach (itemObjOrdered it2 in listBox1.Items)
                {
                    if (it.Id_o == it2.Id_o)
                    {
                        del = false;
                        break;
                    }
                }
                if (del)
                {
                    gf.DeleteTableFromGroup((comboBox1.SelectedItem as itemObj).Id_o, it.Id_o);
                }
            }

            foreach (itemObjOrdered it in listBox1.Items)
            {
                bool add = true;
                foreach (itemObjOrdered it2 in listt)
                {
                    if (it.Id_o == it2.Id_o)
                    {
                        add = false;
                        break;
                    }
                }
                if (add)
                {
                    gf.MoveTableToGroup((comboBox1.SelectedItem as itemObj).Id_o, it.Id_o);
                }
            }
            for (int i = 0; i < listBox1.Items.Count; i++)
            {
                if ((listBox1.Items[i] as itemObjOrdered).order != i)
                {
                    (listBox1.Items[i] as itemObjOrdered).order = i;
                    gf.SetOrderTableInGroup((comboBox1.SelectedItem as itemObj).Id_o, (listBox1.Items[i] as itemObjOrdered).Id_o, (listBox1.Items[i] as itemObjOrdered).order);
                }
            }
            comboBox1_SelectedIndexChanged(this, null);

            var cls = new classesOfMetods();

            Program.tablegroups_info = cls.loadTablesGroupsInfo();
            Program.mainFrm1.layerItemsView1.RefreshLayers();
        }
예제 #2
0
        public void CloseAddEditGroup(AddEditGroup aeg)
        {
            if (aeg.SaveOk)
            {
                if (aeg.GroupId < 0)
                {
                    _groupFunct.AddNewGroup(aeg.GroupName, aeg.GroupDescription);
                    reloadGroups();
                }
                else
                {
                    _groupFunct.SaveGroup(aeg.GroupId, aeg.GroupName, aeg.GroupDescription);
                    reloadGroups();
                }
            }

            this.Controls.Remove(aeg);
            groupBox1.Enabled = true;
            aeg.Dispose();
        }