コード例 #1
0
        public static int Crear()
        {
            string Sentencia = "SELECT MAX(PagOrden) AS Orden FROM paginas";

            IDataReader Datos = AyudanteMySQL.EjecutarReader(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);

            int Orden = 1000;

            if (Datos.Read())
            {
                Orden = (int)Datos["Orden"];
            }

            Orden = Orden + 2;

            Datos.Close();

            Sentencia  = "INSERT INTO paginas (PagPadre, PagOrden, PagNombre, GruposAutorizados) ";
            Sentencia += "VALUES (-1, " + Orden + ", 'Nueva Pagina', 'Todos')";

            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);

            Sentencia = "SELECT LAST_INSERT_ID() AS ID";
            Datos     = AyudanteMySQL.EjecutarReader(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);

            int resultado = (Datos.Read()) ? Int32.Parse(Datos["ID"].ToString()) : -1;

            Datos.Close();
            return(resultado);
        }
コード例 #2
0
        public static void Conciliar(string Mes, string Cta)
        {
            string SentenciaBx = "UPDATE DepositoBanco SET ";

            SentenciaBx += "Conciliado = 'T' ";
            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["PortalGene"], SentenciaBx);

            string SentenciaLx = "UPDATE DepositoFisico SET ";

            SentenciaLx += "Conciliado = 'T' ";
            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["PortalGene"], SentenciaLx);


            string SentenciaB = "UPDATE DepositoBanco SET ";

            SentenciaB += "Conciliado = 'C' ";
            SentenciaB += "WHERE (NumeroDep IN (SELECT NumeroDep FROM DepositoFisico ))";
            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["PortalGene"], SentenciaB);

            string SentenciaL = "UPDATE DepositoFisico SET ";

            SentenciaL += "Conciliado = 'C' ";
            SentenciaL += "WHERE (NumeroDep IN (SELECT NumeroDep FROM DepositoBanco ))";
            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["PortalGene"], SentenciaL);
        }
コード例 #3
0
        public static void IncluirContacto(int moduloid, string nombre, string cargo, string email, string contacto1, string contacto2)         //Para Incluir un contacto en el modulo indicado
        {
            string Sentencia = "INSERT INTO contactos (ModuloID,Nombre,Cargo,Email,Contacto1,Contacto2) ";

            Sentencia += "VALUES ('" + moduloid + "','" + nombre + "','" + cargo + "','" + email + "','" + contacto1 + "','" + contacto2 + "')";
            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);
        }
コード例 #4
0
        public static void IncluirDocumento(int moduloid, string Fecha, string Descripcion, string Formato, string Link, string Titulo)         //falta fecha... Para Incluir un documento en el modulo indicado
        {
            string Sentencia = "INSERT INTO documentos (ModuloID,Fecha,Descripcion,Formato,Link,Titulo) ";

            Sentencia += "VALUES (" + moduloid + ",'" + Fecha + "','" + Descripcion + "','" + Formato + "','" + Link + "','" + Titulo + "')";
            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);
        }
コード例 #5
0
        public static void ActualizaOrden(int ModuloId, int Orden, string Panel)
        {
            string Sentencia = "SELECT PagID FROM modulos WHERE ModuloID = " + ModuloId;

            IDataReader Datos = AyudanteMySQL.EjecutarReader(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);

            int PagId = 0;

            if (Datos.Read())
            {
                PagId = (int)Datos["PagID"];
            }

            Datos.Close();

            Sentencia  = "SELECT MAX(ModuloOrden) AS ModuloOrden ";
            Sentencia += "FROM modulos WHERE  PagID = " + PagId;

            Datos = AyudanteMySQL.EjecutarReader(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);

            if (Datos.Read())
            {
                Orden = (Orden != -1) ? Orden : ((int)Datos["ModuloOrden"]) + 2;
            }

            Datos.Close();

            Sentencia  = "UPDATE modulos SET ModuloOrden = " + Orden;
            Sentencia += ", NombrePanel = '" + Regex.Replace(Panel, "'", "''") + "'";
            Sentencia += " WHERE PagID = " + PagId;
            Sentencia += " AND ModuloID = " + ModuloId;

            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);
        }
