Ejemplo n.º 1
0
        public bool Desvincular(int Id_Tag, int Id_Prensa)
        {
            bool sw = false;

            try
            {
                var    accessor = new DataAccesor(_connectionString);
                string ic       = accessor.ParameterIdentifierCharacter();
                var    sql      = string.Format(@"DELETE FROM TAG_PRENSA WHERE ID_TAG = " + ic + "{0} AND ID_PRENSA= " + ic + "{1}",
                                                Arguments.IdTag, Arguments.Id_Prensa);


                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.IdTag, Id_Tag),
                    accessor.Parameter(Arguments.IdRole, Id_Prensa)
                };

                int numFilas = accessor.ExecuteNonQuery(sql, parameters, false);

                if (numFilas > 0)
                {
                    sw = true;
                }
            }
            catch (Exception ex)
            {
                log.Error("Desvincular()", ex);
            }

            return(sw);
        }
Ejemplo n.º 2
0
        public bool Desvincular(int Id_User, int Id_Rol, int Id_Motivo)
        {
            bool sw = false;

            try
            {
                var    accessor = new DataAccesor(_connectionString);
                string ic       = accessor.ParameterIdentifierCharacter();
                var    sql      = string.Format(@"DELETE FROM USER_ROLES WHERE ID_USUARIO = " + ic + "{0} AND ID_ROL = " + ic + "{1}  AND ID_MOTIVO= " + ic + "{2}",
                                                Arguments.ID_Usuario, Arguments.IdRole, Arguments.ID_Motivo);


                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.ID_Usuario, Id_User),
                    accessor.Parameter(Arguments.IdRole, Id_Rol),
                    accessor.Parameter(Arguments.ID_Motivo, Id_Motivo)
                };

                int numFilas = accessor.ExecuteNonQuery(sql, parameters, false);

                if (numFilas > 0)
                {
                    sw = true;
                }
            }
            catch (Exception ex)
            {
                log.Error("Desvincular()", ex);
            }

            return(sw);
        }
Ejemplo n.º 3
0
        public int ValidarIdentityCode_Libre(string identityCode)
        {
            int Id_User = -1;

            try
            {
                var    accessor = new DataAccesor(_connectionString);
                string ic       = accessor.ParameterIdentifierCharacter();

                var sql = string.Format(@"select 
                                        Id
                                        from Usuario
                                        where
                                            IdentityCode = " + ic + "{0}",
                                        Arguments.Identity_Code);



                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.Identity_Code, identityCode)
                };

                //var ds = accessor.FillDataSet(sql, parameters);
                Id_User = Convert.ToInt32(accessor.ExecuteScalar(sql, parameters, false));
            }
            catch (Exception ex)
            {
                log.Error("ValidarIdentityCode_Libre(IdentityCode: {0})", ex, identityCode);
            }
            return(Id_User);
        }
Ejemplo n.º 4
0
        public Estado Detalles(int id)
        {
            Estado estado = null;

            try
            {
                var    accessor = new DataAccesor(_connectionString);
                string ic       = accessor.ParameterIdentifierCharacter();
                var    sql      = string.Format(@"SELECT
                                            ID_Estado AS {0},
                                            Nombre AS {1}                                            
                                        FROM Estado
                                        WHERE ID_Estado= " + ic + "{0}",
                                                Arguments.Id_Estado, Arguments.Nombre);



                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.Id_Estado, id)
                };

                var ds = accessor.FillDataSet(sql, parameters);

                estado = GetSingle(ds);
            }
            catch (Exception ex)
            {
                log.Error("Detalles({0})", ex, id);
            }
            return(estado);
        }
Ejemplo n.º 5
0
        public IList <Tag> GetTagsByProvider(int Id_TagProvider)
        {
            IList <Tag> tags = null;

            try
            {
                var    accessor = new DataAccesor(_connectionString);
                string ic       = accessor.ParameterIdentifierCharacter();
                var    sql      = string.Format(@"SELECT 
                                                TAG.ID AS {0},
                                                TAG.DESCRIPCION AS {1},
                                                TAG.ID_PROVEEDOR AS {2}
                                            FROM TAG
                                            WHERE TAGS.ID_PROVEEDOR = " + ic + "{2}",
                                                Arguments.Id, Arguments.Descripcion,
                                                Arguments.Id_Proveedor);



                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.Id_Proveedor, Id_TagProvider)
                };

                var ds = accessor.FillDataSet(sql, parameters);

                tags = GetCollection(ds);
            }
            catch (Exception ex)
            {
                log.Error("GetTagsByProvider()", ex);
            }

            return(tags);
        }
