public JsonResult PlanificacionIns(EPlanificacion entidadPlanificacion)
        {
            string xml = string.Empty;

            foreach (EPlanificacionSucursalAlmacen eps in entidadPlanificacion.ListaPlanificacionSucursalAlmacen)
            {
                if (eps.IdSucursalAlmacen == 0)
                {
                    return(Json(new ERespuesta {
                        Estado = 0, Mensaje = "Seleccionar el sucursal-almacén"
                    }));
                }
            }

            if (entidadPlanificacion.FechaInicioWithFormat == "01/01/0001")
            {
                return(Json(new ERespuesta {
                    Estado = 0, Mensaje = "Completar la fecha de ejecucion"
                }));
            }

            xml = ConvertToXML.Registrar_XML(entidadPlanificacion);

            ERespuesta objRespuesta = objPlanificacion.SIGESU_PlanificacionIns(xml);

            return(Json(objRespuesta));
        }
        public ERespuesta SIGESU_PlanificacionAct(EPlanificacion entidadPlanificacion)
        {
            try
            {
                using (var db = new SIGESUEntities())
                {
                    var result = db.SIGESU_PlanificacionAct(
                        entidadPlanificacion.IdPlanificacion,
                        entidadPlanificacion.NumeroPlanificacion,
                        entidadPlanificacion.FechaInicio,
                        entidadPlanificacion.FechaFin,
                        entidadPlanificacion.Remuestreo,
                        entidadPlanificacion.Observacion,
                        entidadPlanificacion.Estado,
                        entidadPlanificacion.IdEspecialista,
                        entidadPlanificacion.IdLaboratorio,
                        entidadPlanificacion.IdPlanificacionOrigen,
                        entidadPlanificacion.IdSucursalAlmacen
                        ).FirstOrDefault();

                    ERespuesta objRespuesta =
                        Mapper.Map <ERespuesta>(result);

                    return(objRespuesta);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
        public ActionResult ListarPlanificacionxIdPlanificacion(int IdPlanificacion)
        {
            EPlanificacion entidadPlanificacion = new EPlanificacion();

            entidadPlanificacion = objPlanificacion.SIGESU_PlanificacionSelxIdPlanificacion(IdPlanificacion);

            return(Json(entidadPlanificacion, JsonRequestBehavior.AllowGet));
        }
        public JsonResult PlanificacionActAprobado(int IdPlanificacion, string NumeroEstado)
        {
            EPlanificacion entidadPlanificacion = new EPlanificacion();

            entidadPlanificacion        = objPlanificacion.SIGESU_PlanificacionSelxIdPlanificacion(IdPlanificacion);
            entidadPlanificacion.Estado = NumeroEstado;
            ERespuesta objRespuesta = objPlanificacion.SIGESU_PlanificacionAct(entidadPlanificacion);

            return(Json(objRespuesta));
        }
 public ERespuesta SIGESU_PlanificacionAct(EPlanificacion entidadPlanificacion)
 {
     try
     {
         return(objPlanificacion.SIGESU_PlanificacionAct(entidadPlanificacion));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
        public JsonResult GrabarPropuesta(EPlanificacion entidadPlanificacion)
        {
            string           xml = string.Empty;
            List <EProducto> listaProductosPropuestos = new List <EProducto>();

            foreach (EPlanificacionSucursal eps in entidadPlanificacion.ListaPlanificacionSucursal)
            {
                if (eps.COD_SUCURSAL == null)
                {
                    return(Json(new Entidades.DTO_TP3.ERespuesta {
                        Estado = 0, Mensaje = "Seleccionar el sucursal"
                    }));
                }
            }

            if (entidadPlanificacion.FechaInicioWithFormat == "01/01/0001")
            {
                return(Json(new ERespuesta {
                    Estado = 0, Mensaje = "Completar la fecha inicio de ejecucion"
                }));
            }

            if (entidadPlanificacion.FechaFinWithFormat == "01/01/0001")
            {
                return(Json(new ERespuesta {
                    Estado = 0, Mensaje = "Completar la fecha fin de ejecucion"
                }));
            }

            //Obtener lista de productos propuestos.
            //En base a estas listas, se crearán dos tipos de planificaciones: Laboratorio y Campo

            listaProductosPropuestos = objProducto.GCPS_SP_ProductoEnPlanificacionSel();

            //PLANIFICACION TIPO LABORATORIO
            entidadPlanificacion.TipoPlanificacion = Constantes.TipoPlanificacion.LABORATORIO;
            entidadPlanificacion.detalleProductos  = listaProductosPropuestos.Where(x => x.TIPOPLAN.Equals(Constantes.TipoPlanificacion.LABORATORIO)).ToList();

            xml = ConvertToXML.Registrar_XML(entidadPlanificacion);

            objPlanificacion.GCPS_SP_PlanificacionIns(xml);


            //PLANIFICACION TIPO CAMPO
            entidadPlanificacion.TipoPlanificacion = Constantes.TipoPlanificacion.CAMPO;
            entidadPlanificacion.detalleProductos  = listaProductosPropuestos.Where(x => x.TIPOPLAN.Equals(Constantes.TipoPlanificacion.CAMPO)).ToList();;

            xml = ConvertToXML.Registrar_XML(entidadPlanificacion);

            ERespuesta objRespuesta = objPlanificacion.GCPS_SP_PlanificacionIns(xml);

            return(Json(objRespuesta));
        }
        public EPlanificacion SIGESU_PlanificacionSelxIdPlanificacion(int IdPlanificacion)
        {
            try
            {
                using (var db = new SIGESUEntities())
                {
                    var result = db.SIGESU_PlanificacionSelxIdPlanificacion(IdPlanificacion).FirstOrDefault();

                    EPlanificacion objPlanifacion =
                        Mapper.Map <EPlanificacion>(result);

                    return(objPlanifacion);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
        public JsonResult PlanificacionAct(EPlanificacion entidadPlanificacion)
        {
            ERespuesta objRespuesta = objPlanificacion.SIGESU_PlanificacionAct(entidadPlanificacion);

            return(Json(objRespuesta));
        }