public HttpResponseMessage Get()
        {
            Exoneracion exoneracion = new Exoneracion();

            HttpResponseMessage response = Request.CreateResponse <List <Models.Exoneracion> >(HttpStatusCode.Created, exoneracion.Select_Todo_Exoneracion());

            return(response);
        }
Example #2
0
        /// <summary>
        /// actualiza un registro
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ASPxGridView1_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            try
            {
                using (var conexion = new DataModelFE())
                {
                    // se declara el objeto a insertar
                    Exoneracion dato = new Exoneracion();
                    //llena el objeto con los valores de la pantalla
                    dato.codigo = e.NewValues["codigo"] != null ? e.NewValues["codigo"].ToString().ToUpper() : null;

                    //busca el objeto
                    dato = conexion.Exoneracion.Find(dato.codigo);

                    dato.descripcion         = e.NewValues["descripcion"] != null ? e.NewValues["descripcion"].ToString().ToUpper() : null;
                    dato.estado              = e.NewValues["estado"].ToString();
                    dato.usuarioModificacion = Session["usuario"].ToString();
                    dato.fechaModificacion   = Date.DateTimeNow();

                    //modifica objeto
                    conexion.Entry(dato).State = EntityState.Modified;
                    conexion.SaveChanges();

                    //esto es para el manero del devexpress
                    e.Cancel = true;
                    this.ASPxGridView1.CancelEdit();
                }
            }
            catch (DbEntityValidationException ex)
            {
                // Retrieve the error messages as a list of strings.
                var errorMessages = ex.EntityValidationErrors
                                    .SelectMany(x => x.ValidationErrors)
                                    .Select(x => x.ErrorMessage);

                // Join the list to a single string.
                var fullErrorMessage = string.Join("; ", errorMessages);
                // Throw a new DbEntityValidationException with the improved exception message.
                throw new DbEntityValidationException(fullErrorMessage, ex.EntityValidationErrors);
            }
            catch (Exception ex)
            {
                throw new Exception(Utilidades.validarExepcionSQL(ex), ex.InnerException);
            }
            finally
            {
                //refescar los datos
                this.refreshData();
            }
        }
        public HttpResponseMessage Delete(FormDataCollection form)
        {
            Exoneracion exoneracion = new Exoneracion();

            exoneracion.TipoDocumento1   = form.Get("TipoDoc");
            exoneracion.NumeroDocumento1 = form.Get("NumDoc");

            string[] respuesta = new string[3];
            respuesta[0] = exoneracion.Delete_Exoneracion();
            respuesta[1] = form.Get("TipoDoc");
            respuesta[2] = form.Get("NumDoc");

            HttpResponseMessage response = Request.CreateResponse <string[]>(HttpStatusCode.Created, respuesta);

            return(response);
        }
