Beispiel #1
0
        public ActionResult ModelarTablero(int id, string callBack = "SetModelarTablero")
        {
            try
            {
                _estructuraAreaLogica      = new EstructuraAreaLogica();
                _estructuraInstanciaLogica = new EstructuraInstanciaLogica();

                Estructura model = new Estructura {
                    Id = id
                };
                model.Areas      = _estructuraAreaLogica.Listar(id) ?? new List <EstructuraArea>();
                model.Instancias = _estructuraInstanciaLogica.Listar(id) ?? new List <EstructuraInstancia>();

                _instanciaLogica   = new InstanciaLogica();
                ViewBag.Instancias = _instanciaLogica.Listar() ?? new List <Instancia>();

                _areaLogica   = new AreaLogica();
                ViewBag.Areas = _areaLogica.Listar() ?? new List <Area>();

                ViewBag.CallBack = callBack;

                return(PartialView("_ModelarTablero", model));
            }
            catch (Exception ex)
            {
                Response.StatusCode = (int)HttpStatusCode.BadRequest;
                ViewBag.Message     = ex.Message;
                return(PartialView("_Error"));
            }
        }
Beispiel #2
0
        public ActionResult Nuevo(int?padreId, string callBack = "SetEstructura")
        {
            Estructura model = new Estructura {
                PadreId = padreId
            };

            try
            {
                _areaLogica   = new AreaLogica();
                ViewBag.Areas = _areaLogica.Listar();

                ViewBag.CallBack = callBack;
                return(PartialView("_Nuevo", model));
            }
            catch (Exception ex)
            {
                Response.StatusCode = (int)HttpStatusCode.BadRequest;
                ViewBag.Message     = ex.Message;
                return(PartialView("_Error"));
            }
        }
Beispiel #3
0
 public ActionResult Listar()
 {
     try
     {
         _areaLogica = new AreaLogica();
         List <Area> lista     = _areaLogica.Listar() ?? new List <Area>();
         string      respuesta = JsonConvert.SerializeObject(lista.Select(x => new
         {
             x.Id,
             x.Codigo,
             x.Descripcion
         }));
         return(Content(respuesta, "application/json"));
     }
     catch (Exception ex)
     {
         Response.StatusCode = (int)HttpStatusCode.BadRequest;
         ViewBag.Message     = ex.Message;
         return(PartialView("_Error"));
     }
 }
Beispiel #4
0
        private void Inicio()
        {
            cbbArea.ResetText();
            DataTable dtArea = AreaLogica.Listar();

            cbbArea.DataSource    = dtArea;
            cbbArea.ValueMember   = "area";
            cbbArea.DisplayMember = "area";
            cbbArea.SelectedIndex = -1;

            cbbPlanta.ResetText();
            DataTable data = PlantaLogica.Listar();

            cbbPlanta.DataSource    = data;
            cbbPlanta.ValueMember   = "planta";
            cbbPlanta.DisplayMember = "nombre";
            cbbPlanta.SelectedIndex = -1;
            txtNombre.Clear();
            chbGlobal.Checked = false;

            cbbArea.Focus();
        }