Пример #1
0
 //Form UI Actions
 private void dgvTables_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.RowIndex != -1)
         {
             frmTableDetails f = new frmTableDetails(this, dgvTables.Rows[e.RowIndex], SQLDwConfig);
             f.ShowDialog();
         }
     }
     catch (Exception ex)
     {
         UtilGeneral.ShowError(ex.Message);
     }
 }
        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);
                }
            }
        }