Exemplo n.º 1
0
        private void FilterTableList_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (previousFilter != null)
                previousFilter.filter = FilterClauseText.Text;

            previousFilter = (TableFilter)FilterTableList.SelectedItem;

            if (previousFilter == null)
            {
                FilterClauseText.Text = "";
                FilterClauseText.Enabled = false;
            }
            else
            {
                FilterClauseText.Text = previousFilter.filter;
                FilterClauseText.Enabled = true;
            }
        }
Exemplo n.º 2
0
        //, Dictionary<string,TableSelect> dictionary)
        private void TableSelectionsEdit(CheckedListBox listBox, bool filterList)
        {
            TableSelectForm form = dbDeployForm.tableSelectForm;
            ListBox list = form.TableList;

            form.TablesLoad(meta);

            int index;

            foreach (TableSelect select in listBox.Items)
            {
                index = list.Items.IndexOf(select.name);
                if (index >= 0)
                {
                    list.SelectedItems.Add(select.name);
                }
                else
                {
                    //TODO: Issue an error that table no longer exists and will be immediately deleted (peform deletion here)
                }
            }

            if (dbDeployForm.tableSelectForm.ShowDialog() == DialogResult.OK)
            {
                bool found;

                foreach (string name in list.SelectedItems)
                {
                    found = false;
                    foreach (TableSelect select in listBox.Items)
                    {
                        if (name == select.name)
                        {
                            found = true;
                            break;
                        }
                    }

                    if (!found)
                    {
                        TableSelect select;
                        if (filterList)
                            select = new TableFilter(true, name, "");
                        else
                            select = new TableSelect(true, name);
                        listBox.Items.Add(select);
                        listBox.SetItemChecked(listBox.Items.IndexOf(select), true);
                    }
                }

                index = 0;
                while (index < listBox.Items.Count)
                {
                    if (list.SelectedItems.Contains(((TableSelect)(listBox.Items[index])).name))
                    {
                        index++;
                    }
                    else
                    {
                        listBox.Items.RemoveAt(index);
                    }
                }

                foreach (TableSelect select in listBox.Items)
                {
                    if (!list.SelectedItems.Contains(select.name))
                    {
                        listBox.Items.Remove(select);
                    }
                }

            }
        }