コード例 #1
0
        public ActionResult MontarTelaUsuario()
        {
            // Carrega listas
            Int32   idAss   = (Int32)Session["IdAssinante"];
            USUARIO usuario = new USUARIO();

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

            if ((List <NOTICIA>)Session["ListaNoticia"] == null)
            {
                listaMaster             = baseApp.GetAllItensValidos(idAss);
                Session["ListaNoticia"] = listaMaster;
            }
            ViewBag.Listas = (List <NOTICIA>)Session["ListaNoticia"];
            ViewBag.Perfil = usuario.PERFIL.PERF_SG_SIGLA;
            ViewBag.Title  = "Notícias";

            // Indicadores
            ViewBag.Noticias = ((List <NOTICIA>)Session["ListaNoticia"]).Count;

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

            // Abre view
            Session["MensNoticia"] = 0;
            objeto = new NOTICIA();
            return(View(objeto));
        }
コード例 #2
0
        public ActionResult CarregarBase()
        {
            if ((String)Session["Ativa"] == null)
            {
                return(RedirectToAction("Login", "ControleAcesso"));
            }

            // Carrega listas
            Int32?idAss = (Int32)Session["IdAssinante"];

            if ((Int32)Session["Login"] == 1)
            {
                Session["Perfis"]       = baseApp.GetAllPerfis();
                Session["Usuarios"]     = usuApp.GetAllUsuarios(idAss.Value);
                Session["UFs"]          = usuApp.GetAllUF();
                Session["TiposPessoas"] = tpApp.GetAllItens();
            }
            Session["MensTarefa"]       = 0;
            Session["MensNoticia"]      = 0;
            Session["MensNotificacao"]  = 0;
            Session["MensUsuario"]      = 0;
            Session["MensLog"]          = 0;
            Session["MensUsuarioAdm"]   = 0;
            Session["MensAgenda"]       = 0;
            Session["MensTemplate"]     = 0;
            Session["MensConfiguracao"] = 0;
            Session["MensTelefone"]     = 0;
            Session["MensGrupo"]        = 0;
            Session["MensSubGrupo"]     = 0;
            Session["MensTab"]          = 0;

            USUARIO          usu = (USUARIO)Session["Usuario"];
            UsuarioViewModel vm  = Mapper.Map <USUARIO, UsuarioViewModel>(usu);

            List <NOTIFICACAO> lista = usu.NOTIFICACAO.ToList();

            Session["Notificacoes"]      = lista;
            Session["ListaNovas"]        = lista.Where(p => p.NOTI_IN_VISTA == 0).ToList();
            ViewBag.ListaNovas           = (List <NOTIFICACAO>)Session["ListaNovas"];
            Session["NovasNotificacoes"] = lista.Where(p => p.NOTI_IN_VISTA == 0).Count();
            Session["Nome"]             = usu.USUA_NM_NOME;
            ViewBag.NovasNotificacoes   = lista.Where(p => p.NOTI_IN_VISTA == 0).Count();
            Session["VoltaNotificacao"] = 3;

            List <NOTICIA> lista1 = notiApp.GetAllItensValidos(idAss.Value);

            Session["Noticias"]       = lista1;
            Session["NoticiasNumero"] = lista1.Count;
            ViewBag.NoticiasNumero    = lista1.Count;
            ViewBag.Noticias          = lista1;

            List <TAREFA> lista2 = tarApp.GetTarefaStatus(usu.USUA_CD_ID, 1);

            Session["ListaPendentes"]   = lista2;
            Session["TarefasPendentes"] = lista2.Count;
            List <TAREFA> lista3 = tarApp.GetByUser(usu.USUA_CD_ID);

            Session["TarefasLista"]  = lista3;
            Session["Tarefas"]       = lista3.Count;
            ViewBag.TarefasPendentes = lista2.Count;
            ViewBag.Tarefas          = lista3.Count;

            List <AGENDA> lista4 = usu.AGENDA.ToList();

            Session["Agendas"]        = lista4;
            Session["NumAgendas"]     = lista4.Count;
            Session["AgendasHoje"]    = lista4.Where(p => p.AGEN_DT_DATA == DateTime.Today.Date).ToList();
            Session["NumAgendasHoje"] = lista4.Where(p => p.AGEN_DT_DATA == DateTime.Today.Date).ToList().Count;
            ViewBag.NumAgendas        = lista4.Count;
            ViewBag.NumAgendasHoje    = lista4.Where(p => p.AGEN_DT_DATA == DateTime.Today.Date).ToList().Count;

            Session["Logs"] = usu.LOG.Count;
            ViewBag.Logs    = usu.LOG.Count;

            String frase = String.Empty;
            String nome  = usu.USUA_NM_NOME.Substring(0, usu.USUA_NM_NOME.IndexOf(" "));

            if (DateTime.Now.Hour <= 12)
            {
                frase = "Bom dia, " + nome;
            }
            else if (DateTime.Now.Hour > 12 & DateTime.Now.Hour <= 18)
            {
                frase = "Boa tarde, " + nome;
            }
            else
            {
                frase = "Boa noite, " + nome;
            }
            Session["Greeting"] = frase;
            Session["Foto"]     = usu.USUA_AQ_FOTO;
            Session["ErroSoma"] = 0;
            ViewBag.Greeting    = frase;
            ViewBag.Foto        = usu.USUA_AQ_FOTO;

            // Mensagens
            if ((Int32)Session["MensNotificacao"] == 2)
            {
                ModelState.AddModelError("", GED_Resources.ResourceManager.GetString("M0011", CultureInfo.CurrentCulture));
            }
            if ((Int32)Session["MensNoticia"] == 2)
            {
                ModelState.AddModelError("", GED_Resources.ResourceManager.GetString("M0011", CultureInfo.CurrentCulture));
            }
            if ((Int32)Session["MensUsuario"] == 2)
            {
                ModelState.AddModelError("", GED_Resources.ResourceManager.GetString("M0011", CultureInfo.CurrentCulture));
            }
            if ((Int32)Session["MensLog"] == 2)
            {
                ModelState.AddModelError("", GED_Resources.ResourceManager.GetString("M0011", CultureInfo.CurrentCulture));
            }
            if ((Int32)Session["MensUsuarioAdm"] == 2)
            {
                ModelState.AddModelError("", GED_Resources.ResourceManager.GetString("M0011", CultureInfo.CurrentCulture));
            }
            if ((Int32)Session["MensTemplate"] == 2)
            {
                ModelState.AddModelError("", GED_Resources.ResourceManager.GetString("M0011", CultureInfo.CurrentCulture));
            }
            if ((Int32)Session["MensConfiguracao"] == 2)
            {
                ModelState.AddModelError("", GED_Resources.ResourceManager.GetString("M0011", CultureInfo.CurrentCulture));
            }
            if ((Int32)Session["MensGrupo"] == 2)
            {
                ModelState.AddModelError("", GED_Resources.ResourceManager.GetString("M0011", CultureInfo.CurrentCulture));
            }
            if ((Int32)Session["MensSubGrupo"] == 2)
            {
                ModelState.AddModelError("", GED_Resources.ResourceManager.GetString("M0011", CultureInfo.CurrentCulture));
            }
            if ((Int32)Session["MensTab"] == 2)
            {
                ModelState.AddModelError("", GED_Resources.ResourceManager.GetString("M0011", CultureInfo.CurrentCulture));
            }
            return(View(vm));
        }