コード例 #6
0
        public static void ActualizaConfig(int ModuloId, string Configuracion, string Valor)
        {
            string Sentencia = "SELECT * FROM modulosconfig WHERE ModuloID = " + ModuloId;

            Sentencia += " AND Configuracion = '" + Regex.Replace(Configuracion, "'", "''") + "'";

            IDataReader Datos = AyudanteMySQL.EjecutarReader(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);

            if (Datos.Read())
            {
                Sentencia  = "UPDATE modulosconfig SET Valor = '" + Valor + "'";
                Sentencia += " WHERE ModuloID = " + ModuloId + " AND Configuracion = '" + Regex.Replace(Configuracion, "'", "''") + "'";

                AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);
            }
            else
            {
                Sentencia  = "INSERT INTO modulosconfig (ModuloID, Configuracion, Valor) VALUES (";
                Sentencia += ModuloId + ", '" + Regex.Replace(Configuracion, "'", "''") + "', '" + Regex.Replace(Valor, "'", "''") + "')";

                AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);
            }

            Datos.Close();
        }
コード例 #7
0
        public static int Crear(int PagId, int definicionId, string Nombre, int TiempoCache)
        {
            string Sentencia = "SELECT MAX(ModuloOrden) AS Orden FROM modulos WHERE ";

            Sentencia += "PagID = " + PagId + " AND NombrePanel = 'Centro'";

            IDataReader Datos = AyudanteMySQL.EjecutarReader(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);

            int Orden = 1;

            if (Datos.Read())
            {
                Orden = (Datos["Orden"] == DBNull.Value) ? 1 : ((int)Datos["Orden"]) + 2;
            }

            Datos.Close();

            Sentencia  = "INSERT INTO modulos (PagID, ModuloDefID, ModuloOrden, NombrePanel, ModuloTitulo, GruposAutorizados, GruposAutorizadosEdicion, TiempoCache) ";
            Sentencia += "VALUES (" + PagId + ", " + definicionId + ", " + Orden + ", 'Centro', ";
            Sentencia += "'" + Regex.Replace(Nombre, "'", "''") + "', 'Todos', 'Administradores', " + TiempoCache + ")";

            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);

            Sentencia = "SELECT LAST_INSERT_ID() AS ID";
            Datos     = AyudanteMySQL.EjecutarReader(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);

            int resultado = (Datos.Read()) ? Int32.Parse(Datos["ID"].ToString()) : -1;

            Datos.Close();
            return(resultado);
        }
コード例 #8
0
        public static void CrearUsuario(int grupoId, int usuarioId)
        {
            string Sentencia = "INSERT INTO usuariosgrupos (GrupoID, UsuarioID) ";

            Sentencia += "VALUES (" + grupoId + ", " + usuarioId + ")";

            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);
        }
コード例 #9
0
        public static void EliminarFisico(string NumeroDep)
        {
            string Sentencia = "DELETE FROM DepositoFisico";

            Sentencia += " WHERE (NumeroDep = " + NumeroDep + ")";

            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["PortalGene"], Sentencia);
        }
コード例 #10
0
        public static void Eliminar(string Codigo, string NumeroId)
        {
            string Sentencia = "DELETE FROM analisisdeprecios ";

            Sentencia += "WHERE (Numero = " + NumeroId + ") and (Codigo = " + Codigo + ")";

            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["PortalGene"], Sentencia);
        }
コード例 #11
0
        public static void BorrarUsuario(int grupoId, int usuarioId)
        {
            string Sentencia = "DELETE FROM usuariosgrupos WHERE ";

            Sentencia += "GrupoID = " + grupoId + " AND UsuarioID = " + usuarioId;

            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);
        }
コード例 #12
0
        public static void ActualizaOrden(int PagId, int PagOrden)
        {
            string Sentencia = "UPDATE paginas SET PagOrden = ";

            Sentencia += (PagOrden == -1) ? "MAX(PagOrden) + 2" : PagOrden.ToString();
            Sentencia += " WHERE PagID = " + PagId;

            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);
        }
コード例 #13
0
        public static void Actualizar(int grupoId, string Nombre)
        {
            string Sentencia = "UPDATE grupos SET ";

            Sentencia += "Nombre = '" + Regex.Replace(Nombre, "'", "''") + "' ";
            Sentencia += "WHERE GrupoId = " + grupoId;

            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);
        }
コード例 #14
0
        public static void Borrar(int PagId)
        {
            string Sentencia = "DELETE FROM paginas WHERE PagID = " + PagId;

            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);

            Sentencia = "DELETE FROM paginas WHERE PagPadre = " + PagId;

            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);
        }
コード例 #15
0
        public static void ActualizarDefinicion(int definicionId, string Nombre, string Ubicacion, string UbicacionEdicion)
        {
            string Sentencia = "UPDATE modulosDefinicion SET ";

            Sentencia += "Nombre = '" + Regex.Replace(Nombre, "'", "''") + "', ";
            Sentencia += "Ubicacion = '" + Regex.Replace(Ubicacion, "'", "''") + "', ";
            Sentencia += "UbicacionEdicion = '" + Regex.Replace(UbicacionEdicion, "'", "''") + "' ";
            Sentencia += "WHERE ModuloDefID = " + definicionId;

            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);
        }
