Esempio n. 1
0
 private void GenerateRowCode()
 {
     if (this.ConnectionsCombo.SelectedItem != null &&
         this.TablesCombo.SelectedItem != null &&
         !EntitySingular.IsTrimmedEmpty())
     {
         string table       = (string)this.TablesCombo.SelectedItem;
         string tableSchema = null;
         if (table.IndexOf('.') > 0)
         {
             tableSchema = table.Substring(0, table.IndexOf('.'));
             table       = table.Substring(table.IndexOf('.') + 1);
         }
         try
         {
             var conn = (GeneratorConfig.Connection) this.ConnectionsCombo.SelectedItem;
             using (var connection = SqlConnections.New(conn.ConnectionString, conn.ProviderName))
             {
                 connection.Open();
                 this.GeneratedCode.Text = RowGenerator.Generate(connection, tableSchema, table,
                                                                 Module, ConnectionKey, EntitySingular, Permission, config);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
     }
 }
Esempio n. 2
0
 private void GenerateRowCode()
 {
     if (this.ConnectionsCombo.SelectedItem != null &&
         this.TablesCombo.SelectedItem != null &&
         !EntitySingular.IsTrimmedEmpty())
     {
         string table       = (string)this.TablesCombo.SelectedItem;
         string tableSchema = null;
         if (table.IndexOf('.') > 0)
         {
             tableSchema = table.Substring(0, table.IndexOf('.'));
             table       = table.Substring(table.IndexOf('.') + 1);
         }
         try
         {
             using (var connection = CreateConnection((string)this.ConnectionsCombo.SelectedItem))
             {
                 connection.Open();
                 this.GeneratedCode.Text = RowGenerator.Generate(connection, tableSchema, table,
                                                                 Module, Schema, EntitySingular, Permission);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
     }
 }