コード例 #3
0
        public ActionResult CarregarBase()
        {
            // Carrega listas
            USUARIO usu   = (USUARIO)Session["UserCredentials"];
            Int32?  idAss = (Int32)Session["IdAssinante"];

            Session["Perfis"]      = baseApp.GetAllPerfis();
            Session["Usuarios"]    = usuApp.GetAllUsuarios(idAss);
            Session["UFs"]         = baseApp.GetAllUF();
            Session["TiposPessoa"] = baseApp.GetAllTiposPessoa();
            Session["Cargos"]      = carApp.GetAllItens();

            Session["ListaUsuario"]     = null;
            Session["MensUsuario"]      = 0;
            Session["ListaLog"]         = null;
            Session["MensLog"]          = 0;
            Session["ListaNoticia"]     = null;
            Session["MensNoticia"]      = 0;
            Session["MensAcesso"]       = 0;
            Session["MensNotificacao"]  = 0;
            Session["VoltaNotificacao"] = 1;
            Session["ListaNotificacao"] = null;
            Session["IdVolta"]          = 0;

            UsuarioViewModel vm = Mapper.Map <USUARIO, UsuarioViewModel>(usu);

            Session["Notificacoes"]      = baseApp.GetAllItensUser(usu.USUA_CD_ID, idAss);
            Session["ListasNovas"]       = baseApp.GetNotificacaoNovas(usu.USUA_CD_ID, idAss);
            Session["NovasNotificacoes"] = ((List <NOTIFICACAO>)Session["Notificacoes"]).Where(p => p.NOTI_IN_VISTA == 0).Count();
            Session["Nome"] = usu.USUA_NM_NOME;
            if ((Int32)Session["NovasNotificacoes"] > 0)
            {
                ModelState.AddModelError("", ERP_Condominio.ResourceManager.GetString("M0093", CultureInfo.CurrentCulture));
            }

            Session["Noticias"]       = notiApp.GetAllItensValidos();
            Session["NoticiasNumero"] = ((List <NOTICIA>)Session["Noticias"]).Count;

            Session["Logs"] = logApp.GetAllItensUsuario(usu.USUA_CD_ID, idAss).Count;

            ViewBag.Logs = (Int32)Session["Logs"];
            ViewBag.NovasNotificacoes = (Int32)Session["NovasNotificacoes"];
            ViewBag.NoticiasNumero    = (Int32)Session["NoticiasNumero"];
            ViewBag.Noticias          = ((List <NOTICIA>)Session["Noticias"]).ToList();

            String frase = String.Empty;
            String nome  = usu.USUA_NM_NOME.Substring(0, usu.USUA_NM_NOME.IndexOf(" "));

            if (DateTime.Now.Hour <= 12)
            {
                frase = "Bom dia, " + nome;
            }
            else if (DateTime.Now.Hour > 12 & DateTime.Now.Hour <= 18)
            {
                frase = "Boa tarde, " + nome;
            }
            else
            {
                frase = "Boa noite, " + nome;
            }
            Session["Greeting"] = frase;
            Session["Foto"]     = usu.USUA_AQ_FOTO;

            return(View(vm));
        }
