コード例 #1
0
        public static Usuario SelectByUserName(string username)
        {
            var resultado = (Usuario)null;

            using (var conexion = FactoryDataBase.Create())
                using (var comando = conexion.CreateCommand())
                {
                    comando.CommandText = @"SELECT [Id]
                                              ,[IdTipoUsuario]
                                              ,[Nombre]
                                              ,[ApellidoPaterno]
                                              ,[ApellidoMaterno]
                                              ,[Username]
                                              ,[Password]
                                              ,[Alta]
                                              ,[Modificacion]
                                              ,[UltimaModificacionPassword]
                                              ,[UltimaAutenticacionValida]
                                              ,[NumeroFallosAutenticacion]
                                              ,[RecuperacionPassword]
                                              ,[Nacimiento]
                                              ,[CodigoPostal]
                                              ,[NoExterior]
                                              ,[NoInterior]
                                              ,[Calle]
                                              ,[Colonia]
                                              ,[Localidad]
                                              ,[Referencia]
                                              ,[Municipio]
                                              ,[Estado]
                                              ,[Telefono1]
                                              ,[Telefono2]
                                              ,[Telefono3]
                                              ,[CorreoElectronico1]
                                              ,[CorreoElectronico2]
                                              ,[CorreoElectronico3]
                                              ,[EstaSuspendido]
                                              ,[MotivoSuspencion]
                                              ,[EstaBloqueado]
                                              ,[Activo]
                                          FROM [dbo].[Usuario]
                                         WHERE [Username]=@Username";

                    conexion.AddParameter(comando, "Username", username);

                    using (var lector = comando.ExecuteReader())
                        if (lector.Read())
                        {
                            resultado = MappingDAOs.MapToClass <Usuario>(lector);
                        }
                }

            return(resultado);
        }
コード例 #2
0
        public static List <VWLibro> SelectBy(long?isbn               = null
                                              , string titulo         = null
                                              , short?idEditorial     = null
                                              , int?idAutor           = null
                                              , string clavePais      = null
                                              , short?idCategoria     = null
                                              , int?idSubCategoria    = null
                                              , int?idSubSubCategoria = null
                                              , int?idTema            = null
                                              , long?idSubTema        = null
                                              , long?idSubSubTema     = null
                                              , byte?idIdioma         = null
                                              , short?anio            = null
                                              , byte?numeroEdicion    = null)
        {
            var resultado = new List <VWLibro>();

            using (var conexion = FactoryDataBase.Create())
                using (var comando = conexion.CreateCommand())
                {
                    comando.CommandType = CommandType.StoredProcedure;
                    comando.CommandText = @"spLibroBuscarPorCoincidencia";

                    conexion.AddParameter(comando, "isbn", isbn ?? (object)DBNull.Value);
                    conexion.AddParameter(comando, "titulo", string.IsNullOrWhiteSpace(titulo) ? (object)DBNull.Value : titulo);
                    conexion.AddParameter(comando, "idEditorial", idEditorial ?? (object)DBNull.Value);
                    conexion.AddParameter(comando, "idAutor", idAutor ?? (object)DBNull.Value);
                    conexion.AddParameter(comando, "clavePais", string.IsNullOrWhiteSpace(clavePais) ? (object)DBNull.Value : clavePais);
                    conexion.AddParameter(comando, "idCategoria", idCategoria ?? (object)DBNull.Value);
                    conexion.AddParameter(comando, "idSubCategoria", idSubCategoria ?? (object)DBNull.Value);
                    conexion.AddParameter(comando, "idSubSubCategoria", idSubSubCategoria ?? (object)DBNull.Value);
                    conexion.AddParameter(comando, "idTema", idTema ?? (object)DBNull.Value);
                    conexion.AddParameter(comando, "idSubTema", idSubTema ?? (object)DBNull.Value);
                    conexion.AddParameter(comando, "idSubSubTema", idSubSubTema ?? (object)DBNull.Value);
                    conexion.AddParameter(comando, "idIdioma", idIdioma ?? (object)DBNull.Value);
                    conexion.AddParameter(comando, "anio", anio ?? (object)DBNull.Value);
                    conexion.AddParameter(comando, "numeroEdicion", numeroEdicion ?? (object)DBNull.Value);

                    using (var lector = comando.ExecuteReader())
                        while (lector.Read())
                        {
                            resultado.Add(MappingDAOs.MapToClass <VWLibro>(lector));
                        }
                }

            return(resultado);
        }