Example #4
0
        private Exoneracion ParsearExoneracion(ExoneracionSistema exoSis)
        {
            if (exoSis == null)
            {
                return(null);
            }
            var exo = new Exoneracion
            {
                FechaEmision          = exoSis.FechaEmision,
                MontoExoneracion      = exoSis.MontoExoneracion,
                NombreInstitucion     = exoSis.NombreInstitucion,
                NumeroDocumento       = exoSis.NumeroDocumento,
                PorcentajeExoneracion = exoSis.PorcentajeExoneracion,
                TipoDocumento         = ModFunciones.ObtenerValorEnumerador(exoSis.TipoDocumento, Exoneracion.ExoneracionTipoDoc.Item99)
            };

            return(exo);
        }
        public HttpResponseMessage Put(FormDataCollection form)
        {
            Exoneracion exoneracion = new Exoneracion();

            exoneracion.TipoDocumento1         = form.Get("TipoDoc");
            exoneracion.NumeroDocumento1       = form.Get("NumDoc");
            exoneracion.NombreInstitucion1     = form.Get("NomIns");
            exoneracion.FechaEmision1          = Convert.ToDateTime(form.Get("FechaEmision"));
            exoneracion.PorcentajeExoneracion1 = Convert.ToInt32(form.Get("Porcentaje"));
            exoneracion.MontoExoneracion1      = Convert.ToDecimal(form.Get("Monto"));

            string[] respuesta = new string[3];
            respuesta[0] = exoneracion.Insert_Exoneracion();
            respuesta[1] = form.Get("TipoDoc");
            respuesta[2] = form.Get("NumDoc");

            HttpResponseMessage response = Request.CreateResponse <string[]>(HttpStatusCode.Created, respuesta);

            return(response);
        }
        public HttpResponseMessage Put(FormDataCollection form)
        {
            LineaDetalle lineadetalle = new LineaDetalle();

            lineadetalle.NumeroLinea1           = Convert.ToInt32(form.Get("NumeroLinea"));
            lineadetalle.PartidaArancelaria1    = form.Get("PartidaArancelaria");
            lineadetalle.Codigo1                = form.Get("Codigo");
            lineadetalle.Cantidad1              = Convert.ToDecimal(form.Get("Cantidad").Replace('.', ','));
            lineadetalle.UnidadMedida1          = form.Get("UnidadMedida");
            lineadetalle.UnidadMedidaComercial1 = form.Get("UnidadMedidaComercial");
            lineadetalle.Detalle1               = form.Get("Detalle");
            lineadetalle.PrecioUnitario1        = Convert.ToDecimal(form.Get("PrecioUnitario").Replace('.', ','));
            lineadetalle.MontoTotal1            = Convert.ToDecimal(form.Get("MontoTotal").Replace('.', ','));
            lineadetalle.Subtotal1              = Convert.ToDecimal(form.Get("Subtotal").Replace('.', ','));
            lineadetalle.BaseImponible1         = Convert.ToDecimal(form.Get("BaseImponible").Replace('.', ','));
            lineadetalle.ImpuestoNeto1          = Convert.ToDecimal(form.Get("ImpuestoNeto").Replace('.', ','));
            lineadetalle.MontoTotalLinea1       = Convert.ToDecimal(form.Get("MontoTotalLinea").Replace('.', ','));
            lineadetalle.Consecutivo1           = Convert.ToInt32(form.Get("Consecutivo"));

            Descuento monto = new Descuento();

            monto.MontoDescuento1        = Convert.ToDecimal(form.Get("MontoDescuento"));
            lineadetalle.MontoDescuento1 = monto;

            Descuento naturaleza = new Descuento();

            naturaleza.NaturalezaDescuento   = form.Get("NaturalezaDescuento");
            lineadetalle.NaturalezaDescuento = naturaleza;

            CodigoComercial tipo = new CodigoComercial();

            tipo.Tipo1 = form.Get("CodigoComercialTipo");
            lineadetalle.CodigoComercialTipo1 = tipo;

            CodigoComercial codigo = new CodigoComercial();

            codigo.Codigo1 = form.Get("CodigoComercialCodigo");
            lineadetalle.CodigoComercialCodigo1 = codigo;


            JArray jObject = JArray.Parse(form.Get("ListaActualDeLineaDetalle_Impuesto_Exoneracion"));
            JToken jUser   = jObject;
            var    lista   = jUser.ToObject <List <LineaDetalle_Impuesto_Exoneracion_Local> >();
            List <Models.LineaDetalle_Impuesto_Exoneracion> lineadetalle_impuesto_s = new List <LineaDetalle_Impuesto_Exoneracion>();

            foreach (var item in lista)
            {
                Impuesto impuesto = new Impuesto();
                impuesto.Codigo1 = item.ImpuestoCodigo;
                Exoneracion exoneracion = new Exoneracion();
                exoneracion.TipoDocumento1   = item.TipoDocumento;
                exoneracion.NumeroDocumento1 = item.NumeroDocumento;
                LineaDetalle_Impuesto_Exoneracion lineadetalle_impuesto_exoneracion = new LineaDetalle_Impuesto_Exoneracion();
                lineadetalle_impuesto_exoneracion.NumeroDocumento1 = exoneracion;
                lineadetalle_impuesto_exoneracion.TipoDocumento1   = exoneracion;
                lineadetalle_impuesto_exoneracion.ImpuestoCodigo1  = impuesto;
                lineadetalle_impuesto_s.Add(lineadetalle_impuesto_exoneracion);
            }

            lineadetalle.ListaLineaDetalleImpuestoExoneracion1 = lineadetalle_impuesto_s;
            string[] respuesta = new string[2];
            respuesta[0] = lineadetalle.Insert_LineaDetalle();
            respuesta[1] = form.Get("Consecutivo");

            HttpResponseMessage response = Request.CreateResponse <string[]>(HttpStatusCode.Created, respuesta);

            return(response);
        }