Ejemplo n.º 1
0
        public int Agregar(Historico_Solicitud entidad)
        {
            int id = -1;

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

                var sql = string.Format("INSERT INTO HISTORICO_SOLICITUD (FECHA,ID_SOLICITUD,ID_ESTADO, ID_USUARIO, ID_DISPOSITIVO)" +
                                        " VALUES (" + ic + "{0}, " + ic + "{1}, " + ic + "{2}," + ic + "{3}, " + ic + "{4}) " + accessor.sqlGetNewIdentity(Arguments.ID_Historico, "{5}"),
                                        Arguments.Fecha, Arguments.ID_Solicitud, Arguments.Id_Estado, Arguments.ID_Usuario, Arguments.Id_Dispositivo,
                                        Arguments.ID_Historico);


                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.Fecha, entidad.Fecha),
                    accessor.Parameter(Arguments.ID_Solicitud, entidad.Id_Solicitud),
                    accessor.Parameter(Arguments.Id_Estado, entidad.Id_Estado),
                    accessor.Parameter(Arguments.ID_Usuario, entidad.Id_Usuario),
                    accessor.Parameter(Arguments.Id_Dispositivo, entidad.Id_Dispositivo),
                    accessor.Parameter(Arguments.ID_Historico, 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.º 2
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.º 3
0
        public int Agregar(Login_Dispositivo entidad)
        {
            int id = -1;

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

                var sql = string.Format("INSERT INTO LOGIN_DISPOSITIVO (ID_DISPOSITIVO,FECHA,CONNECTION_ID, ID_EVENTO, ID_USUARIO)" +
                                        " VALUES (" + ic + "{0}, " + ic + "{1}, " + ic + "{2}," + ic + "{3}, " + ic + "{4}) " + accessor.sqlGetNewIdentity(Arguments.ID_Login, "{5}"),
                                        Arguments.Id_Dispositivo, Arguments.Fecha, Arguments.Connection_ID, Arguments.Id_Evento, Arguments.ID_Usuario, Arguments.ID_Login);


                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.Id_Dispositivo, entidad.Id_Dispositivo),
                    accessor.Parameter(Arguments.Fecha, entidad.Fecha),
                    accessor.Parameter(Arguments.Connection_ID, entidad.Connection_Id),
                    accessor.Parameter(Arguments.Id_Evento, entidad.Id_Evento),
                    accessor.Parameter(Arguments.ID_Usuario, entidad.Id_Usuario),
                    accessor.Parameter(Arguments.ID_Login, 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.º 4
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.º 5
0
        public int Agregar(Historico_Deshabilitacion entidad)
        {
            int id = -1;
            try
            {

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

                var sql = string.Format("INSERT INTO HISTORICO_DESHABILITACION (FECHA,COMENTARIO,ID_MOTIVO,ID_PERMISO, ID_PRENSA, ID_USUARIO, ID_DISPOSITIVO)" +
                                       " VALUES (" + ic + "{0}, " + ic + "{1}, " + ic + "{2}," + ic + "{3}, " + ic + "{4}, " + ic + "{5}, " + ic + "{6} ) " + accessor.sqlGetNewIdentity(Arguments.ID_Deshabilitacion, "{7}"),
                                       Arguments.Fecha, Arguments.Comentario, Arguments.ID_Motivo, Arguments.ID_Permiso, Arguments.Id_Prensa, 
                                       Arguments.ID_Usuario, Arguments.Id_Dispositivo, Arguments.ID_Deshabilitacion);


                List<IDataParameter> parameters = new List<IDataParameter>()
                {
                    accessor.Parameter(Arguments.Fecha, entidad.Fecha),
                    accessor.Parameter(Arguments.Comentario, entidad.Comentario),
                    accessor.Parameter(Arguments.ID_Motivo, entidad.Id_Motivo),
                    accessor.Parameter(Arguments.ID_Permiso, entidad.Id_Permiso),
                    accessor.Parameter(Arguments.Id_Prensa, entidad.Id_Prensa),
                    accessor.Parameter(Arguments.ID_Usuario, entidad.Id_Usuario),
                    accessor.Parameter(Arguments.Id_Dispositivo, entidad.Id_Dispositivo),
                    accessor.Parameter(Arguments.ID_Deshabilitacion, 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;
        }
        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.º 7
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.º 8
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.º 9
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.º 10
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.º 11
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.º 12
0
        public int Agregar(Solicitud entidad)
        {
            int id = -1;

            try
            {
                var    accessor = new DataAccesor(_connectionString);
                string ic       = accessor.ParameterIdentifierCharacter();
                var    sql      = string.Format("INSERT INTO SOLICITUD (FECHA_GENERACION, ID_PRENSA)" +
                                                " VALUES (" + ic + "{0}, " + ic + "{1}) " + accessor.sqlGetNewIdentity(Arguments.Id, "{2}"),
                                                Arguments.Fecha_Generacion, Arguments.Id_Prensa, Arguments.Id);

                List <IDataParameter> parameters = new List <IDataParameter>()
                {
                    accessor.Parameter(Arguments.Fecha_Generacion, entidad.Fecha_Generacion),
                    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);
        }