コード例 #1
0
 public GingerCouchbase(ActDBValidation.eDBValidationType DBValidationtype, Environments.Database mDB, ActDBValidation mact)
 {
     Action  = DBValidationtype;
     this.Db = mDB;
     Act     = mact;
 }
コード例 #2
0
        private void SetVisibleControlsForAction()
        {
            if (ValidationCfgComboBox.SelectedItem == null)
            {
                RadioButtonsSection.Visibility     = System.Windows.Visibility.Visible;
                FreeSQLStackPanel.Visibility       = System.Windows.Visibility.Collapsed;
                SqlFile.Visibility                 = System.Windows.Visibility.Collapsed;
                FreeSQLStackPanel.Visibility       = System.Windows.Visibility.Collapsed;
                DoCommit.Visibility                = System.Windows.Visibility.Collapsed;
                Keyspace.Visibility                = System.Windows.Visibility.Collapsed;
                TableColWhereStackPanel.Visibility = System.Windows.Visibility.Collapsed;
                return;
            }

            //Ugly code but working, find way to make it simple use the enum val from combo
            ActDBValidation.eDBValidationType validationType = (ActDBValidation.eDBValidationType)ValidationCfgComboBox.SelectedValue;

            switch (validationType)
            {
            case ActDBValidation.eDBValidationType.UpdateDB:
                RadioButtonsSection.Visibility = System.Windows.Visibility.Visible;
                checkQueryType();
                TableColWhereStackPanel.Visibility = System.Windows.Visibility.Collapsed;
                FreeSQLLabel.Content = "Update DB SQL:";
                DoCommit.Visibility  = System.Windows.Visibility.Visible;
                Keyspace.Visibility  = System.Windows.Visibility.Collapsed;
                break;

            case ActDBValidation.eDBValidationType.FreeSQL:
                checkQueryType();
                RadioButtonsSection.Visibility = System.Windows.Visibility.Visible;
                if (mAct.GetInputParamValue(ActDBValidation.Fields.QueryTypeRadioButton) == ActDBValidation.eQueryType.FreeSQL.ToString())
                {
                    FreeSQLStackPanel.Visibility = System.Windows.Visibility.Visible;
                    SqlFile.Visibility           = System.Windows.Visibility.Collapsed;
                }
                else
                {
                    SqlFile.Visibility           = System.Windows.Visibility.Visible;
                    FreeSQLStackPanel.Visibility = System.Windows.Visibility.Collapsed;

                    if (mAct.QueryParams != null)
                    {
                        if (mAct.QueryParams.Count > 0)
                        {
                            QueryParamsPanel.Visibility = Visibility.Visible;
                        }
                        else
                        {
                            QueryParamsPanel.Visibility = Visibility.Collapsed;
                        }
                        QueryParamsGrid.DataSourceList = mAct.QueryParams;
                    }
                }
                DoCommit.Visibility = System.Windows.Visibility.Collapsed;
                TableColWhereStackPanel.Visibility = System.Windows.Visibility.Collapsed;
                FreeSQLLabel.Content = "Free SQL:";
                Keyspace.Visibility  = System.Windows.Visibility.Collapsed;
                break;

            case ActDBValidation.eDBValidationType.SimpleSQLOneValue:
                checkQueryType();
                try
                {
                    string DBName = DBNameComboBox.Text;
                    db = (Database)(from d in EA.Dbs where d.Name == DBName select d).FirstOrDefault();
                    if (!(db == null))
                    {
                        if (db.DBType == Database.eDBTypes.Cassandra)
                        {
                            Keyspace.Visibility = System.Windows.Visibility.Visible;
                        }
                        else
                        {
                            Keyspace.Visibility = System.Windows.Visibility.Collapsed;
                        }
                    }
                }
                catch { }
                FreeSQLStackPanel.Visibility       = System.Windows.Visibility.Collapsed;
                RadioButtonsSection.Visibility     = System.Windows.Visibility.Collapsed;
                TableColWhereStackPanel.Visibility = System.Windows.Visibility.Visible;
                DoCommit.Visibility = System.Windows.Visibility.Collapsed;
                SqlFile.Visibility  = System.Windows.Visibility.Collapsed;
                break;

            case ActDBValidation.eDBValidationType.RecordCount:
                checkQueryType();
                try
                {
                    string DBName = DBNameComboBox.Text;
                    db = (Database)(from d in EA.Dbs where d.Name == DBName select d).FirstOrDefault();
                    if (!(db == null))
                    {
                        if (db.DBType == Database.eDBTypes.Cassandra)
                        {
                            Keyspace.Visibility = System.Windows.Visibility.Visible;
                        }
                        else
                        {
                            Keyspace.Visibility = System.Windows.Visibility.Collapsed;
                        }
                    }
                }
                catch { }
                RadioButtonsSection.Visibility     = System.Windows.Visibility.Collapsed;
                FreeSQLStackPanel.Visibility       = System.Windows.Visibility.Visible;
                TableColWhereStackPanel.Visibility = System.Windows.Visibility.Collapsed;
                DoCommit.Visibility  = System.Windows.Visibility.Collapsed;
                SqlFile.Visibility   = System.Windows.Visibility.Collapsed;
                FreeSQLLabel.Content = @"Record count - SELECT COUNT(1) FROM {Table} - Enter only Table name below (+optional WHERE clause)";
                break;
            }
        }