Ejemplo n.º 6
0
        public Usuario GetUserByIdentityCode(string identityCode)
        {
            Usuario usuario = null;

            try
            {
                var    accessor = new DataAccesor(_connectionString);
                string ic       = accessor.ParameterIdentifierCharacter();
                var    sql      = string.Format(@"SELECT
                                            ID AS {0},
                                            Nombre AS {1},
                                            Identity_Code AS {2},
                                            Password AS {3}
                                        FROM USUARIO
                                        WHERE Identity_Code = " + ic + "{2}",
                                                Arguments.Id, Arguments.Nombre, Arguments.Identity_Code,
                                                Arguments.Password
                                                );

                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.Identity_Code, identityCode)
                };

                var ds = accessor.FillDataSet(sql, parameters);

                usuario = GetSingle(ds);
            }
            catch (Exception ex)
            {
                log.Error("GetUserByIdentityCode({0})", ex, identityCode);
            }
            return(usuario);
        }
Ejemplo n.º 7
0
        public Motivo_Deshabilitacion Detalles(int id)
        {
            Motivo_Deshabilitacion motivo = null;

            try
            {
                var    accessor = new DataAccesor(_connectionString);
                string ic       = accessor.ParameterIdentifierCharacter();
                var    sql      = string.Format(@"SELECT
                                            ID_Motivo AS {0},
                                            Nombre AS {1}                                            
                                        FROM MOTIVO_DESHABILITACION
                                        WHERE ID_Motivo= " + ic + "{0}",
                                                Arguments.ID_Motivo, Arguments.Nombre);



                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.ID_Motivo, id)
                };

                var ds = accessor.FillDataSet(sql, parameters);

                motivo = GetSingle(ds);
            }
            catch (Exception ex)
            {
                log.Error("Detalles({0})", ex, id);
            }
            return(motivo);
        }
Ejemplo n.º 8
0
        public Dispositivo Detalles(int id)
        {
            Dispositivo dispositivo = null;

            try
            {
                var    accessor = new DataAccesor(_connectionString);
                string ic       = accessor.ParameterIdentifierCharacter();
                var    sql      = string.Format(@"SELECT
                                            ID_Dispositivo AS {0},
                                            Serial_Number AS {1},
                                            IP AS {2},
                                            Descripcion AS {3}
                                        FROM DISPOSITIVO
                                        WHERE ID_Dispositivo = " + ic + "{0}",
                                                Arguments.Id_Dispositivo, Arguments.Serial_Number,
                                                Arguments.IP, Arguments.Descripcion);



                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.Id_Dispositivo, id)
                };

                var ds = accessor.FillDataSet(sql, parameters);

                dispositivo = GetSingle(ds);
            }
            catch (Exception ex)
            {
                log.Error("Detalles({0})", ex, id);
            }
            return(dispositivo);
        }
Ejemplo n.º 9
0
        public Tag_Mapping Detalles(int id)
        {
            Tag_Mapping mapping = null;

            try
            {
                var    accessor = new DataAccesor(_connectionString);
                string ic       = accessor.ParameterIdentifierCharacter();
                var    sql      = string.Format(@"SELECT
                                            ID AS {0},
                                            Nombre AS {1}                                            
                                        FROM TAG_MAPPING
                                        WHERE ID= " + ic + "{0}",
                                                Arguments.Id, Arguments.Nombre);



                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.Id, id)
                };

                var ds = accessor.FillDataSet(sql, parameters);

                mapping = GetSingle(ds);
            }
            catch (Exception ex)
            {
                log.Error("Detalles({0})", ex, id);
            }
            return(mapping);
        }
