/***********************************************
         * Common
         ***********************************************/
        public ExtractForm()
        {
            InitializeComponent();
            // default to main tab
            tabGenerateTableData.SelectedTab = tabPage2;

            this.txtOwnerName.Text = this.txtUserId.Text;

            // Panel Configuration load the configuration
            SerializeUtil serUtil = new SerializeUtil();
            ConfigurationObject conf = new ConfigurationObject();
            conf = (ConfigurationObject)serUtil.DeSerialize(conf);
            setConf(conf);

            // Panel Preload Table
            for (int i = 0; i < this.preloadTablsList.Items.Count; i++)
            {
                this.genPreloadTableList.Items.Add(preloadTablsList.Items[i]);
            }
        }
        // set the default conf when no file exist
        private ConfigurationObject getDefaultConf()
        {
            ConfigurationObject defaultConf = new ConfigurationObject();
            defaultConf.DataSource = "localhost/extdev";
            defaultConf.UserID = "MS9DJA";
            defaultConf.Password = "******";
            defaultConf.ExportFilePath = "";

            List<string> preloadTableList = new List<string>();
            preloadTableList.Add("DJA0513_MTN_WEB_TEMPLATE_L");
            preloadTableList.Add("DJA0514_MTN_FILETYPE_L");
            preloadTableList.Add("DJA0515_BTA_FILETYPE_L");
            preloadTableList.Add("DJA0516_MTN_NOTIFY_TMPL_L");
            preloadTableList.Add("DJA0521_SD_FILETYPE_L");
            preloadTableList.Add("T_IC_CODE");

            defaultConf.PreloadTableNameList = preloadTableList;

            return defaultConf;
        }
        /***********************************************
         * Below are the Configuration Panel Actions
         ***********************************************/
        private void setConf(ConfigurationObject conf)
        {
            this.txtDataSource.Text = conf.DataSource;
            this.txtUserId.Text = conf.UserID;
            this.txtPassword.Text = conf.Password;
            this.txtExportPath.Text = conf.ExportFilePath;

            List<string> preloadTableList = conf.PreloadTableNameList;

            if (preloadTableList != null && preloadTableList.Count > 0)
            {
                foreach (var item in conf.PreloadTableNameList)
                {
                    this.preloadTablsList.Items.Add(item.ToString());
                }
            }
        }
        // save configuration to file
        private void btnSaveConf_Click(object sender, EventArgs e)
        {
            ConfigurationObject saveConfObj = new ConfigurationObject();
            saveConfObj.DataSource = this.txtDataSource.Text;
            saveConfObj.UserID = this.txtUserId.Text;
            saveConfObj.Password = this.txtPassword.Text;
            saveConfObj.ExportFilePath = this.txtExportPath.Text;

            saveConfObj.PreloadTableNameList = new List<string>();
            foreach (var item in this.preloadTablsList.Items)
            {
                saveConfObj.PreloadTableNameList.Add(item.ToString());
            }

            SerializeUtil serUtil = new SerializeUtil();
            serUtil.Serialize(saveConfObj);
        }