private void getDefaultValues()
        {
            this.Icon = Properties.Resources.icooddb;
            if (dbconfig != null && dbconfig.Db != null)
            {
                dbHelper = new DatabaseHelper(dbconfig);
                this.txbServer.Text = dbconfig.Server;
                this.txbPort.Text = dbconfig.Port;
                this.txbUser.Text = dbconfig.User;
                this.txbPassword.Text = dbconfig.Password;

                try
                {
                    updateCmbDBsItems(true);                     
                }
                catch (Exception ex)
                {
                    Console.Out.Write(ex.Message);
                }

                if (dbHelper.isConnectionAvailable(dbconfig))
                {
                    lblTestResult.Text = testSuccess;
                    this.lblTestResult.ForeColor = System.Drawing.Color.Green;
                }
                else
                {
                    lblTestResult.Text = testFail;
                    this.lblTestResult.ForeColor = System.Drawing.Color.Red;
                }
            }
        }
 public DialogInsertingForm(DatabaseHelper dbHelper, TableList tablesList)
 {
     this.dbHelper = dbHelper;
     this.tablesList = tablesList;
     InitializeComponent();
     getLocalizedLabelsMessages();
     getDefaultValues();
 }
예제 #3
0
 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();
 }
예제 #5
0
 public InsertDataForm(StartScreenForm startForm, TableList tablesList)
 {
     this.startForm = startForm;
     InitializeComponent();
     this.dbHelper = new DatabaseHelper(startForm.Template.DBconfig);
     this.TablesList = tablesList;
     getLocalizedLabelsMessages();
     getDefaultValues();
     createTablesView();
 }
예제 #6
0
        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();          
 }
 private void updateCmbDBsItems(bool select)
 {
     cmbDBs.Items.Clear();
     cmbDBs.Text = "";
     cmbDBs.SelectedIndex = -1;
     dbHelper = new DatabaseHelper(dbconfig);
     List<String> dbList = dbHelper.selectDataBases();
     foreach (String s in dbList)
     {
         int index = cmbDBs.Items.Add(s);
         if (select && s.Equals(dbconfig.DbName))
             cmbDBs.SelectedIndex = index;
     }    
 }
예제 #10
0
 private Boolean validateTemplateFileConnection()
 {
     if (Template != null)
     {
         if (Template.DBconfig != null && Template.DBconfig.Db != null && !"".Equals(Template.DBconfig.Db))
         {
             dbHelper = new DatabaseHelper(Template.DBconfig);
             return dbHelper.isConnectionAvailable(Template.DBconfig); 
         }
                      
     }
     return false;
 }
예제 #11
0
        private void btnTest_Click(object sender, EventArgs e)
        {
            DatabaseHelper dbHelper = new DatabaseHelper(this.Template.DBconfig);
            this.Template.DBconfig.Db = cmbDB.SelectedItem.ToString();
            this.Template.DBconfig.Server = txbServer.Text;
            this.Template.DBconfig.Port = txbPort.Text;
            this.Template.DBconfig.User = txbUser.Text;
            this.Template.DBconfig.Password = txbPassword.Text;

            if (dbHelper.isConnectionAvailableNoDB(this.Template.DBconfig))
            {
                this.lblTestResult.Text = testSuccess;
                this.lblTestResult.ForeColor = System.Drawing.Color.Green;
                this.btnAddDB.Enabled = true;
                this.cmbDBs.Enabled = true;
                this.lblDatabase.Enabled = true;
                updateCmbDBsItems(false);
            }
            else
            {
                this.lblTestResult.Text = testFail;
                this.lblTestResult.ForeColor = System.Drawing.Color.Red;
                this.btnAddDB.Enabled = false;
                this.cmbDBs.Enabled = false;
                this.lblDatabase.Enabled = false;
            }
        }
예제 #12
0
 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;
 }