Ejemplo n.º 10
0
        public Contramedida Detalles(int id)
        {
            Contramedida contramedida = null;

            try
            {
                var    accessor = new DataAccesor(_connectionString);
                string ic       = accessor.ParameterIdentifierCharacter();
                var    sql      = string.Format(@"SELECT
                                            ID_Contramedida AS {0},
                                            Nombre AS {1}                                            
                                        FROM Contramedida
                                        WHERE ID_Contramedida = " + ic + "{0}",
                                                Arguments.Id_Contramedida, Arguments.Nombre);



                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.Id_Contramedida, id)
                };

                var ds = accessor.FillDataSet(sql, parameters);

                contramedida = GetSingle(ds);
            }
            catch (Exception ex)
            {
                log.Error("Detalles({0})", ex, id);
            }
            return(contramedida);
        }
Ejemplo n.º 11
0
        public IList <Siguiente_Cubierta> Listar(string cv)
        {
            IList <Siguiente_Cubierta> lst = null;

            try
            {
                var    accessor = new DataAccesor(_connectionString);
                string ic       = accessor.ParameterIdentifierCharacter();
                var    sql      = string.Format(@"SELECT
                                            ID_PRENSA  AS {0},
                                            FECHA_CHEQUEO AS {1},
                                            BARCODE_CUBIERTA AS {2},
                                            CV AS {3}
                                        FROM SIGUIENTE_CUBIERTA
                                        WHERE CV=" + ic + "{3}",
                                                Arguments.Id_Prensa,
                                                Arguments.Fecha_Chequeo, Arguments.Barcode_Cubierta, Arguments.CV);

                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.CV, cv)
                };

                var ds = accessor.FillDataSet(sql, parameters);

                lst = GetCollection(ds);
            }
            catch (Exception ex)
            {
                log.Error("Listar()", ex);
            }
            return(lst);
        }
Ejemplo n.º 12
0
        public Solicitud Detalles(int id)
        {
            Solicitud solicitud = null;

            try
            {
                var    accessor = new DataAccesor(_connectionString);
                string ic       = accessor.ParameterIdentifierCharacter();
                var    sql      = string.Format(@"SELECT
                                            ID AS {0},
                                            FECHA_GENERACION AS {1},
                                            ID_PRENSA AS {2}
                                        FROM SOLICITUD
                                        WHERE ID = " + ic + "{0}",
                                                Arguments.Id, Arguments.Fecha_Generacion, Arguments.Id_Prensa);



                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.Id, id)
                };

                var ds = accessor.FillDataSet(sql, parameters);

                solicitud = GetSingle(ds);
            }
            catch (Exception ex)
            {
                log.Error("Detalles({0})", ex, id);
            }
            return(solicitud);
        }
Ejemplo n.º 13
0
        public Historico_Contramedidas Detalles(int id)
        {
            Historico_Contramedidas historico = null;

            try
            {
                var    accessor = new DataAccesor(_connectionString);
                string ic       = accessor.ParameterIdentifierCharacter();
                var    sql      = string.Format(@"SELECT
                                            ID AS {0},
                                            Expiracion AS {1},
                                            CV AS {2},
                                            Lote AS {3},
                                            Id_Prensa AS {4}
                                        FROM HISTORICO_CONTRAMEDIDAS
                                        WHERE ID= " + ic + "{0}",
                                                Arguments.Id, Arguments.Expiracion, Arguments.CV, Arguments.lote, Arguments.Id_Prensa);



                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.Id, id)
                };

                var ds = accessor.FillDataSet(sql, parameters);

                historico = GetSingle(ds);
            }
            catch (Exception ex)
            {
                log.Error("Detalles({0})", ex, id);
            }
            return(historico);
        }
Ejemplo n.º 14
0
        public bool Eliminar(int id)
        {
            bool sw = false;

            try
            {
                var    accessor = new DataAccesor(_connectionString);
                string ic       = accessor.ParameterIdentifierCharacter();

                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.Id, id)
                };

                var result = accessor.ExecuteNonQuery(String.Format("DELETE FROM TAG WHERE ID = " + ic + "{0}", Arguments.Id), parameters, false);


                if (typeof(int).Equals(result.GetType()))
                {
                    sw = (int)result > 0;
                }
                else
                {
                    log.Warning("Eliminar() No se ha completado la eliminación");
                }
            }
            catch (Exception ex)
            {
                log.Error("Eliminar()", ex);
            }

            return(sw);
        }
