Ejemplo n.º 1
0
        public void ShowConfigForm()
        {
            CurrentConfigFileName = UtilGeneral.GetConfigValue(MySettingsUserConfig.KEY_CONFIG_NAME);

            frmConfig f = new frmConfig(CurrentConfigFileName, this);

            f.ShowDialog();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initial routine for the form
        /// </summary>
        public frmMain()
        {
            InitializeComponent();
            this.Top  = 0;
            this.Left = 0;

            this.Width  = Screen.PrimaryScreen.WorkingArea.Width;
            this.Height = Screen.PrimaryScreen.WorkingArea.Height;

            tlpMain.Width   = this.Width;
            dgvTables.Width = (int)(tlpMain.Width * 0.9);

            tlpMain.Height   = this.Height - (sbrMain.Height * 5);
            dgvTables.Height = (int)(tlpMain.Height * 0.9);
            tlpRight.Height  = (int)(tlpMain.Height * 0.9);

            this.Show();

            try
            {
                CurrentConfigFileName = UtilGeneral.GetConfigValue(MySettingsUserConfig.KEY_CONFIG_NAME);

                if (CurrentConfigFileName == "")
                {
                    ShowConfigForm();
                }
                else
                {
                    SQLDwConfig = new MySettingsEnvironments(CurrentConfigFileName);

                    if (!SQLDwConfig.ConfigFileExists())
                    {
                        UtilGeneral.ShowMessage("Configuration File do not exist. Please create a Configuration file to continue");
                        ShowConfigForm();
                    }
                    else
                    {
                        LoadData();
                    }
                }


                if (dgvTables.ColumnCount > 0)
                {
                    dgvTables.Columns[MyTableList.TABLE_NAME].AutoSizeMode    = DataGridViewAutoSizeColumnMode.AllCells;
                    dgvTables.Columns[MyTableList.INDEX_TYPE].AutoSizeMode    = DataGridViewAutoSizeColumnMode.AllCells;
                    dgvTables.Columns[MyTableList.BCP_SPLIT_VALUE_TYPE].Width = 30;
                }
            }
            catch (Exception ex)
            {
                UtilGeneral.ShowError(ex.Message);
            }
        }
        private string GetColListForMerge(string MergeScriptType, string SourceAlias, string TargetAlias)
        {
            string colstring = "";

            foreach (DataRow col in ColumnList.Rows)
            {
                string colName;
                colName = col[COLUMN_NAME].ToString();
                colName = UtilGeneral.GetQuotedString(colName);

                switch (MergeScriptType)
                {
                case COL_SCRIPT_TYPE_MERGE_KEY_COL_JOIN:
                    if (col[PKCOLUMN].ToString() == "1")
                    {
                        colstring += Constants.TAB + SourceAlias + "." + colName + " = " + TargetAlias + "." + colName;
                        colstring += COLUMN_SEPERATOR + Environment.NewLine;
                    }
                    break;

                case COL_SCRIPT_TYPE_MERGE_COL_UPDATE:
                    if (col[PKCOLUMN].ToString() != "1")
                    {
                        colstring += Constants.TAB + Constants.TAB + TargetAlias + "." + colName + " = " + SourceAlias + "." + colName;
                        colstring += COLUMN_SEPERATOR + Environment.NewLine;
                    }
                    break;
                }
            }

            if (MergeScriptType == COL_SCRIPT_TYPE_MERGE_COL_UPDATE)
            {
                string strHasColumn = UtilGeneral.GetQuotedString(UtilGeneral.GetConfigValue(MySettingsUserConfig.KEY_HASH_COL_NAME));
                colstring += Constants.TAB + Constants.TAB + Constants.MERGE_TARGET_ALIAS + "." + strHasColumn + " = " + Constants.MERGE_SOURCE_ALIAS + "." + strHasColumn;
                colstring += COLUMN_SEPERATOR + Environment.NewLine;
            }

            colstring = colstring.TrimEnd();
            //Remove the last comma
            if (colstring.EndsWith(COLUMN_SEPERATOR.Trim()))
            {
                colstring = colstring.Substring(0, colstring.Length - 1);
            }

            return(colstring);
        }