Exemplo n.º 1
0
        private void removeSpecifier()
        {
            if (specifiers.Count == 0)
            {
                return;
            }

            SingleTableSpecifierPanel panel = specifiers[specifiers.Count - 1];

            OracleTableViewForm form = oracleForms
                                       .Where(x => x.Name == string.Concat("oracleForm", panel.SpecifierId))
                                       .FirstOrDefault();

            if (form != null && form.Visible)
            {
                form.Hide();
            }

            ComboBox cb = panel.Controls.Cast <Control>()
                          .Where(y => y is ComboBox)
                          .First() as ComboBox;

            this.Controls.Remove(panel);
            specifiers.Remove(panel);
            comboBoxes.Remove(cb);

            updateControls(oracleHandler.IsConnectionUp());
        }
Exemplo n.º 2
0
        private void displayControl(SingleTableSpecifierPanel panel)
        {
            if (string.IsNullOrWhiteSpace(panel.TableName))             //not found
            {
                return;
            }
            OracleTableViewForm form = oracleForms
                                       .Where(x => x.Name == string.Concat("oracleForm", panel.SpecifierId))
                                       .FirstOrDefault();

            if (!panel.ViewChecked)
            {
                if (form != null)                 //while unchecked, only needs to do something when it is found
                {
                    form.Hide();
                }
                return;
            }

            if (form == null)               //form does not exist, create a new form
            {
                form      = new OracleTableViewForm();
                form.Name = string.Concat("oracleForm", panel.SpecifierId);
                form.SetOracleHandler(oracleHandler);
                form.FormClosing += form_FormClosing;
                oracleForms.Add(form);
            }
            form.Text = string.Concat(form.OriginalTitle, " [", panel.SpecifierId, "] ", panel.TableName);
            form.DisplayTableResult(panel.TableName, panel.ColumnsClause, panel.WhereClause, panel.MaxRows, panel.IndexAdded);
            form.Show();
        }
Exemplo n.º 3
0
        void comboBox_SelectedIndexChanged(object sender, EventArgs e)           //The only thing which would cause the include and exclude to be reset
        {
            SingleTableSpecifierPanel panel = (sender as Control).Parent as SingleTableSpecifierPanel;

            panel.ResetColumns();
            panelControlDisplayHandler(sender as Control);
        }
Exemplo n.º 4
0
        private void addSpecifier()
        {
            int tableNo = specifiers.Count;

            SingleTableSpecifierPanel panel = new SingleTableSpecifierPanel();

            panel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            panel.IndexAdded  = false;
            panel.Location    = new System.Drawing.Point(0, 36 + tableNo * 34);
            panel.MaxRows     = 200;
            panel.Name        = string.Concat("singleTableSpecifierPanel", tableNo);
            panel.Size        = new System.Drawing.Size(819, 35);
            panel.SpecifierId = specifiers.Count + 1;
            panel.TabIndex    = 34;
            panel.ViewChecked = false;
            panel.WhereClause = "";
            specifiers.Add(panel);

            ComboBox cb = panel.Controls.Cast <Control>()
                          .Where(y => y is ComboBox)
                          .First() as ComboBox;

            cb.SelectedIndexChanged += comboBox_SelectedIndexChanged;
            if (sources != null && sources.Count > 0)
            {
                cb.Items.AddRange(sources.ToArray());
                cb.SelectedIndex = 0;
            }
            comboBoxes.Add(cb);

            CheckBox chbView = panel.Controls.Cast <Control>()
                               .Where(y => y is CheckBox && y.Name.StartsWith("checkBoxView"))
                               .First() as CheckBox;

            chbView.CheckedChanged += checkBox_CheckedChanged;

            CheckBox chbAddIndex = panel.Controls.Cast <Control>()
                                   .Where(y => y is CheckBox && y.Name.StartsWith("checkBoxAddIndex"))
                                   .First() as CheckBox;

            chbAddIndex.CheckedChanged += checkBox_CheckedChanged;

            LinkLabel llRefresh = panel.Controls.Cast <Control>()
                                  .Where(y => y is LinkLabel && y.Name.StartsWith("linkLabelRefresh"))
                                  .First() as LinkLabel;

            llRefresh.LinkClicked += linkLabelRefresh_LinkClicked;

            LinkLabel llFrom = panel.Controls.Cast <Control>()
                               .Where(y => y is LinkLabel && y.Name.StartsWith("linkLabelFrom"))
                               .First() as LinkLabel;

            llFrom.LinkClicked += linkLabelFrom_LinkClicked;

            this.Controls.Add(panel);

            updateControls(oracleHandler.IsConnectionUp());
        }
Exemplo n.º 5
0
        void form_FormClosing(object sender, FormClosingEventArgs e)
        {
            Form form = sender as Form;

            form.Hide();
            e.Cancel = true;
            string numstr = form.Name.Replace("oracleForm", string.Empty);
            SingleTableSpecifierPanel panel = specifiers[Convert.ToInt32(numstr) - 1];

            panel.ViewChecked = false;
        }
Exemplo n.º 6
0
        void linkLabelFrom_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            SingleTableSpecifierPanel panel = (sender as Control).Parent as SingleTableSpecifierPanel;

            if (panel.IncludeCount <= 0)             //no item in the include, put everything!
            {
                panel.SetColumns(oracleHandler.GetAllColumnNames(panel.TableName), null);
            }
            OracleFromForm form = new OracleFromForm(panel.IncludeColumns, panel.ExcludeColumns, string.Concat(" [", panel.SpecifierId, "] ", panel.TableName));

            if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)     //Do something
            {
                panel.SetColumns(form.IncludedColumns, form.ExcludedColumns);  //record the new included and excluded
                panelControlDisplayHandler(sender as Control);                 //update the display control (if there is any)
            }
        }