Ejemplo n.º 15
0
        public Tag Detalles(int id)
        {
            Tag tag = null;

            try
            {
                var    accessor = new DataAccesor(_connectionString);
                string ic       = accessor.ParameterIdentifierCharacter();
                var    sql      = string.Format(@"SELECT ID AS {0},
                                                            DESCRIPCION AS {1},
                                                            ID_PROVEEDOR AS {2}
                                                        FROM TAGS
                                                        WHERE ID_TAG = " + ic + "{0}",
                                                Arguments.Id, Arguments.Descripcion,
                                                Arguments.Id_Proveedor);



                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.Id, id)
                };

                var ds = accessor.FillDataSet(sql, parameters);

                tag = GetSingle(ds);
            }
            catch (Exception ex)
            {
                log.Error("Detalles({0})", id, ex);
            }
            return(tag);
        }
Ejemplo n.º 16
0
        public bool Modificar(Tag entidad)
        {
            bool updated = false;

            try
            {
                var    accessor = new DataAccesor(_connectionString);
                string ic       = accessor.ParameterIdentifierCharacter();
                var    sql      = string.Format(@"UPDATE TAGS 
                                           SET
                                                ID = " + ic + "{1}," +
                                                "DESCRIPCION = " + "{2}," +
                                                "ID_PROVEEDOR = " + ic + "{3}",
                                                Arguments.Id,
                                                Arguments.Descripcion,
                                                Arguments.Id_Proveedor);



                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.IdTag, entidad.Id),
                    accessor.Parameter(Arguments.Id_Proveedor, entidad.Id_Proveedor),
                    accessor.Parameter(Arguments.Descripcion, entidad.Descripcion)
                };

                var result = accessor.ExecuteNonQuery(sql, parameters, false);

                if (typeof(int).Equals(result.GetType()))
                {
                    updated = (int)result > 0;
                }
                else
                {
                    log.Warning("Modificar() No se ha completado la modificación");
                }
            }
            catch (Exception ex)
            {
                log.Error("Modificar()", ex);
            }

            return(updated);
        }
Ejemplo n.º 17
0
        public int Agregar(Prensa entidad)
        {
            int id = -1;

            try
            {
                var accessor = new DataAccesor(_connectionString);

                string ic = accessor.ParameterIdentifierCharacter();

                var sql = string.Format("INSERT INTO PRENSA (NOMBRE, TOPIC, BARCODE_PRENSA, BARCODE_PINTADO, BARCODE_PINCHADO, ID_ZONA)" +
                                        " VALUES (" + ic + "{0}, " + ic + "{1}," + ic + "{2}, " + ic + "{3}, " + ic + "{4}, " + ic + "{5}) " + accessor.sqlGetNewIdentity(Arguments.Id, "{6}"),
                                        Arguments.Nombre, Arguments.Topic, Arguments.Barcode_Prensa,
                                        Arguments.Barcode_Pintado, Arguments.Barcode_Pinchado, Arguments.ID_Zona, Arguments.Id);


                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.Nombre, entidad.Nombre),
                    accessor.Parameter(Arguments.Barcode_Prensa, entidad.Barcode_Prensa),
                    accessor.Parameter(Arguments.Barcode_Pintado, entidad.Barcode_Pintado),
                    accessor.Parameter(Arguments.Barcode_Pintado, entidad.Barcode_Pinchado),
                    accessor.Parameter(Arguments.Id, 0, ParameterDirection.Output)
                };

                var result = accessor.ExecuteNonQueryWithResult(sql, parameters, false);

                if (result != null && typeof(int).Equals(result.GetType()))
                {
                    id = (int)result;
                }
                else
                {
                    log.Warning("Agregar() No se ha completado la inserción");
                }
            }
            catch (Exception ex)
            {
                log.Error("Agregar()", ex);
            }

            return(id);
        }