コード例 #3
0
        public static List <Autor> SelectByLikeNombre(string nombre)
        {
            var resultado = new List <Autor>();

            using (var conexion = FactoryDataBase.Create())
                using (var comando = conexion.CreateCommand())
                {
                    comando.CommandType = CommandType.StoredProcedure;
                    comando.CommandText = @"spAutorBuscarPorCoincidencia";

                    conexion.AddParameter(comando, "nombre", string.IsNullOrWhiteSpace(nombre) ? (object)DBNull.Value : nombre);

                    using (var lector = comando.ExecuteReader())
                        while (lector.Read())
                        {
                            resultado.Add(MappingDAOs.MapToClass <Autor>(lector));
                        }
                }

            return(resultado);
        }
コード例 #4
0
        public static List <Categoria> SelectByLikeDescripcion(string descripcion)
        {
            var resultado = new List <Categoria>();

            using (var conexion = FactoryDataBase.Create())
                using (var comando = conexion.CreateCommand())
                {
                    comando.CommandType = CommandType.StoredProcedure;
                    comando.CommandText = @"spCategoriaBuscarPorCoincidencia";

                    conexion.AddParameter(comando, "descripcion", string.IsNullOrWhiteSpace(descripcion) ? (object)DBNull.Value : descripcion);

                    using (var lector = comando.ExecuteReader())
                        while (lector.Read())
                        {
                            resultado.Add(MappingDAOs.MapToClass <Categoria>(lector));
                        }
                }

            return(resultado);
        }
コード例 #5
0
        public static List <VWEjemplar> SelectBy(string codigo = null, byte?idEstadoEjemplar = null)
        {
            var resultado = new List <VWEjemplar>();

            using (var conexion = FactoryDataBase.Create())
                using (var comando = conexion.CreateCommand())
                {
                    comando.CommandType = CommandType.StoredProcedure;
                    comando.CommandText = @"spEjemplarBuscarPorCoincidencia";

                    conexion.AddParameter(comando, "codigo", string.IsNullOrWhiteSpace(codigo) ? (object)DBNull.Value : codigo);
                    conexion.AddParameter(comando, "idEstadoEjemplar", idEstadoEjemplar ?? (object)DBNull.Value);

                    using (var lector = comando.ExecuteReader())
                        while (lector.Read())
                        {
                            resultado.Add(MappingDAOs.MapToClass <VWEjemplar>(lector));
                        }
                }

            return(resultado);
        }
