Beispiel #1
0
        //te devuelve los datos de la tabla webcommands, imprescindible para trabajar!!
        public List <Dictionary <string, object> > GetWebCommands()
        {
            string sql = "SELECT commandname, commandparameters, tablename, uidtablename, sqlcommand FROM webcommands WHERE active = ? ORDER BY ordercommand ASC";

            Dictionary <string, object> parameters = new Dictionary <string, object>
            {
                { "active", 1 }
            };

            Dictionary <string, OdbcType> types = new Dictionary <string, OdbcType>
            {
                { "active", OdbcType.Int }
            };

            OdbcCommand commandOdbc = new OdbcCommand(sql, Infx.Database.Connection);

            DatabaseTools.InsertParameters(parameters, types, commandOdbc);
            List <Dictionary <string, object> > result = new List <Dictionary <string, object> >();

            try
            {
                Infx.Database.Connection.Open();
                result = Infx.ExecuteSelectCommand(commandOdbc);
                Infx.Database.Connection.Close();
            }
            catch (MyOdbcException e)
            {
                if (Infx.Database.Connection.State == System.Data.ConnectionState.Open)
                {
                    Infx.Database.Connection.Close();
                }
                Sender.Singelton().GetServices().GetRequiredService <ILogger <ConsultasPreparadas> >().LogError(e.Message);
            }
            return(result);
        }
        public List <Dictionary <string, object> > GetWebEvents()
        {
            string sql = "SELECT eventname, tablename, uidname FROM webevents WHERE active = ?";

            Dictionary <string, object> parameters = new Dictionary <string, object>
            {
                { "active", 1 }
            };

            Dictionary <string, OdbcType> types = new Dictionary <string, OdbcType>
            {
                { "active", OdbcType.Int }
            };

            OdbcCommand commandOdbc = new OdbcCommand(sql, Infx.Database.Connection);

            DatabaseTools.InsertParameters(parameters, types, commandOdbc);
            List <Dictionary <string, object> > result = new List <Dictionary <string, object> >();

            try
            {
                Infx.Database.Connection.Open();
                result = Infx.ExecuteSelectCommand(commandOdbc);
                Infx.Database.Connection.Close();
            }
            catch (MyOdbcException e)
            {
                if (Infx.Database.Connection.State == System.Data.ConnectionState.Open)
                {
                    Infx.Database.Connection.Close();
                }
                ErrorDBLog.Write(e.Message);
            }
            return(result);
        }