Ejemplo n.º 18
0
        public IList <Login_Dispositivo> Listar(int lastIdDeviceLogin, int excludeEvent)
        {
            IList <Login_Dispositivo> logins = null;

            try
            {
                var    accessor = new DataAccesor(_connectionString);
                string ic       = accessor.ParameterIdentifierCharacter();
                var    sql      = string.Format(@"SELECT
                                            ID_LOGIN AS {0},
                                            ID_DISPOSITIVO AS {1},
                                            FECHA AS {2},
                                            CONNECTION_ID AS {3}, 
                                            ID_EVENTO As {4}, 
                                            ID_USUARIO AS {5}
                                        FROM LOGIN_DISPOSITIVO
                                        WHERE ID_LOGIN > " + ic + "{6} " +
                                                "AND ID_EVENTO <> " + ic + "{ 7}  " +
                                                " ORDER BY DATEMOMENT",
                                                Arguments.ID_Login, Arguments.Id_Dispositivo,
                                                Arguments.Fecha, Arguments.Connection_ID,
                                                Arguments.Id_Evento, Arguments.ID_Usuario,
                                                Arguments.UltimoIdLoginDispositivo, Arguments.Evento_Excluido);



                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.UltimoIdLoginDispositivo, lastIdDeviceLogin),
                    accessor.Parameter(Arguments.Evento_Excluido, excludeEvent)
                };

                var ds = accessor.FillDataSet(sql, parameters);

                logins = GetCollection(ds);
            }
            catch (Exception ex)
            {
                log.Error("ListarEventosFinales()", ex);
            }

            return(logins);
        }
Ejemplo n.º 19
0
        public int Agregar(Historico_Contramedidas entidad)
        {
            int id = -1;

            try
            {
                var    accessor = new DataAccesor(_connectionString);
                string ic       = accessor.ParameterIdentifierCharacter();

                var sql = string.Format("INSERT INTO HISTORICO_CONTRAMEDIDAS (EXPIRACION,CV,LOTE, ID_PRENSA)" +
                                        " VALUES (" + ic + "{0}, " + ic + "{1}, " + ic + "{2}," + ic + "{3} ) " + accessor.sqlGetNewIdentity(Arguments.Id, "{4}"),
                                        Arguments.Expiracion, Arguments.CV, Arguments.lote, Arguments.Id_Prensa, Arguments.Id);


                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.Expiracion, entidad.Expiracion),
                    accessor.Parameter(Arguments.CV, entidad.CV),
                    accessor.Parameter(Arguments.lote, entidad.Lote),
                    accessor.Parameter(Arguments.Id_Prensa, entidad.Id_Prensa),
                    accessor.Parameter(Arguments.Id, 0, ParameterDirection.Output)
                };

                var result = accessor.ExecuteNonQueryWithResult(sql, parameters, false);

                if (result != null && typeof(int).Equals(result.GetType()))
                {
                    id = (int)result;
                }
                else
                {
                    log.Warning("Agregar() No se ha completado la inserción");
                }
            }
            catch (Exception ex)
            {
                log.Error("Agregar()", ex);
            }

            return(id);
        }
Ejemplo n.º 20
0
        public bool Modificar(Siguiente_Cubierta entidad)
        {
            bool sw = false;

            try
            {
                var    accessor = new DataAccesor(_connectionString);
                string ic       = accessor.ParameterIdentifierCharacter();
                var    sql      = string.Format("UPDATE SIGUIENTE_CUBIERTA SET ID_PRENSA = " + ic + "{0}," +
                                                " FECHA_CHEQUEO= " + ic + "{1}, BARCODE_CUBIERTA=" + ic + "{2}, CV=" + ic + "{3} " +
                                                " WHERE ID_PRENSA = " + ic + "{0} AND CV=" + ic + "{3}",
                                                Arguments.Id_Prensa, Arguments.Fecha_Chequeo, Arguments.Barcode_Cubierta, Arguments.CV);



                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.Id_Prensa, entidad.Id_Prensa),
                    accessor.Parameter(Arguments.Fecha_Chequeo, entidad.Fecha_Chequeo),
                    accessor.Parameter(Arguments.Barcode_Cubierta, entidad.Barcode_Cubierta),
                    accessor.Parameter(Arguments.CV, entidad.CV)
                };

                var result = accessor.ExecuteNonQuery(sql, parameters, false);

                if (typeof(int).Equals(result.GetType()))
                {
                    sw = (int)result > 0;
                }
                else
                {
                    log.Warning("Modificar() No se ha completado la modificación");
                }
            }
            catch (Exception ex)
            {
                log.Error("Modificar()", ex);
            }

            return(sw);
        }
