public frmTableSplit(frmTableDetails ParentForm, string strSchema, string strTable, string strBCPCol, string strBCPValues, string strBCPValueType, MySettingsEnvironments CurrentConfig) { InitializeComponent(); this.frmParent = ParentForm; SQLDwConfig = CurrentConfig; SchemaName = strSchema; TableName = strTable; //Load Initial Values lblName.Text = SchemaName + "." + TableName; optSplitColumn.Checked = true; optTPYear.Checked = true; optValueTable.Checked = true; dtpStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); dtpEnd.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month)); txtBCPValueType.Text = strBCPValueType; //Load Column List MyColumnList col = new MyColumnList(SchemaName, TableName, SQLDwConfig); colList = col.GetColumnsList(); cmbColumns.Items.Clear(); foreach (DataRow row in colList.Rows) { cmbColumns.Items.Add(row[MyColumnList.COLUMN_NAME]); } strBCPCol = strBCPCol.Replace("[", ""); strBCPCol = strBCPCol.Replace("]", ""); if (strBCPCol != "") { cmbColumns.SelectedItem = strBCPCol; } else { cmbColumns.SelectedIndex = 0; } if (strBCPValueType == Constants.BCP_SPLIT_TYPE_VALUE) { optValueSelect.Checked = false; } else { optSplitTimePeriod.Checked = true; optValueSelect.Checked = true; } switch (strBCPValueType) { case Constants.BCP_SPLIT_TYPE_TIME_YEAR: optTPYear.Checked = true; break; case Constants.BCP_SPLIT_TYPE_TIME_MONTH: optTPMonth.Checked = true; break; case Constants.BCP_SPLIT_TYPE_TIME_DATE: case Constants.BCP_SPLIT_TYPE_TIME_INT_DATE: optTPDay.Checked = true; break; default: optSplitColumn.Checked = true; break; } lstValues.Items.Clear(); if (strBCPValues != "") { string[] BCPVals = strBCPValues.Split(','); foreach (string val in BCPVals) { lstValues.Items.Add(val); } if (strBCPValueType == Constants.BCP_SPLIT_TYPE_TIME_MONTH) { lstValues.Items.RemoveAt(0); lstValues.Items.RemoveAt(lstValues.Items.Count - 1); } } }
/// <summary> /// Load the default initial values for the Table Details form /// </summary> /// <param name="strSchemaName"></param> /// <param name="strTableName"></param> private void LoadDefaultValues(string strSchemaName, string strTableName) { cmbDistributionType.Items.Clear(); cmbDistributionType.Items.Add(Constants.DISTRIBUTION_TYPE_ROUND_ROBIN); cmbDistributionType.Items.Add(Constants.DISTRIBUTION_TYPE_HASH); cmbDistributionType.Items.Add(Constants.DISTRIBUTION_TYPE_REPLICATE); cmbDistributionType.SelectedItem = TableRow.Cells[MyTableList.DISTRIBUTION_TYPE].Value.ToString(); cmbIndexType.Items.Clear(); cmbIndexType.Items.Add(Constants.INDEX_TYPE_COLUMNSTORE); cmbIndexType.Items.Add(Constants.INDEX_TYPE_CLUSTERED); cmbIndexType.Items.Add(Constants.INDEX_TYPE_HEAP); cmbIndexType.SelectedItem = TableRow.Cells[MyTableList.INDEX_TYPE].Value.ToString(); txtSchema.Text = TableRow.Cells[MyTableList.SCHEMA_NAME].Value.ToString(); txtTable.Text = TableRow.Cells[MyTableList.TABLE_NAME].Value.ToString(); txtRowCount.Text = TableRow.Cells[MyTableList.TOTAL_ROWS].Value.ToString(); txtSize.Text = TableRow.Cells[MyTableList.DATA_SIZE_MB].Value.ToString(); txtBCPColumn.Text = TableRow.Cells[MyTableList.BCP_SPLIT_COLUMN].Value.ToString(); txtBCPValues.Text = TableRow.Cells[MyTableList.BCP_SPLIT_VALUES].Value.ToString(); txtBCPValueType.Text = TableRow.Cells[MyTableList.BCP_SPLIT_VALUE_TYPE].Value.ToString(); MyColumnList col = new MyColumnList(strSchemaName, strTableName, SQLDwConfig); DataTable colList = col.GetColumnsList(); cmbDistributionColumn.Items.Clear(); foreach (DataRow row in colList.Rows) { cmbDistributionColumn.Items.Add(row[MyColumnList.COLUMN_NAME]); } if (TableRow.Cells[MyTableList.DISTRIBUTION_COLUMN].Value.ToString() == "") { cmbDistributionColumn.SelectedIndex = 0; } else { cmbDistributionColumn.SelectedItem = TableRow.Cells[MyTableList.DISTRIBUTION_COLUMN].Value.ToString(); } cmbIndexColumn.Items.Clear(); foreach (DataRow row in colList.Rows) { cmbIndexColumn.Items.Add(row[MyColumnList.COLUMN_NAME]); } if (TableRow.Cells[MyTableList.INDEX_COLUMN].Value.ToString() == "") { cmbIndexColumn.SelectedIndex = 0; } else { cmbIndexColumn.SelectedItem = TableRow.Cells[MyTableList.INDEX_COLUMN].Value.ToString(); } if (TableRow.Cells[MyTableList.BCP_SPLIT].Value.ToString() == Constants.YES) { optBCPSplit.Checked = true; } else { optBCPFull.Checked = true; } if (TableRow.Cells[MyTableList.REPLACE_CRLF].Value.ToString() == Constants.YES) { chkCRLF.Checked = true; } else { chkCRLF.Checked = false; } }