public ActionResult Index()
        {
            if (Session.Count <= 0)
            {
                return(RedirectToAction("Logout", "Auth"));
            }

            ViewBag.Title = "SICS - WEB";
            Models.DAO.Connection cm = new Models.DAO.Connection();
            cm.conecta();
            return(View());
        }
Exemplo n.º 2
0
        public ActionResult Reagentes()
        {
            if (Session.Count <= 0)
            {
                return(RedirectToAction("Logout", "Auth"));
            }

            if (!(int.Parse(Session["Role"].ToString()) == 000))
            {
                gDAO = new Models.DAO.GrupoDAO();
                oDAO = new Models.DAO.OrgaoDAO();

                con = new Models.DAO.Connection();

                if (con.statusconexao() != 1)
                {
                    con.conecta();
                }
                var                   vmodel = new Models.ViewModels.CadastroReagenteViewModel();
                DataTable             dt     = gDAO.select();
                List <SelectListItem> ls     = new List <SelectListItem>();
                foreach (DataRow item in dt.Rows)
                {
                    SelectListItem sl = new SelectListItem();
                    sl.Text  = item["desc_grupo"].ToString();
                    sl.Value = item["id_grupo"].ToString();
                    ls.Add(sl);
                }

                DataTable             dp = oDAO.select();
                List <SelectListItem> la = new List <SelectListItem>();
                foreach (DataRow item in dp.Rows)
                {
                    SelectListItem gr = new SelectListItem();
                    gr.Value = item["id_orgao"].ToString();
                    gr.Text  = item["desc_orgao"].ToString();
                    la.Add(gr);
                }

                vmodel.listOrgao = la;
                vmodel.Grupo     = ls;
                return(View(vmodel));
            }



            return(RedirectToRoute(new { controller = "Home", action = "Erro", id = 1 }));
        }