Ejemplo n.º 21
0
        public int Agregar(Tag tag)
        {
            int id = -1;

            try
            {
                var    accessor = new DataAccesor(_connectionString);
                string ic       = accessor.ParameterIdentifierCharacter();
                var    sql      = string.Format(@"INSERT INTO TAGS (DESCRIPCION, ID_PROVEEDOR)
                                                            VALUES (" + ic + "{0}, " + ic + "{1}) " + accessor.sqlGetNewIdentity(Arguments.Id, "{2}"),
                                                Arguments.Descripcion,
                                                Arguments.Id_Proveedor, Arguments.Id);



                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.Descripcion, tag.Descripcion),
                    accessor.Parameter(Arguments.Id_Proveedor, tag.Id_Proveedor),
                    accessor.Parameter(Arguments.Id, 0, ParameterDirection.Output)
                };

                var result = accessor.ExecuteNonQueryWithResult(sql, parameters, false);

                if (result != null && typeof(int).Equals(result.GetType()))
                {
                    id = (int)result;
                }
                else
                {
                    log.Warning("Agregar() No se ha completado la inserción");
                }
            }
            catch (Exception ex)
            {
                log.Error("Agregar()", ex);
            }

            return(id);
        }
Ejemplo n.º 22
0
        public bool Modificar(Dispositivo entidad)
        {
            bool sw = false;

            try
            {
                var    accessor = new DataAccesor(_connectionString);
                string ic       = accessor.ParameterIdentifierCharacter();
                var    sql      = string.Format("UPDATE Dispositivo SET Serial_Number = " + ic + "{0}, " +
                                                " IP = " + ic + "{1}, Descripcion= " + ic + "{2} WHERE ID_DISPOSITIVO = " + ic + "{3}",
                                                Arguments.Serial_Number, Arguments.IP, Arguments.Descripcion, Arguments.Id_Dispositivo);



                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.Serial_Number, entidad.Serial_Number),
                    accessor.Parameter(Arguments.IP, Convert.ToString(entidad.IP)),
                    accessor.Parameter(Arguments.Descripcion, Convert.ToString(entidad.Descripcion)),
                    accessor.Parameter(Arguments.Id_Dispositivo, entidad.Id_Disposito)
                };

                var result = accessor.ExecuteNonQuery(sql, parameters, false);

                if (typeof(int).Equals(result.GetType()))
                {
                    sw = (int)result > 0;
                }
                else
                {
                    log.Warning("Modificar() No se ha completado la modificación");
                }
            }
            catch (Exception ex)
            {
                log.Error("Modificar()", ex);
            }

            return(sw);
        }
Ejemplo n.º 23
0
        public int Agregar(Siguiente_Cubierta entidad)
        {
            int id = -1;

            try
            {
                var    accessor = new DataAccesor(_connectionString);
                string ic       = accessor.ParameterIdentifierCharacter();

                var sql = string.Format("INSERT INTO SIGUIENTE_CUBIERTA (ID_PRENSA, FECHA_CHEQUEO, BARCODE_CUBIERTA, CV)" +
                                        " VALUES (" + ic + "{0}, " + ic + "{1}, " + ic + "{2}, " + ic + "{3}) ",
                                        Arguments.Id_Prensa, Arguments.Fecha_Chequeo, Arguments.Barcode_Cubierta, Arguments.CV);


                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.Id_Prensa, entidad.Id_Prensa),
                    accessor.Parameter(Arguments.Fecha_Chequeo, entidad.Fecha_Chequeo),
                    accessor.Parameter(Arguments.Barcode_Cubierta, entidad.Barcode_Cubierta),
                    accessor.Parameter(Arguments.CV, entidad.CV)
                };

                var result = accessor.ExecuteNonQueryWithResult(sql, parameters, false);

                if (result != null && typeof(int).Equals(result.GetType()))
                {
                    id = (int)result;
                }
                else
                {
                    log.Warning("Agregar() No se ha completado la inserción");
                }
            }
            catch (Exception ex)
            {
                log.Error("Agregar()", ex);
            }

            return(id);
        }
