示例#1
0
        private void hsExport_Click(object sender, EventArgs e)
        {
            var ew = new ExportWorkers(NotifiesClass.Instance)
            {
                alltables = new List <TableClass>()
            };

            ew.alltables.Clear();
            ew.AktDBReg      = DBReg;
            ew.ShowScripting = cbViewInScript.Checked;
            if (ckWriteFileForEVeryObject.Checked)
            {
                ew.WriteToFile = eSQLFileWriteMode.seperated;
            }
            else if (cbObjectExportToFile.Checked)
            {
                ew.WriteToFile = eSQLFileWriteMode.all;
            }

            if (ew.WriteToFile != eSQLFileWriteMode.none)
            {
                if ((txtFileName.Text.IndexOf(".", StringComparison.Ordinal)) < 0)
                {
                    txtFileName.Text += ".sql";
                }

                ew.SQLDirectoryName = txtExportDirectory.Text;
                ew.SQLFileName      = txtFileName.Text;
                ew.CharSet          = cbCharSet.SelectedItem as EncodingClass;
            }
            else
            {
                ew.SQLDirectoryName = string.Empty;
                ew.SQLFileName      = string.Empty;
            }


            for (int i = 0; i < selTables.ItemDatas.Count; i++)
            {
                var itm = selTables.ItemDatas[i] as ItemDataClass;
                var tc  = itm.Object as TableClass;
                tc.State = selTables.GetItemCheckState(i);
                if (tc.State != CheckState.Checked)
                {
                    continue;
                }
                ew.alltables.Add(tc);
            }

            ew.StartworkerGetTableData(ew.alltables, DBReg, ew.SQLDirectoryName, ew.SQLFileName);
        }
示例#2
0
        private void hsExport_Click(object sender, EventArgs e)
        {
            var ew = new ExportWorkers(NotifiesClass.Instance())
            {
                alltables = new List <TableClass>()
            };

            ew.alltables.Clear();
            ew.AktDBReg      = DBReg;
            ew.ShowScripting = cbViewInScript.Checked;
            ew.WriteToFile   = cbExportToFile.Checked;

            if (ew.WriteToFile)
            {
                if ((txtFileName.Text.IndexOf(".", StringComparison.Ordinal)) < 0)
                {
                    txtFileName.Text += ".sql";
                }
                var di = ActFolder.Tag as DirectoryInfo;
                ew.SQLFileInfo = new FileInfo(di?.FullName + "\\" + txtFileName.Text);
                ew.CharSet     = cbCharSet.SelectedItem as EncodingClass;
            }
            else
            {
                ew.SQLFileInfo = null;
            }


            for (int i = 0; i < selTables.ItemDatas.Count; i++)
            {
                var itm = selTables.ItemDatas[i] as ItemDataClass;
                var tc  = itm.Object as TableClass;
                tc.State = selTables.GetItemCheckState(i);
                if (tc.State != CheckState.Checked)
                {
                    continue;
                }
                ew.alltables.Add(tc);
            }

            ew.StartworkerGetTableData(ew.alltables, DBReg, ew.SQLFileInfo);
        }