コード例 #4
0
        public ActionResult CarregarBase()
        {
            // Carrega listas
            Int32?idAss = (Int32)Session["IdAssinante"];

            SessionMocks.Perfis      = baseApp.GetAllPerfis();
            SessionMocks.UFs         = baseApp.GetAllUF();
            Session["MensAssinante"] = 0;
            Session["Perfis"]        = baseApp.GetAllPerfis();
            Session["UFs"]           = baseApp.GetAllUF();
            Session["Origens"]       = oriApp.GetAllItens();
            Session["Profissoes"]    = proApp.GetAllItens();
            Session["Clubes"]        = cluApp.GetAllItens();
            Session["CatContatos"]   = ccApp.GetAllItens();

            Session["ListaUsuario"]     = null;
            Session["MensUsuario"]      = 0;
            Session["ListaLog"]         = null;
            Session["MensLog"]          = 0;
            Session["ListaNoticia"]     = null;
            Session["MensNoticia"]      = 0;
            Session["MensAcesso"]       = 0;
            Session["MensNotificacao"]  = 0;
            Session["VoltaNotificacao"] = 1;
            Session["ListaNotificacao"] = null;
            Session["ListaContato"]     = null;
            Session["MensContato"]      = 0;
            Session["ListaCatCont"]     = null;
            Session["ListaGrupo"]       = null;
            Session["MensGrupo"]        = 0;
            Session["ListaCampanha"]    = null;
            Session["MensCampanha"]     = 0;
            Session["ListaTemplate"]    = null;
            Session["MensTemplate"]     = 0;
            Session["MensCatCont"]      = 0;
            Session["ListaClube"]       = null;
            Session["MensClube"]        = 0;
            Session["ListaOrigem"]      = null;
            Session["MensOrigem"]       = 0;
            Session["ListaProfissao"]   = null;
            Session["MensProfissao"]    = 0;
            Session["ListaUsuarioAdm"]  = null;
            Session["MensUsuarioAdm"]   = 0;
            Session["Configuracao"]     = null;
            Session["MensConfiguracao"] = 0;
            Session["ListaMensagem"]    = null;
            Session["MensMensagem"]     = 0;
            Session["Resposta"]         = null;

            USUARIO          usu = usuApp.GetItemById((Int32)Session["IdUsuario"]);
            UsuarioViewModel vm  = Mapper.Map <USUARIO, UsuarioViewModel>(usu);

            Session["Perfil"]            = usu.PERFIL.PERF_SG_SIGLA;
            Session["Notificacoes"]      = baseApp.GetAllItensUser(usu.USUA_CD_ID, idAss);
            Session["ListasNovas"]       = baseApp.GetNotificacaoNovas(usu.USUA_CD_ID, idAss);
            Session["NovasNotificacoes"] = ((List <NOTIFICACAO>)Session["Notificacoes"]).Where(p => p.NOTI_IN_VISTA == 0).Count();
            Session["Nome"]           = usu.USUA_NM_NOME;
            ViewBag.Notificacoes      = (List <NOTIFICACAO>)Session["Notificacoes"];
            ViewBag.ListasNovas       = (List <NOTIFICACAO>)Session["ListasNovas"];
            ViewBag.NovasNotificacoes = (Int32)Session["NovasNotificacoes"];
            ViewBag.Nome = (String)Session["Nome"];

            if ((Int32)Session["NovasNotificacoes"] > 0)
            {
                ModelState.AddModelError("", SMS_Resource.ResourceManager.GetString("M0015", CultureInfo.CurrentCulture));
            }

            Session["Noticias"]       = notiApp.GetAllItensValidos();
            Session["NoticiasNumero"] = ((List <NOTICIA>)Session["Noticias"]).Count;
            ViewBag.Noticias          = (List <NOTICIA>)Session["Noticias"];
            ViewBag.NoticiasNumero    = (Int32)Session["NoticiasNumero"];

            Session["Logs"]     = logApp.GetAllItensUsuario(usu.USUA_CD_ID, idAss).Count;
            ViewBag.Logs        = (Int32)Session["Logs"];
            ViewBag.SaldoSC     = 1987;
            ViewBag.SaldoLC     = 520;
            ViewBag.EnviadosSC  = 349;
            ViewBag.EnviadosLC  = 432;
            ViewBag.Entregue    = 30;
            ViewBag.Rejeitado   = 1;
            ViewBag.Pendente    = 22;
            ViewBag.Expirado    = 0;
            ViewBag.NaoEntregue = 0;

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

            camp.Add(new SelectListItem()
            {
                Text = "Camapnha 1", Value = "1"
            });
            camp.Add(new SelectListItem()
            {
                Text = "Campanha 2", Value = "2"
            });
            camp.Add(new SelectListItem()
            {
                Text = "Campanha 3", Value = "3"
            });
            ViewBag.Campanhas = new SelectList(camp, "Value", "Text");

            String frase = String.Empty;
            String nome  = usu.USUA_NM_NOME.Substring(0, usu.USUA_NM_NOME.IndexOf(" "));

            if (DateTime.Now.Hour <= 12)
            {
                frase = "Bom dia, " + nome;
            }
            else if (DateTime.Now.Hour > 12 & DateTime.Now.Hour <= 18)
            {
                frase = "Boa tarde, " + nome;
            }
            else
            {
                frase = "Boa noite, " + nome;
            }
            ViewBag.Greetings = frase;
            Session["Foto"]   = usu.USUA_AQ_FOTO;
            ViewBag.Foto      = usu.USUA_AQ_FOTO;
            Session["Ativa"]  = "1";
            return(View(vm));
        }