Ejemplo n.º 24
0
        public int Agregar(Dispositivo entidad)
        {
            int id = -1;

            try
            {
                var    accessor = new DataAccesor(_connectionString);
                string ic       = accessor.ParameterIdentifierCharacter();

                var sql = string.Format("INSERT INTO DISPOSITIVO (SERIAL_NUMBER, IP, DESCRIPCION)" +
                                        " VALUES (" + ic + "{0}, " + ic + "{1}, " + ic + "{2}) " + accessor.sqlGetNewIdentity(Arguments.Id_Dispositivo, "{3}"),
                                        Arguments.Serial_Number, Arguments.IP, Arguments.Descripcion, Arguments.Id_Dispositivo);


                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.Serial_Number, entidad.Serial_Number),
                    accessor.Parameter(Arguments.IP, entidad.IP),
                    accessor.Parameter(Arguments.Descripcion, entidad.Descripcion),
                    accessor.Parameter(Arguments.Id_Dispositivo, 0, ParameterDirection.Output)
                };

                var result = accessor.ExecuteNonQueryWithResult(sql, parameters, false);

                if (result != null && typeof(int).Equals(result.GetType()))
                {
                    id = (int)result;
                }
                else
                {
                    log.Warning("Agregar() No se ha completado la inserción");
                }
            }
            catch (Exception ex)
            {
                log.Error("Agregar()", ex);
            }

            return(id);
        }
Ejemplo n.º 25
0
        public int Agregar(Usuario entidad)
        {
            int id = -1;

            try
            {
                var    accessor = new DataAccesor(_connectionString);
                string ic       = accessor.ParameterIdentifierCharacter();

                var sql = string.Format("INSERT INTO USUARIO (NOMBRE, IDENTITY_CODE, PASSWORD)" +
                                        " VALUES (" + ic + "{0}, " + ic + "{1}," + ic + "{2}) " + accessor.sqlGetNewIdentity(Arguments.Id, "{3}"),
                                        Arguments.Nombre, Arguments.Identity_Code, Arguments.Password, Arguments.Id);


                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.Nombre, entidad.Nombre),
                    accessor.Parameter(Arguments.Identity_Code, entidad.Identity_Code),
                    accessor.Parameter(Arguments.Password, entidad.Password),
                    accessor.Parameter(Arguments.Id, 0, ParameterDirection.Output)
                };

                var result = accessor.ExecuteNonQueryWithResult(sql, parameters, false);

                if (result != null && typeof(int).Equals(result.GetType()))
                {
                    id = (int)result;
                }
                else
                {
                    log.Warning("Agregar() No se ha completado la inserción");
                }
            }
            catch (Exception ex)
            {
                log.Error("Agregar()", ex);
            }

            return(id);
        }
Ejemplo n.º 26
0
        public int Agregar(Contramedida entidad)
        {
            int id = -1;

            try
            {
                var accessor = new DataAccesor(_connectionString);

                string ic = accessor.ParameterIdentifierCharacter();

                var sql = string.Format("INSERT INTO CONTRAMEDIDA (NOMBRE)" +
                                        " VALUES (" + ic + "{0}) " + accessor.sqlGetNewIdentity(Arguments.Id_Contramedida, "{1}"),
                                        Arguments.Nombre, Arguments.Id_Contramedida);


                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.Nombre, entidad.Nombre),
                    accessor.Parameter(Arguments.Id_Contramedida, 0, ParameterDirection.Output)
                };

                var result = accessor.ExecuteNonQueryWithResult(sql, parameters, false);

                if (result != null && typeof(int).Equals(result.GetType()))
                {
                    id = (int)result;
                }
                else
                {
                    log.Warning("Agregar() No se ha completado la inserción");
                }
            }
            catch (Exception ex)
            {
                log.Error("Agregar()", ex);
            }

            return(id);
        }
