示例#1
0
        public static bool ImportData(string folder, bool clearTable)
        {
            foreach (var table in GlobalInfo.Tables)
            {
                if (!table.Value.ToExport)
                {
                    continue;
                }

                var tableName = table.Value.Table.GetField("Name").GetValue(null).ToString();
                var filename  = Path.ChangeExtension(Path.Combine(folder, tableName), ".xml");
                if (!File.Exists(filename))
                {
                    continue;
                }

                if (clearTable)
                {
                    ImportExportData.DeleteData(tableName);
                }

                using (var dataset = new DataSet())
                {
                    dataset.ReadXml(filename, XmlReadMode.ReadSchema);
                    RowToElaborate?.Invoke(null, tableName);
                    var result = WriteData(tableName, dataset);
                    RowElaborated?.Invoke(null, new Tuple <int, bool>(dataset.Tables[tableName].Rows.Count, result));
                }
            }
            return(true);
        }
示例#2
0
        private void Elaborate()
        {
            if (cbbProvider.SelectedIndex == 1)
            {
                ImportExportData.ExportData(txtExport.Text);
            }
            else
            {
                ImportExportData.ImportData(txtImport.Text, ckbClean.Checked);
            }

            wizard1.CancelEnabled = true;
        }