public EditDBConnectionForm(DBConfig dbconfig)
 {
     this.dbconfig = dbconfig;
     InitializeComponent();
     getLocalizedLabelsMessages();
     getDefaultValues();
 }
 public AddDBForm(DBConfig dbconfig)
 {
     this.dbconfig = dbconfig;
     dbHelper = new DatabaseHelper(dbconfig);
     InitializeComponent();
     getDefaultValues();
     getLocalizedLabelsMessages();
 }
 public ChangeTablesForm(List<Table> tables, DBConfig dbconfig)
 {
     this.Tables = tables;
     this.dbconfig = dbconfig;
     this.dbHelper = new DatabaseHelper(dbconfig);
     InitializeComponent();
     getLocalizedLabelsMessages();
     getDefaultValues();
 }
 public DatabaseHelper(DBConfig dbconfig)
 {
     this.dbconfig = dbconfig;
     RowsInsert = new ConcurrentQueue<String>();
     this.msgInserting = "";
     this.dao = getDataBaseDAO();
     skip = true;
     databases.Add(mysql);
 }
        public ExecuteSQLForm(TableList tablesList, DBConfig dbconfig, Boolean isInserting)
        {
            this.isInserting = isInserting;
            this.dbconfig = dbconfig;
            this.tablesList = tablesList;
            this.dbHelper = new DatabaseHelper(dbconfig);
            InitializeComponent();

            getLocalizedLabelsMessages();
            getDefaultValues();
        }
 public ChangeColumnForm(List<Table> tables, DBConfig dbconfig)
 {
     this.TablesList = new TableList(tables);
     this.dbconfig = dbconfig;
     this.dbHelper = new DatabaseHelper(dbconfig);
     InitializeComponent();
     getLocalizedLabelsMessages();
     getDefaultValues();
     createTablesView();
     
 }
 public TableDescriptionForm(DBConfig dbconfig, String tableName)
 {
     InitializeComponent();
     this.txbLimit.DataBindings.Add("Text", this, "Limit");
     this.tableName = tableName;
     this.dbconfig = dbconfig;
     this.dbHelper = new DatabaseHelper(dbconfig);
     getLocalizedLabelsMessages();
     getDefaultValues();
     setFormSize();          
 }
 public Boolean isConnectionAvailableNoDB(DBConfig dbconfig)
 {
     return dao.isConnectionAvailable(dbconfig.getConnectionStringNoDB());
 }
 private Boolean validateStep()
 {
      switch (step)
      {
         case 1:
              if (this.txbDataFilePath.Text == null || "".Equals(this.txbDataFilePath.Text))
              {
                 showErrorInfoWindow(msgErrorNoDataFile);
                 return false;
              }                        
         break;
         case 2:
         if (this.cmbDB.SelectedItem != null && !"".Equals(this.cmbDB.SelectedItem.ToString()))
         {
             DBConfig dbconfig = new DBConfig();
             String db = this.cmbDB.SelectedItem.ToString();
             this.Template = this.Template == null ? new Template(null, new DBConfig()) : this.Template;
             this.Template.DBconfig = this.Template.DBconfig == null ? new DBConfig() : this.Template.DBconfig; 
             this.Template.DBconfig.Db = db;
             dbHelper = new DatabaseHelper(this.Template.DBconfig);
             updateCmbDBsItems(false);
         }
         else
             return false;
         break;
         case 3:
             
         break;
      }
     return true;
 }
        public Template getTemplateFile(String templateFilePath)
        {
            this.templateFilePath = templateFilePath;
            List<String> file = openFile(this.templateFilePath);
            DBConfig dbConfig = new DBConfig();
            TableList tablelist = new TableList(new List<Table>());
            Table table = null;
            foreach (String s in file)
            {
                if (!s.Equals(""))
                {
                    if ("//".Equals(s))
                        tablelist.Tables.Add(table);
                    else
                    {
                        String key = s.Split('=')[0];
                        String value = s.Split('=')[1];

                        if ("Db".Equals(key))
                            dbConfig.Db = value;
                        if ("Server".Equals(key))
                            dbConfig.Server = value;
                        if ("Port".Equals(key))
                            dbConfig.Port = value;
                        if ("User".Equals(key))
                            dbConfig.User = value;
                        if ("Password".Equals(key))
                            dbConfig.Password = value;
                        if("DbName".Equals(key))
                            dbConfig.DbName = value;

                        if ("Table".Equals(key))
                        {
                            table = new Table();
                            table.OriginalTableName = value.Split(':')[0];
                            table.TableName = value.Split(':')[1];
                            table.Columns = new List<Column>();
                        }
                        if ("Column".Equals(key))
                        {
                            String columnNames = value.Split(';')[0];
                            String sqlType = value.Split(';')[1];
                            String pk = value.Split(';')[2];
                            String fk = value.Split(';')[3];
                            String nullabe = value.Split(';')[4];
                            String unique = value.Split(';')[5];
                            String defValue = value.Split(';')[6];
                            String defValueOnError = value.Split(';')[7];
                            String referenceDB = value.Split(';')[8];
                            String referenceTableColum = value.Split(';')[9];
                            String skip = value.Split(';')[10];

                            Column column = new Column(columnNames.Split(':')[0]);
                            column.ColumnName = columnNames.Split(':')[1] == null || columnNames.Split(':')[1].Equals("") ? column.ColumnName : columnNames.Split(':')[1];
                            column.sqlType = sqlType.Split(':')[1] == null || sqlType.Split(':')[1].Equals("") ? column.sqlType : sqlType.Split(':')[1];
                            column.IsPK = pk.Split(':')[1] != null && pk.Split(':')[1].ToLower().Equals("true");
                            column.IsFK = fk.Split(':')[1] != null && fk.Split(':')[1].ToLower().Equals("true");
                            column.IsNullable = nullabe.Split(':')[1] != null && nullabe.Split(':')[1].ToLower().Equals("true");
                            column.IsUnique = unique.Split(':')[1] != null && unique.Split(':')[1].ToLower().Equals("true");
                            column.defaulValue = defValue.Split(':')[1] != null ? defValue.Split(':')[1] : "";
                            column.defaulValueOnError = defValueOnError.Split(':')[1] != null ? defValueOnError.Split(':')[1] : "";
                            column.SKIP = skip.Split(':')[1] != null && skip.Split(':')[1].ToLower().Equals("true");

                            if (column.IsFK)
                                column.Reference = new VO.KeyValue(referenceDB.Split(':')[1], referenceTableColum.Split(':')[1]);
                            table.Columns.Add(column);
                        }
                    }
                }
            }
            return new Template(tablelist, dbConfig);
        }
Beispiel #11
0
 public Template(TableList TableList, DBConfig DBconfig)
 {
     this.TableList = TableList;
     this.DBconfig = DBconfig;
 }