コード例 #16
0
        public static void ActualizarBanco(string NumeroDep, string Fecha, string NumeroCta, string Monto)
        {
            string Sentencia = "UPDATE DepositoBanco SET ";

            Sentencia += "Fecha = '" + Regex.Replace(Fecha, "'", "''") + "', ";
            Sentencia += "NumeroCta = '" + Regex.Replace(NumeroCta, "'", "''") + "', ";
            Sentencia += "monto = '" + Regex.Replace(Monto, "'", "''") + "' ";
            Sentencia += "WHERE (NumeroDep = " + NumeroDep + ")";

            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["PortalGene"], Sentencia);
        }
コード例 #17
0
        public static void Actualizar(int pagId, int pagPadre, string Nombre,
                                      string Autorizados)
        {
            string Sentencia = "UPDATE paginas SET ";

            Sentencia += "PagPadre = " + pagPadre + ", ";
            Sentencia += "PagNombre = '" + Regex.Replace(Nombre, "'", "''") + "', ";
            Sentencia += "GruposAutorizados = '" + Regex.Replace(Autorizados, "'", "''") + "' ";
            Sentencia += "WHERE PagID = " + pagId;

            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);
        }
コード例 #18
0
        public static void Actualizar(int moduloId, string Titulo, string Autorizados, string Edicion, int TiempoCache)
        {
            string Sentencia = "UPDATE modulos SET ";

            Sentencia += "ModuloTitulo = '" + Regex.Replace(Titulo, "'", "''") + "', ";
            Sentencia += "GruposAutorizados = '" + Regex.Replace(Autorizados, "'", "''") + "', ";
            Sentencia += "GruposAutorizadosEdicion = '" + Regex.Replace(Edicion, "'", "''") + "', ";
            Sentencia += "TiempoCache = " + TiempoCache + " ";
            Sentencia += "WHERE ModuloID = " + moduloId;

            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);
        }
コード例 #19
0
        public static void ActualizarFisico(string NumeroDep, string Fecha, string FormaDePago, string NumeroPla, string NumeroCta)
        {
            string Sentencia = "UPDATE DepositoFisico SET ";

            Sentencia += "Fecha = '" + Regex.Replace(Fecha, "'", "''") + "', ";
            Sentencia += "FormaDePago = '" + Regex.Replace(FormaDePago, "'", "''") + "', ";
            Sentencia += "NumeroPla = '" + Regex.Replace(NumeroPla, "'", "''") + "', ";
            Sentencia += "NumeroPar = '" + Regex.Replace(NumeroCta, "'", "''") + "' ";
            Sentencia += "WHERE (NumeroDep = " + NumeroDep + ")";

            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["PortalGene"], Sentencia);
        }
コード例 #20
0
        public static void Actualizar(int UsuarioId, string Usuario, string Clave, string Email, string Nombre, string Apellido)
        {
            string Sentencia = "UPDATE usuarios SET ";

            Sentencia += "Usuario = '" + Regex.Replace(Usuario, "'", "''") + "', ";
            Sentencia += "Clave = '" + Regex.Replace(Clave, "'", "''") + "', ";
            Sentencia += "Email = '" + Regex.Replace(Email, "'", "''") + "', ";
            Sentencia += "Nombre = '" + Regex.Replace(Nombre, "'", "''") + "', ";
            Sentencia += "Apellido = '" + Regex.Replace(Apellido, "'", "''") + "' ";
            Sentencia += "WHERE UsuarioID = " + UsuarioId;

            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);
        }
コード例 #21
0
        public static void CrearEvento(int moduloId, string Titulo, string Descripcion, string Fecha, string Lugar, string Vencimiento)
        {
            string Sentencia = "INSERT INTO eventos (ModuloId, Titulo, Descripcion, Fecha, Lugar, Fecha_Vencimiento) VALUES ";

            Sentencia += "(" + moduloId + ", ";
            Sentencia += "'" + Regex.Replace(Titulo, "'", "''") + "', ";
            Sentencia += "'" + Regex.Replace(Descripcion, "'", "''") + "', ";
            Sentencia += "'" + Regex.Replace(Fecha, "'", "''") + "', ";
            Sentencia += "'" + Regex.Replace(Lugar, "'", "''") + "', ";
            Sentencia += "'" + Regex.Replace(Vencimiento, "'", "''") + "')";

            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);
        }
