Exemplo n.º 1
0
        private void toolStripMenuItemTableCreate_Click(object sender, EventArgs e)
        {
            List <string> tables = new List <string>();

            foreach (var item in listBoxTables.Items)
            {
                tables.Add(item.ToString());
            }
            var dialog = new FormTableName(string.Empty, tables);

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                XElement previousElement = _document.GetElementToAddAfterSelf("CustomTable");
                XElement newElement      = new XElement(ns + "CustomTable", new XAttribute("Id", dialog.TableName),
                                                        new XElement(ns + "Column",
                                                                     new XAttribute("Id", "Id"),
                                                                     new XAttribute("Category", "Identifier"),
                                                                     new XAttribute("PrimaryKey", "yes"),
                                                                     new XAttribute("Nullable", "no"),
                                                                     new XAttribute("Type", "string"),
                                                                     new XAttribute("Width", "72")));

                if (previousElement == null)
                {
                    _document.GetProductModuleOrFragmentElement().AddFirst(newElement);
                }
                else
                {
                    previousElement.AddAfterSelf(newElement);
                }
                LoadData();
            }
        }
Exemplo n.º 2
0
        private void toolStripMenuItemRenameTable_Click(object sender, EventArgs e)
        {
            List <string> tables = new List <string>();

            foreach (var item in listBoxTables.Items)
            {
                tables.Add(item.ToString());
            }
            var dialog = new FormTableName(listBoxTables.Text, tables);

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                _customTableElement.Attribute("Id").Value = dialog.TableName;
                LoadData();
            }
        }