Example #1
0
        public Task <List <HuellaDTO> > CompletarCompensacion(HuellaDTO oHuella)
        {
            var huella = (from i in entity.DetalleHuella
                          join h in entity.Huella on i.IdHuella equals h.IdHuella
                          join p in entity.Proyecto on h.IdProyecto equals p.IdProyecto
                          where p.IdProyecto == oHuella.IdProyecto
                          select i).FirstOrDefault();


            var detalle = new DetalleHuella
            {
                IdHuella   = huella.IdHuella,
                Porcentaje = 100 - huella.Porcentaje,
                //Estado = false
            };

            var proye = (from i in entity.Huella
                         where i.IdProyecto == oHuella.IdProyecto
                         select i).FirstOrDefault();

            var empresa = (from i in entity.Proyecto
                           where i.IdProyecto == oHuella.IdProyecto
                           select i.IdEmpresa).FirstOrDefault();

            proye.EstadoCompensacion = false;

            entity.DetalleHuella.Add(detalle);
            entity.SaveChanges();

            return(ListaProyectos(empresa));
        }
Example #2
0
        public Task <bool> Guardarcalculo(HuellaDTO oHuella)
        {
            var huella = new Huella
            {
                IdProyecto            = oHuella.IdProyecto,
                Toneledas             = oHuella.Toneledas,
                Fecha                 = oHuella.Fecha,
                Precisar              = oHuella.Precisar,
                TipoArbol             = oHuella.TipoArbol,
                Zona                  = oHuella.Zona,
                EstadoCompensacion    = false,
                Area                  = oHuella.Area,
                Cant_arboles          = oHuella.Cant_arboles,
                DensidadArbolHectarea = oHuella.DensidadArbolHectarea
            };

            entity.Huella.Add(huella);
            entity.SaveChanges();

            var detalle = new DetalleHuella
            {
                IdHuella   = huella.IdHuella,
                Porcentaje = oHuella.Porcentaje,
                //Estado = oHuella.Estado
            };

            entity.DetalleHuella.Add(detalle);
            entity.SaveChanges();

            return(Task.FromResult <bool>(true));
        }
Example #3
0
        public async Task <List <HuellaDTO> > CompletarCompensacion(HuellaDTO oHuella)
        {
            try
            {
                ProyectoBl oProyectoBl = new ProyectoBl();
                var        response    = await oProyectoBl.CompletarCompensacion(oHuella);

                return(response);
            }
            catch (Exception e)
            {
                throw;
            }
        }
Example #4
0
        public async Task <bool> Guardarcalculo(HuellaDTO oHuella)
        {
            try
            {
                ProyectoBl oProyectoBl = new ProyectoBl();
                var        response    = await oProyectoBl.Guardarcalculo(oHuella);

                return(response);
            }
            catch (Exception e)
            {
                throw;
            }
        }