コード例 #22
0
        public static void ActualizarEvento(int eventoId, string Titulo, string Descripcion, string Fecha, string Lugar, string Vencimiento)
        {
            string Sentencia = "UPDATE eventos SET ";

            Sentencia += "Titulo = '" + Regex.Replace(Titulo, "'", "''") + "', ";
            Sentencia += "Descripcion = '" + Regex.Replace(Descripcion, "'", "''") + "', ";
            Sentencia += "Fecha = '" + Regex.Replace(Fecha, "'", "''") + "', ";
            Sentencia += "Lugar = '" + Regex.Replace(Lugar, "'", "''") + "', ";
            Sentencia += "Fecha_Vencimiento = '" + Regex.Replace(Vencimiento, "'", "''") + "' ";
            Sentencia += "WHERE EventoId = " + eventoId;

            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);
        }
コード例 #23
0
        public static void ActualizaOrdenModulos(int PagId)
        {
            int    Contador;
            int    Orden;
            string Panel;

            string Sentencia = "SELECT DISTINCT NombrePanel FROM modulos ";

            Sentencia += "WHERE PagID = " + PagId + " ORDER BY NombrePanel";

            IDataReader Paneles = AyudanteMySQL.EjecutarReader(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);

            while (Paneles.Read())
            {
                Panel = Paneles["NombrePanel"].ToString();

                Contador = 0;

                Sentencia  = "SELECT DISTINCT ModuloOrden FROM modulos WHERE ";
                Sentencia += "PagID = " + PagId + " AND NombrePanel = '" + Regex.Replace(Panel, "'", "''") + "' ";
                Sentencia += "ORDER BY ModuloOrden";

                IDataReader Modulos = AyudanteMySQL.EjecutarReader(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);

                while (Modulos.Read())
                {
                    Contador++;

                    Orden = (int)Modulos["ModuloOrden"];

                    int NuevoOrden = ((Contador * 2) - 1) * -1;

                    Sentencia  = "UPDATE modulos SET ModuloOrden = " + NuevoOrden;
                    Sentencia += " WHERE PagID = " + PagId;
                    Sentencia += " AND ModuloOrden = " + Orden;
                    Sentencia += " AND NombrePanel = '" + Regex.Replace(Panel, "'", "''") + "'";

                    AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);
                }

                Modulos.Close();

                Sentencia  = "UPDATE modulos SET ModuloOrden = ModuloOrden * -1";
                Sentencia += " WHERE PagID = " + PagId;
                Sentencia += " AND NombrePanel = '" + Regex.Replace(Panel, "'", "''") + "'";

                AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);
            }
            Paneles.Close();
        }
コード例 #24
0
        public static int Crear()
        {
            string Sentencia = "INSERT INTO grupos (Nombre) VALUES ('(Nuevo Grupo)')";

            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);

            Sentencia = "SELECT LAST_INSERT_ID() AS ID";
            IDataReader Datos = AyudanteMySQL.EjecutarReader(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);

            int resultado = (Datos.Read()) ? Int32.Parse(Datos["ID"].ToString()) : -1;

            Datos.Close();
            return(resultado);
        }
コード例 #25
0
        public static void Actualizar(string Codigo, string Descripcion, string Cantidad, string Precio1, string Precio2, string Precio3, string Observaciones, string NumeroId)
        {
            string Sentencia = "UPDATE analisisdeprecios SET ";

            Sentencia += "Descripcion = '" + Regex.Replace(Descripcion, "'", "''") + "', ";
            Sentencia += "Cantidad = '" + Regex.Replace(Cantidad, "'", "''") + "', ";
            Sentencia += "Precio1 = '" + Regex.Replace(Precio1, "'", "''") + "', ";
            Sentencia += "Precio2 = '" + Regex.Replace(Precio2, "'", "''") + "', ";
            Sentencia += "Precio3 = '" + Regex.Replace(Precio3, "'", "''") + "', ";
            Sentencia += "Observaciones = '" + Regex.Replace(Observaciones, "'", "''") + "' ";
            Sentencia += "WHERE (Numero = " + NumeroId + ") and (Codigo = " + Codigo + ")";

            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["PortalGene"], Sentencia);
        }
