Пример #1
0
        public JsonResult listaVariedades(int CAUCODIGOI, string fecha)
        {
            List <VARIEDADES> lista = new List <VARIEDADES>();
            List <VARIEDADES> l     = new List <VARIEDADES>();
            List <CONTROLES_FLOR_NACIONAL> listaDetalle = new List <CONTROLES_FLOR_NACIONAL>();
            string mensaje = "Correcto";
            bool   estado  = true;

            try
            {
                listaDetalle = objDAL.listaControlFlor(Convert.ToDateTime(fecha), CAUCODIGOI);
                lista        = objDAL.listaVariedades();
                foreach (var item in lista)
                {
                    VARIEDADES obj = new VARIEDADES();
                    obj.VRDCODIGOI = item.VRDCODIGOI;
                    obj.VRDNOMBREC = item.VRDNOMBREC;
                    l.Add(obj);
                }
            }
            catch (Exception ex)
            {
                mensaje = ex.Message;
                estado  = false;
            }

            return(Json(new { lista = l, listaDetalle = listaDetalle, mensaje = mensaje, estado = estado }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult CrearVariedad(VARIEDADES obj)
        {
            try
            {
                bool   respuesta;
                string mensaje = "Variedad creada correctamente";
                if (obj.VRDCODIGOI == 0)
                {
                    respuesta = objDAL.Crear_Variedad(obj, true);
                }
                else
                {
                    respuesta = objDAL.Crear_Variedad(obj, false);
                    mensaje   = "Variedad editado correctamente";
                }
                if (respuesta)
                {
                    Request.Flash("success", mensaje);
                }
            }
            catch (Exception exc)
            {
                Request.Flash("danger", "Ha ocurrido un error: " + exc.Message);
            }

            return(RedirectToAction("Index", "Variedades"));
        }
        public ActionResult CrearVariedad(int id = 0)
        {
            VARIEDADES obj = new VARIEDADES();

            if (id != 0)
            {
                obj = objDAL.Buscar_Variedad(id);
            }
            return(View(obj));
        }
        public JsonResult listaVariedades(int idTipoFlor, int idUnidad, int idProceso)
        {
            List <VARIEDADES> lista        = new List <VARIEDADES>();
            List <VARIEDADES> l            = new List <VARIEDADES>();
            List <Detalle>    listaDetalle = new List <Detalle>();
            string            mensaje      = "Correcto";
            DateTime          fecha;
            bool estado = true;

            try
            {
                if (idProceso == 0)
                {
                    fecha = DateTime.Now;
                }
                else
                {
                    fecha = objDAL.retornarFecha(idProceso);
                }
                listaDetalle = objDAL.listaDetalle(idTipoFlor, idUnidad, Convert.ToDateTime(fecha));
                lista        = objDAL.listaVariedades();
                foreach (var item in lista)
                {
                    VARIEDADES obj = new VARIEDADES();
                    obj.VRDCODIGOI = item.VRDCODIGOI;
                    obj.VRDNOMBREC = item.VRDNOMBREC;
                    l.Add(obj);
                }
            }
            catch (Exception ex)
            {
                mensaje = ex.Message;
                estado  = false;
            }

            return(Json(new { lista = l, listaDetalle = listaDetalle, mensaje = mensaje, estado = estado }, JsonRequestBehavior.AllowGet));
        }