コード例 #1
0
        public async Task <ActionResult <ReciboResponse> > Post([FromBody] RecibosDTO recibo)
        {
            Logger.Information($"Se recibio posteo de nuevo recibo {recibo.CodigoComprobanteAGenerar} - " +
                               $"Id de operacion: {recibo.IdOperacion}");

            int idOperacion = recibo.IdOperacion;

            if (Env.IsProduction())
            {
                if (int.TryParse(recibo.Cliente, out _))
                {
                    recibo.Cliente = string.Format("{0:00000000}", int.Parse(recibo.Cliente));
                }
                ;
                if (int.TryParse(recibo.CodigoSubcuenta, out _))
                {
                    recibo.CodigoSubcuenta = string.Format("{0:00000000}", int.Parse(recibo.CodigoSubcuenta));
                }
            }


            Vtrrch reciboFormat = Mapper.Map <RecibosDTO, Vtrrch>(recibo);

            if (!ModelState.IsValid)
            {
                ModelState.AddModelError("Error", "Error de formato");
            }

            ReciboResponse response = recibo.TipoMovimiento == "R" ? await Repository.GraboRecibo(reciboFormat, "RUN_FOR_SCRIPT") :
                                      await Repository.GraboAnulacion(reciboFormat, "NEW");

            response.IdOperacion = idOperacion;

            if (response.Estado != 200)
            {
                return(BadRequest(response));
            }

            return(Ok(response));
        }
コード例 #2
0
        public async Task <ActionResult <ReciboResponse> > Post([FromBody] RecibosDTO anulacionRecibo)
        {
            Logger.Information($"Se recibio posteo de nuevo anulacionRecibo {anulacionRecibo.CodigoComprobanteAGenerar} - " +
                               $"Id de operacion: {anulacionRecibo.IdOperacion}");

            int idOperacion = anulacionRecibo.IdOperacion;


            if (!ModelState.IsValid)
            {
                ModelState.AddModelError("Error", "Error de formato");
            }

            ReciboResponse response = await Repository.GraboAnulacionRecibo(anulacionRecibo, "RUN_FOR_SCRIPT");

            response.IdOperacion = idOperacion;

            if (response.Estado != 200)
            {
                return(BadRequest(response));
            }

            return(Ok(response));
        }