コード例 #26
0
        public static int Crear(string Usuario, string Nombre)
        {
            string Sentencia = "INSERT INTO usuarios (Usuario, Nombre) VALUES ('";

            Sentencia += Regex.Replace(Usuario, "'", "''") + "', '" + Regex.Replace(Nombre, "'", "''") + "')";

            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);

            Sentencia = "SELECT LAST_INSERT_ID() AS ID";
            IDataReader Datos = AyudanteMySQL.EjecutarReader(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);

            int resultado = (Datos.Read()) ? Int32.Parse(Datos["ID"].ToString()) : -1;

            Datos.Close();

            return(resultado);
        }
コード例 #27
0
        public static void ActualizaOrden()
        {
            int Contador;
            int Padre;
            int Orden;

            string Sentencia = "SELECT DISTINCT PagPadre FROM paginas ORDER BY PagPadre";

            IDataReader Padres = AyudanteMySQL.EjecutarReader(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);

            while (Padres.Read())
            {
                Padre = (int)Padres["PagPadre"];

                Contador = 0;

                Sentencia  = "SELECT DISTINCT PagOrden FROM paginas WHERE PagPadre = " + Padre;
                Sentencia += " ORDER BY PagOrden";

                IDataReader Paginas = AyudanteMySQL.EjecutarReader(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);

                while (Paginas.Read())
                {
                    Contador++;

                    Orden = (int)Paginas["PagOrden"];

                    int NuevoOrden = ((Contador * 2) - 1) * -1;

                    Sentencia  = "UPDATE paginas SET PagOrden = " + NuevoOrden;
                    Sentencia += " WHERE PagPadre = " + Padre;
                    Sentencia += " AND PagOrden = " + Orden;

                    AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);
                }
                Paginas.Close();
            }
            Padres.Close();

            Sentencia = "UPDATE paginas SET PagOrden = PagOrden * -1";
            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);

            Sentencia = "UPDATE paginas SET PagOrden = 1000 WHERE PagNombre = 'Administración' ";
            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);
        }
コード例 #28
0
        public static int Crear(string Codigo, string Descripcion, string NumeroId)
        {
            string Sentencia = "INSERT INTO analisisdeprecios (Codigo, Descripcion, Numero) VALUES ('";

            Sentencia += Regex.Replace(Codigo, "'", "''") + "', '" + Regex.Replace(Descripcion, "'", "''") + "', '";
            Sentencia += Regex.Replace(NumeroId, "'", "''") + "')";

            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["PortalGene"], Sentencia);

            Sentencia = "SELECT LAST_INSERT_ID() AS ID";
            IDataReader Datos = AyudanteMySQL.EjecutarReader(ConfigurationSettings.AppSettings["PortalGene"], Sentencia);

            int resultado = (Datos.Read()) ? Int32.Parse(Datos["ID"].ToString()) : -1;

            Datos.Close();

            return(resultado);
        }
コード例 #29
0
        public static int CrearBanco(string NumeroDep, string Fecha, string NumeroCta, string Monto)
        {
            string Sentencia = "INSERT INTO DepositoBanco (NumeroDep, Fecha, NumeroCta, Monto ) VALUES ('";

            Sentencia += Regex.Replace(NumeroDep, "'", "''") + "', '" + Regex.Replace(Fecha, "'", "''") + "', '";
            Sentencia += Regex.Replace(NumeroCta, "'", "''") + "', '" + Regex.Replace(Monto, "'", "''") + "')";

            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["PortalGene"], Sentencia);

            Sentencia = "SELECT LAST_INSERT_ID() AS ID";
            IDataReader Datos = AyudanteMySQL.EjecutarReader(ConfigurationSettings.AppSettings["PortalGene"], Sentencia);

            int resultado = (Datos.Read()) ? Int32.Parse(Datos["ID"].ToString()) : -1;

            Datos.Close();

            return(resultado);
        }
コード例 #30
0
        public static int CrearDefinicion(string Nombre, string Ubicacion, string UbicacionEdicion)
        {
            string Sentencia = "INSERT INTO modulosdefinicion (Nombre, Ubicacion, UbicacionEdicion) VALUES (";

            Sentencia += "'" + Regex.Replace(Nombre, "'", "''") + "', ";
            Sentencia += "'" + Regex.Replace(Ubicacion, "'", "''") + "', ";
            Sentencia += "'" + Regex.Replace(UbicacionEdicion, "'", "''") + "')";

            AyudanteMySQL.Ejecutar(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);

            Sentencia = "SELECT LAST_INSERT_ID() AS ID";
            IDataReader Datos = AyudanteMySQL.EjecutarReader(ConfigurationSettings.AppSettings["CadenaConexion"], Sentencia);

            int resultado = (Datos.Read()) ? Int32.Parse(Datos["ID"].ToString()) : -1;

            Datos.Close();
            return(resultado);
        }