Esempio n. 1
0
 /// <summary>
 /// Retorna un LISTA de registros de la Entidad Seguridad.Empresa
 /// En la BASE de DATO la Tabla : [Seguridad.Empresa]
 /// <summary>
 /// <returns>List</returns>
 public OperationResult ListPaged(BEBuscaEmpresaRequest pFiltro)
 {
     try
     {
         var lstEmpresa   = oEmpresaData.ListPaged(pFiltro);
         int totalRecords = lstEmpresa.Select(x => x.TOTALROWS).FirstOrDefault();
         int totalPages   = (int)Math.Ceiling((float)totalRecords / (float)pFiltro.jqPageSize);
         var jsonGrid     = new
         {
             PageCount   = totalPages,
             CurrentPage = pFiltro.jqCurrentPage,
             RecordCount = totalRecords,
             Items       = (
                 from item in lstEmpresa
                 select new
             {
                 ID = item.codEmpresa,
                 Row = new string[] { string.Empty
                                      , string.Empty
                                      , item.numRUC
                                      , item.nomRazonSocial
                                      , item.nomContacto
                                      , item.desCorreo
                                      , item.nomLogo
                                      , item.desPaginaWeb
                                      , item.indActivo.ToString()
                                      , item.segUsuarioEdita
                                      , item.segFechaEdita.ToString() }
             }).ToArray()
         };
         return(OK(jsonGrid));
     }
     catch (Exception ex)
     {
         return(Error(GetType().Name, MethodBase.GetCurrentMethod().Name, ex, pFiltro.userActual, pFiltro.codEmpresa));
     }
     finally
     {
         if (oEmpresaData != null)
         {
             oEmpresaData.Dispose();
             oEmpresaData = null;
         }
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Retorna un LISTA de registros de la Entidad Seguridad.Empresa
        /// En la BASE de DATO la Tabla : [Seguridad.Empresa]
        /// <summary>
        /// <returns>List</returns>
        public List <BEEmpresaResponse> ListPaged(BEBuscaEmpresaRequest pFiltro)
        {
            List <BEEmpresaResponse> lstEmpresa = new List <BEEmpresaResponse>();

            try
            {
                using (_DBMLSeguridadSistemaDataContext SeguridadDC = new _DBMLSeguridadSistemaDataContext(conexion))
                {
                    var resul = SeguridadDC.usp_sis_R_Empresa_Paged(pFiltro.jqCurrentPage,
                                                                    pFiltro.jqPageSize,
                                                                    pFiltro.jqSortColumn,
                                                                    pFiltro.jqSortOrder,
                                                                    pFiltro.nomRazonSocial,
                                                                    pFiltro.numRUC,
                                                                    pFiltro.indActivo);
                    foreach (var item in resul)
                    {
                        lstEmpresa.Add(new BEEmpresaResponse()
                        {
                            ROW       = item.ROWNUM.HasValue ? item.ROWNUM.Value : 0,
                            TOTALROWS = item.TOTALROWS.HasValue ? item.TOTALROWS.Value : 0,

                            codEmpresa      = item.codEmpresa,
                            nomRazonSocial  = item.nomRazonSocial,
                            numRUC          = item.numRUC,
                            nomLogo         = item.nomLogo,
                            nomContacto     = item.nomContacto,
                            desCorreo       = item.desCorreo,
                            desPaginaWeb    = item.desPaginaWeb,
                            codEmpresaKey   = item.codEmpresaKey.ToString(),
                            indActivo       = item.indActivo,
                            segUsuarioEdita = item.segUsuarioEdita,
                            segFechaEdita   = item.segFechaEdita,
                            segMaquinaEdita = item.segMaquinaEdita,
                        });
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(lstEmpresa);
        }