Ejemplo n.º 27
0
        public bool Modificar(Usuario entidad)
        {
            bool sw = false;

            try
            {
                var    accessor = new DataAccesor(_connectionString);
                string ic       = accessor.ParameterIdentifierCharacter();
                var    sql      = string.Format("UPDATE USUARIO SET NOMBRE = " + ic + "{0}, IDENTITY_CODE = " + ic + "{1}, \"PASSWORD\" = " + ic + "{2} WHERE ID = " + ic + "{3}",
                                                Arguments.Nombre, Arguments.Identity_Code, Arguments.Password, Arguments.Id);



                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.Nombre, entidad.Nombre),
                    accessor.Parameter(Arguments.Identity_Code, Convert.ToString(entidad.Identity_Code)),
                    accessor.Parameter(Arguments.Password, Convert.ToString(entidad.Password)),
                    accessor.Parameter(Arguments.Id, entidad.Id)
                };

                var result = accessor.ExecuteNonQuery(sql, parameters, false);

                if (typeof(int).Equals(result.GetType()))
                {
                    sw = (int)result > 0;
                }
                else
                {
                    log.Warning("Modificar() No se ha completado la modificación");
                }
            }
            catch (Exception ex)
            {
                log.Error("Modificar()", ex);
            }

            return(sw);
        }
Ejemplo n.º 28
0
        public int Agregar(Especificacion entidad)
        {
            int id = -1;

            try
            {
                var    accessor = new DataAccesor(_connectionString);
                string ic       = accessor.ParameterIdentifierCharacter();

                var sql = string.Format("INSERT INTO ESPECIFICACION (CV, MINUTOS_LIMITE_VULCANIZADO)" +
                                        " VALUES (" + ic + "{0}, " + ic + "{1})",
                                        Arguments.CV, Arguments.Minutos_Limite_Vulcanizado);


                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.CV, entidad.CV),
                    accessor.Parameter(Arguments.Minutos_Limite_Vulcanizado, entidad.Minutos_Limite_Vulcanizado),
                };

                var result = accessor.ExecuteNonQueryWithResult(sql, parameters, false);

                if (result != null && typeof(int).Equals(result.GetType()))
                {
                    id = (int)result;
                }
                else
                {
                    log.Warning("Agregar() No se ha completado la inserción");
                }
            }
            catch (Exception ex)
            {
                log.Error("Agregar()", ex);
            }

            return(id);
        }
Ejemplo n.º 29
0
        public bool Vincular(int Id_Permiso, int Id_Rol, int Id_Motivo)
        {
            bool sw = false;

            try
            {
                var    accessor = new DataAccesor(_connectionString);
                string ic       = accessor.ParameterIdentifierCharacter();
                var    sql      = string.Format(@"INSERT INTO PERMISO_ROL (ID_PERMISO, ID_ROL, ID_Motivo)
                                                            VALUES (" + ic + "{0}, " + ic + "{1}, " + ic + "{2} )",
                                                Arguments.ID_Permiso,
                                                Arguments.IdRole,
                                                Arguments.ID_Motivo);



                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.ID_Permiso, Id_Permiso),
                    accessor.Parameter(Arguments.IdRole, Id_Rol),
                    accessor.Parameter(Arguments.ID_Motivo, Id_Motivo)
                };


                int filasAfectadas = accessor.ExecuteNonQuery(sql, parameters, false);

                if (filasAfectadas > 0)
                {
                    sw = true;
                }
            }
            catch (Exception ex)
            {
                log.Error("Vincular()", ex);
            }

            return(sw);
        }
Ejemplo n.º 30
0
        public bool Modificar(Estado entidad)
        {
            bool sw = false;

            try
            {
                var    accessor = new DataAccesor(_connectionString);
                string ic       = accessor.ParameterIdentifierCharacter();
                var    sql      = string.Format("UPDATE ESTADO SET NOMBRE = " + ic + "{0} WHERE ID_ESTADO = " + ic + "{1}",
                                                Arguments.Nombre, Arguments.Id_Estado);



                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.Nombre, entidad.Nombre),
                    accessor.Parameter(Arguments.Id_Estado, entidad.Id_Estado)
                };

                var result = accessor.ExecuteNonQuery(sql, parameters, false);

                if (typeof(int).Equals(result.GetType()))
                {
                    sw = (int)result > 0;
                }
                else
                {
                    log.Warning("Modificar() No se ha completado la modificación");
                }
            }
            catch (Exception ex)
            {
                log.Error("Modificar()", ex);
            }

            return(sw);
        }