Пример #1
0
        private void exportTablebtn_Click(object sender, EventArgs e)
        {
            if (this.table != null)
            {
                explorer.FileName = "export_" + this.table + ".xml";
                DialogResult dr = explorer.ShowDialog();

                if (dr == DialogResult.OK)
                {
                    string xml = dbxml.tableToXml(this.table);

                    if (DBtoXML.WriteXmlStringToFile(explorer.FileName, xml))
                    {
                        Alert.Info("Se ha exportado " + this.table + " a " + explorer.FileName);
                        this.OpenFile(explorer.FileName);
                    }
                    else
                    {
                        Alert.Warning("Fallo al exportar " + this.table);
                    }
                }
            }
            else
            {
                Alert.Warning("Debes seleccionar una tabla!");
            }
        }
Пример #2
0
        public bool Configure(Config conf)
        {
            // restauramos la configuracion
            this.conf = conf;

            // cargamos la configuracion
            this.temporizador.Interval = this.conf.getIntervalMs();
            this.SelectedPath          = this.conf.getPath();
            this.db = this.conf.getDataBase();

            // restauramos la configuracion para conectarse al servidor de Sql Server
            SQLServer sqlserver = new SQLServer(this.conf.getHost(), this.conf.getUser(), this.conf.getPassword(), this.conf.getDataBase());

            if (sqlserver.testConnection())
            {
                // si tenemos conexion con la base de datos
                this.dbxml        = new DBtoXML(sqlserver.getConnection()); // restauramos la conexion
                this.tablesExport = this.conf.getTableNames();              // y restauramos las tablas que se tienen que exportar
            }
            else
            {
                Alert.Warning("No se ha podido configurar porque ha fallado la conexion con el servidor de bases de datos. El Programa no se ejecutara");
                this.confirmConfigDelete();
                return(false);
            }

            this.isConfigured = true; // indicamos que ya se ha cargado una cofiguracion
            return(true);
        }
Пример #3
0
 private void Form2_Load(object sender, EventArgs e)
 {
     this.explorer   = new SaveFileDialog();
     explorer.Filter = "XML (*.xml)|*.xml"; // extension del archivo por defecto
     this.dbxml      = Program.dbxml;
     this.database   = Program.dbName;
     this.tables     = new List <string>();
     label1.Text    += this.database;
     this.initTables();
 }
Пример #4
0
        private void exportar()
        {
            for (int i = 0; i < this.tablesExport.Count; i++)
            {
                string path      = this.SelectedPath + "\\" + this.tablesExport[i] + ".xml";
                string xmlString = this.dbxml.tableToXml(this.tablesExport[i]);

                if (xmlString != null && xmlString != "")
                {
                    DBtoXML.WriteXmlStringToFile(path, xmlString);
                }
            }
        }
Пример #5
0
        private void exportAllBtn_Click(object sender, EventArgs e)
        {
            explorer.FileName = "export_" + this.database + ".xml"; // nombre por defecto del xml que exportamos
            DialogResult dr = explorer.ShowDialog();

            if (dr == DialogResult.OK)
            {
                string xml = dbxml.tablesToXml(this.database);
                if (DBtoXML.WriteXmlStringToFile(explorer.FileName, xml))
                {
                    Alert.Info("Se han exportado todas las tablas a " + explorer.FileName);
                    this.OpenFile(explorer.FileName);
                }
                else
                {
                    Alert.Warning("Fallo al exportar todas las tablas");
                }
            }
        }
Пример #6
0
        private void Standalone_Load(object sender, EventArgs e)
        {
            // carga de componentes

            if (!this.isConfigured)
            {
                // si no se ha configurado previamente
                // cargamos las variables
                this.dbxml = Program.dbxml;
                this.db    = Program.dbName;
                this.conf  = Program.conf;
            }

            this.loadTables();
            this.notifyIcon.Icon        = this.Icon;
            this.notifyIcon.ContextMenu = this.notifyIconMenu;
            this.loadNotifyIconMenu();
            this.noClose = true;

            if (!this.hasConfigFile())
            {
                // si no existe fichero de configuracion
                this.DeleteConfigBtn.Enabled = false; // desactivamos este boton
            }

            // inicializacion de eventos
            this.temporizador.Tick      += new EventHandler(this.temporizador_Tick);
            this.notifyIcon.DoubleClick += new EventHandler(this.maximizeFromSystemTray);

            // si se configuro desde un archivo de configuracion ejecutamos el proceso
            if (this.initExportOnLoad)
            {
                this.InitExport();
                this.Shown += new EventHandler(this.toSystemTrayAfterConfig);
            }
        }