Exemplo n.º 1
0
        public string ConsultarConcatenar(DTFiltros Dt)
        {
            DTResultadoOperacionList <DTObjetosFiltros> ResultadoList = new DTResultadoOperacionList <DTObjetosFiltros>();
            List <DTObjetosFiltros> Resultado = new List <DTObjetosFiltros>();

            try
            {
                Resultado = new BMGastos().ConsultarConcatenar(Dt);
                ResultadoList.Resultado = true;
                ResultadoList.Datos     = Resultado;
            }
            catch (Exception ex)
            {
                GestorLog.RegistrarLogExcepcion(ex);
            }
            JavaScriptSerializer serializer = new JavaScriptSerializer();

            serializer.MaxJsonLength = 500000000;
            return(serializer.Serialize(ResultadoList));
        }
Exemplo n.º 2
0
        public string ConsultarErroresExcel()
        {
            DTResultadoOperacionList <DTErroresExcel> ResultadoList = new DTResultadoOperacionList <DTErroresExcel>();
            List <DTErroresExcel> Resultado = new List <DTErroresExcel>();

            try
            {
                Resultado = new BMGastos().ConsultarErroresExcel();
                ResultadoList.Resultado = true;
                ResultadoList.Datos     = Resultado;
            }
            catch (Exception ex)
            {
                GestorLog.RegistrarLogExcepcion(ex);
            }
            JavaScriptSerializer serializer = new JavaScriptSerializer();

            //serializer.MaxJsonLength = 500000000;
            return(serializer.Serialize(ResultadoList));
        }
Exemplo n.º 3
0
        public string ValidarArchivo(string Plantilla)
        {
            string RutaArchivo = string.Empty;
            DTResultadoOperacionModel <DTSolped>       DTResultadoModel      = new DTResultadoOperacionModel <DTSolped>();
            DTResultadoOperacionModel <DTErroresExcel> DTResultadoModelCarga = new DTResultadoOperacionModel <DTErroresExcel>();

            //int ConEliminacion = 0;

            try
            {
                DTExcel             _Plantilla = JsonConvert.DeserializeObject <DTExcel>(Plantilla);
                List <DTFilasExcel> filas      = _Plantilla.sheets.First().rows;
                string MesGastos  = _Plantilla.sheets.First().name;
                bool   FechaGasto = ValidarFechaGasto(MesGastos);

                if (filas.Count > 1)
                {
                    //Validar el encabezado
                    List <DTColumnasExcel> columnas = filas.First().cells;

                    if (columnas[0].value.ToString().Trim() == DTEstructuraGastos.NomCuenta &&
                        columnas[1].value.ToString().Trim() == DTEstructuraGastos.NomCentroC &&
                        columnas[2].value.ToString().Trim() == DTEstructuraGastos.NroCuenta &&
                        columnas[3].value.ToString().Trim() == DTEstructuraGastos.CentroCoste &&
                        columnas[4].value.ToString().Trim() == DTEstructuraGastos.Concatenar &&
                        columnas[5].value.ToString().Trim() == DTEstructuraGastos.Tipo &&
                        columnas[6].value.ToString().Trim() == DTEstructuraGastos.Mes &&
                        columnas[7].value.ToString().Trim() == DTEstructuraGastos.Ajustes &&
                        columnas[8].value.ToString().Trim() == DTEstructuraGastos.TotalMes
                        )
                    {
                        List <DTFilasExcel> ConInformacion = (from dt in filas
                                                              where dt.cells.Count(x => x.value == null) != dt.cells.Count() &&
                                                              dt.index != 0
                                                              select dt).ToList();
                        if (ConInformacion.Count > 0)
                        {
                            if (FechaGasto)
                            {
                                string   MesGastoReal = "01-" + MesGastos;
                                BMGastos _BMGastos    = new BMGastos();
                                DTResultadoModelCarga = _BMGastos.LeerArchivo(ConInformacion, MesGastoReal);
                            }
                            else
                            {
                                DTResultadoModelCarga.Respuesta = false;
                                DTResultadoModelCarga.Mensaje   = DTMensaje.ObtenerObjetoMensaje(DTCodigoMensajes.MENSAJE022);
                            }
                        }
                        else
                        {
                            DTResultadoModelCarga.Respuesta = false;
                            DTResultadoModelCarga.Mensaje   = DTMensaje.ObtenerObjetoMensaje(DTCodigoMensajes.MENSAJE004);
                        }
                    }
                    else
                    {
                        DTResultadoModelCarga.Respuesta = false;
                        DTResultadoModelCarga.Mensaje   = DTMensaje.ObtenerObjetoMensaje(DTCodigoMensajes.MENSAJE002);
                    }
                }
                else
                {
                    DTResultadoModelCarga.Respuesta = false;
                    DTResultadoModelCarga.Mensaje   = DTMensaje.ObtenerObjetoMensaje(DTCodigoMensajes.MENSAJE004);
                }
            }
            catch (Exception ex)
            {
                DTResultadoModelCarga.Respuesta = false;
                DTResultadoModelCarga.Mensaje   = DTMensaje.ObtenerObjetoMensaje(DTCodigoMensajes.MENSAJE001);
                GestorLog.RegistrarLogExcepcion(ex);
            }
            JavaScriptSerializer serializer = new JavaScriptSerializer();

            return(serializer.Serialize(DTResultadoModelCarga));
        }