private void btnRememberCheckedTables_Click(object sender, EventArgs e)
        {
            var checkedTables = GetCheckedTableNames();

            if (checkedTables.Count > 0)
            {
                try
                {
                    // save to config
                    var connName = Config.GetInstance().Content.CurrentConnectionName;
                    Config.GetInstance().Content.DocTablePackages[connName] = checkedTables;
                    Config.GetInstance().SaveConfig();

                    MsgBoxHelper.Done();
                }
                catch (Exception ex)
                {
                    MsgBoxHelper.Error("Failure: " + ex.Message);
                }
            }
            else
            {
                MsgBoxHelper.Warning("Please select table!");
            }
        }
 private void btnConnTest_Click(object sender, EventArgs e)
 {
     try
     {
         using (var connection = new SqlConnection(NewConnection.Str))
         {
             connection.Open();
             MsgBoxHelper.Done("SQL Connection successful.");
         }
     }
     catch (Exception ex)
     {
         MsgBoxHelper.Warning("Failure: " + ex.Message);
     }
 }
        private void btnAddDocTemplate_Click(object sender, EventArgs e)
        {
            using (var dialog = new OpenFileDialog())
            {
                dialog.Filter = "Excel File|*.xlsx";
                dialog.Title  = "Add Doc Tempalte File";
                dialog.ShowDialog();
                if (!string.IsNullOrWhiteSpace(dialog.FileName))
                {
                    // add tempalte file
                    var newTemplatePath = Path.Combine(_configContent.DocTemplateLocation, dialog.SafeFileName);
                    File.Copy(dialog.FileName, newTemplatePath, true);

                    // add file name in list
                    cbDocTemplate.Items.Add(dialog.SafeFileName);
                    cbDocTemplate.SelectedItem = dialog.SafeFileName;

                    MsgBoxHelper.Done();
                }
            }
        }
 private void btnExportDocTemplate_Click(object sender, EventArgs e)
 {
     if (cbDocTemplate.SelectedIndex > -1)
     {
         using (var dialog = new SaveFileDialog())
         {
             dialog.Filter = "Excel File|*.xlsx";
             dialog.Title  = "Export Doc Tempalte File";
             dialog.ShowDialog();
             if (!string.IsNullOrWhiteSpace(dialog.FileName))
             {
                 var selectedFile = Path.Combine(_configContent.DocTemplateLocation, cbDocTemplate.SelectedItem.ToString());
                 File.Copy(selectedFile, dialog.FileName, true);
                 MsgBoxHelper.Done();
             }
         }
     }
     else
     {
         MsgBoxHelper.Warning("Please choose a template!");
     }
 }