示例#1
0
        public ActionResult MontarTelaTarefaKanban(Int32?id)
        {
            // Controle Acesso
            if ((String)Session["Ativa"] == null)
            {
                return(RedirectToAction("Login", "ControleAcesso"));
            }
            Int32   idAss   = (Int32)Session["IdAssinante"];
            USUARIO usuario = new USUARIO();

            if ((USUARIO)Session["UserCredentials"] != null)
            {
                usuario = (USUARIO)Session["UserCredentials"];
            }
            else
            {
                return(RedirectToAction("Login", "ControleAcesso"));
            }

            // Carrega listas
            if (Session["ListaTarefa"] == null)
            {
                listaMaster            = baseApp.GetByUser(usuario.USUA_CD_ID);
                Session["ListaTarefa"] = listaMaster;
            }

            if (id == null)
            {
                ViewBag.Listas = listaMaster;
            }
            else
            {
                ViewBag.Listas = baseApp.GetByUser(usuario.USUA_CD_ID).Where(x => x.TARE_DT_REALIZADA == null).ToList();
            }

            ViewBag.Title = "Tarefas";

            // Indicadores
            ViewBag.Tarefas           = listaMaster.Count;
            ViewBag.Tipos             = new SelectList(baseApp.GetAllTipos(idAss), "TITR_CD_ID", "TITR_NM_NOME");
            ViewBag.TarefasPendentes  = baseApp.GetTarefaStatus(usuario.USUA_CD_ID, 1).Count;
            ViewBag.TarefasEncerradas = baseApp.GetTarefaStatus(usuario.USUA_CD_ID, 2).Count;

            List <SelectListItem> status = new List <SelectListItem>();

            status.Add(new SelectListItem()
            {
                Text = "Pendente", Value = "1"
            });
            status.Add(new SelectListItem()
            {
                Text = "Suspensa", Value = "2"
            });
            status.Add(new SelectListItem()
            {
                Text = "Cancelada", Value = "3"
            });
            status.Add(new SelectListItem()
            {
                Text = "Encerrada", Value = "4"
            });
            ViewBag.Status = new SelectList(status, "Value", "Text");

            // Mensagem
            if ((Int32)Session["MensTarefa"] == 1)
            {
                ModelState.AddModelError("", GED_Resources.ResourceManager.GetString("M0016", CultureInfo.CurrentCulture));
            }

            // Abre view
            Session["MensTarefa"] = 0;
            objeto = new TAREFA();
            objeto.TARE_DT_CADASTRO = DateTime.Today.Date;
            return(View(objeto));
        }