private void btnSaveXML_Click(object sender, EventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();

            if (metadataReader == null)
            {
                MessageBox.Show("Connect to db first!");
            }
            else
            {
                var _tables = metadataReader.GetTables(ownersComboBox.SelectedItem.ToString());
                if (_tables.Count < 1)
                {
                    MessageBox.Show("Connect to table first!");
                    return;
                }
                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    foreach (var item in _tables)
                    {
                        var gridData = metadataReader.GetTableDetails(item, ownersComboBox.SelectedItem.ToString()) ??
                                       new List <Column>();
                        item.Columns = gridData;
                    }

                    AllTables at = new AllTables();
                    at.DataBaseName = _currentConnection.Name;
                    at.Tables       = _tables;
                    at.Save(sfd.FileName);
                }
            }
        }
Exemple #2
0
        private void PopulateTablesAndSequences()
        {
            errorLabel.Text = string.Empty;
            tablesListBox.DataBindings.Clear();
            try
            {
                if (ownersComboBox.SelectedItem == null)
                {
                    return;
                }
                var tables = metadataReader.GetTables(ownersComboBox.SelectedItem.ToString());
                tablesListBox.Enabled = false;
                tablesListBox.Items.Clear();
                if (tables != null && tables.Any())
                {
                    tablesListBox.Items.AddRange(tables.ToArray());
                    tablesListBox.Enabled       = true;
                    tablesListBox.SelectedIndex = 0;
                }

                var sequences = metadataReader.GetSequences(ownersComboBox.SelectedItem.ToString());
                sequencesComboBox.Enabled = false;
                sequencesComboBox.Items.Clear();
                if (sequences != null && sequences.Any())
                {
                    sequencesComboBox.Items.AddRange(sequences.ToArray());
                    sequencesComboBox.Enabled       = true;
                    sequencesComboBox.SelectedIndex = 0;
                }
            }
            catch (Exception ex)
            {
                errorLabel.Text = ex.Message;
            }
        }
Exemple #3
0
        private void generateMapclass()
        {
            var    Mapclasssettings = new Connection();
            string mapTempPath      = Path.GetTempPath();

            if (mapTempPath.EndsWith(@"\") == false)
            {
                mapTempPath += @"\";
            }
            mapTempPath += @"Mapping\";
            if (Directory.Exists(mapTempPath) == false)
            {
                Directory.CreateDirectory(mapTempPath);
            }
            Mapclasssettings.Domainfolderpath = mapTempPath;

            Mapclasssettings.EntityName = "Entity";
            if ((RecoEngine_BI.Common.iDBType) == (int)Enums.DBType.Oracle)
            {
                Mapclasssettings.ConnectionString = ConfigurationManager.AppSettings["ConnectionString"];
                Mapclasssettings.Type             = ServerType.Oracle;
            }
            else if ((RecoEngine_BI.Common.iDBType) == (int)Enums.DBType.Mysql)
            {
                Mapclasssettings.ConnectionString = ConfigurationManager.AppSettings["MysqlConnectionString"];
                Mapclasssettings.Type             = ServerType.Mysql;
            }

            //  metadataReader = MetadataFactory.GetReader(Mapclasssettings.Type, Mapclasssettings.ConnectionString);
            var           owners     = metadataReader.GetOwners();
            IList <Table> tblList    = metadataReader.GetTables("RECOUSR");
            int           tableindex = 0;

            for (int i = 0; i < tblList.Count; i++)
            {
                if (tblList[i].Name == "OPPORTUNITY")
                {
                    tableindex = i;
                    break;
                }
            }
            Table table = tblList[tableindex];

            table.PrimaryKey = metadataReader.DeterminePrimaryKeys(table);
            metadataReader.GetTableDetails(table, "RECOUSR");
            var applicationPreferences = GetApplicationPreferences(table, false, Mapclasssettings);

            new ApplicationController(applicationPreferences, table).Generate();
        }
Exemple #4
0
        private void PopulateTablesAndSequences()
        {
            try
            {
                toolStripStatusLabel1.Text = "Retrieving tables...";
                statusStrip1.Refresh();

                if (ownersComboBox.SelectedItem == null)
                {
                    tablesListBox.DataSource = new List <Table>();
                    return;
                }
                _tables = metadataReader.GetTables(ownersComboBox.SelectedItem.ToString());
                tablesListBox.Enabled       = false;
                TableFilterTextBox.Enabled  = false;
                tablesListBox.DataSource    = _tables;
                tablesListBox.DisplayMember = "Name";

                if (_tables != null && _tables.Any())
                {
                    tablesListBox.Enabled      = true;
                    TableFilterTextBox.Enabled = true;
                    tablesListBox.SelectedItem = _tables.FirstOrDefault();
                }

                var sequences = metadataReader.GetSequences(ownersComboBox.SelectedItem.ToString());
                sequencesComboBox.Enabled = false;
                sequencesComboBox.Items.Clear();
                if (sequences != null && sequences.Any())
                {
                    sequencesComboBox.Items.Add(""); // No sequence
                    sequencesComboBox.Items.AddRange(sequences.ToArray());
                    sequencesComboBox.Enabled       = true;
                    sequencesComboBox.SelectedIndex = 0;
                }

                toolStripStatusLabel1.Text = string.Empty;
                statusStrip1.Refresh();
            }
            catch (Exception ex)
            {
                toolStripStatusLabel1.Text = ex.Message;
            }
        }