コード例 #6
0
        public static Libro SelectByISBN(long isbn)
        {
            var resultado = (Libro)null;

            using (var conexion = FactoryDataBase.Create())
                using (var comando = conexion.CreateCommand())
                {
                    comando.CommandText = @"SELECT [ISBN]
                                              ,[IdEditorial]
                                              ,[IdAutor]
                                              ,[ClavePais]
                                              ,[IdIdioma]
                                              ,[IdCategoria]
                                              ,[IdSubCategoria]
                                              ,[IdSubSubCategoria]
                                              ,[IdTema]
                                              ,[IdSubTema]
                                              ,[IdSubSubTema]
                                              ,[Titulo]
                                              ,[FechaPublicacion]
                                              ,[Anio]
                                              ,[Paginas]
                                              ,[NumeroEdicion]
                                              ,[NumeroEjemplares]
                                              ,[Estatus]
                                          FROM [dbo].[Libro]
                                         WHERE [ISBN]=@ISBN";

                    conexion.AddParameter(comando, "ISBN", isbn);

                    using (var lector = comando.ExecuteReader())
                        if (lector.Read())
                        {
                            resultado = MappingDAOs.MapToClass <Libro>(lector);
                        }
                }

            return(resultado);
        }
        public static List <ProcesamientoOcrTransfer> SelectTs(short scltcod, int idOperatoria)
        {
            var resultado = new List <ProcesamientoOcrTransfer>();

            using (var conexion = FactoryDataBase.Create())
                using (var comando = conexion.CreateCommand())
                {
                    comando.CommandText = string.Format(@"SELECT
                                                            POT.PT_ID ,
                                                            POT.PT_RUTA ,
                                                            POT.PT_NOMBRE_ARCHIVO ,
                                                            POT.PT_BUCKET ,
                                                            POT.PT_SCLTCOD ,
                                                            POT.PT_IDOPERATORIA ,
                                                            POT.PT_NUNICODOC ,
                                                            POT.PT_NUNICODOCT ,
                                                            POT.PT_DOCCOD ,
                                                            POT.PT_NROIDENTDOC ,
                                                            POT.PT_NROREFERENC ,
                                                            POT.PT_IDIMAGEN ,
                                                            POT.PT_ESTATUS ,
                                                            POT.PT_FECHA ,
                                                            POT.PT_IDPILA  ,
                                                            CC.CATEGORIA
                                                        FROM
                                                            {1}PROCESAMIENTO_OCR_TRANSFER POT
                                                            INNER JOIN {0}CHECKLIST_CAP CC ON POT.PT_NUNICODOC=CC.NUNICODOC 
                                                                                          AND POT.PT_NUNICODOCT=CC.NUNICODOCT
                                                       WHERE 
                                                            POT.PT_SCLTCOD=:SCLTCOD
                                                            AND POT.PT_IDOPERATORIA=:IDOPERATORIA
                                                            AND POT.PT_NUNICODOC IN (SELECT 
                                                                                           DISTINCT A.NUNICODOC 
                                                                                       FROM 
                                                                                           (SELECT 
                                                                                                  DISTINCT POT.PT_NUNICODOC NUNICODOC
                                                                                              FROM
                                                                                                  {1}PROCESAMIENTO_OCR_TRANSFER POT
                                                                                                  LEFT JOIN {1}PROCESAMIENTO_TRANSFORM PT ON PT.SCLTCOD=POT.PT_SCLTCOD
                                                                                                                                         AND PT.IDOPERATORIA=POT.PT_IDOPERATORIA
                                                                                                                                         AND PT.NUNICODOC=POT.PT_NUNICODOC
                                                                                                                                         AND PT.DOCCOD=POT.PT_DOCCOD 
                                                                                             WHERE 
                                                                                                  PT.SCLTCOD IS NULL 
                                                                                                  AND PT.IDOPERATORIA IS NULL 
                                                                                                  AND PT.DOCCOD IS NULL 
                                                                                                  AND PT.NUNICODOC IS NULL 
                                                                                                  AND POT.PT_SCLTCOD=:SCLTCOD 
                                                                                                  AND POT.PT_IDOPERATORIA=:IDOPERATORIA) A
                                                                                        INNER JOIN (SELECT A.NUNICODOC FROM (
                                                                                                           SELECT C.NUNICODOC, C.NROIDENTDOC, C.DOCCOD, (SUM(P.SIZE_BYTES) / 1024) / 1024 AS TAMANIO, FI.IDOPERATORIA AS OPERATORIA
                                                                                                           FROM {0}PAGINA_DIG P 
                                                                                                           INNER JOIN {0}CABECERA_DOC C ON P.NUNICODOC = C.NUNICODOC
                                                                                                           INNER JOIN {0}FLOW_INGRESOS_DETA_MP FD   ON C.NUNICODOC=FD.NUNICODOC
                                                                                                           INNER JOIN {0}FLOW_INGRESOS_CAB_MP FI ON FD.IDRECIBO=FI.IDRECIBO
                                                                                                       WHERE C.SCLTCOD=:SCLTCOD
                                                                                                       GROUP BY
                                                                                                           C.NUNICODOC,
                                                                                                           C.DOCCOD,
                                                                                                           C.NROIDENTDOC, 
                                                                                                               FI.IDOPERATORIA
                                                                                                       ) A WHERE A.TAMANIO>=50) B ON A.NUNICODOC=B.NUNICODOC
                                                                                   WHERE
                                                                                        ROWNUM=1 AND A.NUNICODOC>0)
                                                    ORDER BY
                                                            CC.CATEGORIA", ConfigurationManager.AppSettings["PROD"], ConfigurationManager.AppSettings["METEPEC"]);

                    conexion.AddParameter(comando, "SCLTCOD", scltcod);
                    conexion.AddParameter(comando, "IDOPERATORIA", idOperatoria);

                    using (var lector = comando.ExecuteReader())
                        while (lector.Read())
                        {
                            resultado.Add(MappingDAOs.MapToClass <ProcesamientoOcrTransfer>(lector));
                        }
                }

            return(resultado);
        }