Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["login"] == null)
            {
                Session.RemoveAll();
                Response.Redirect("../Pages/Login.aspx");
            }

            MODUsuario usuario = new MODUsuario();

            usuario.Login = PegaLogin.RetornaLogin();
            usuario       = BLLUsuario.PesquisarLogin(usuario);

            ImagemUser.ImageUrl  = "../Pages/" + usuario.Imagem;
            ImagemUser2.ImageUrl = "../Pages/" + usuario.Imagem;
            LblNome.Text         = usuario.Nome;

            if (usuario.FkTipo == 1)
            {
                LblFuncao.Text = "Administrador";
            }
            else
            {
                LblFuncao.Text = "Lider de Pesquisa";
            }

            MODArea_Conhecimento areaConhecimento = new MODArea_Conhecimento();

            List <MODArea_Conhecimento> lista = new List <MODArea_Conhecimento>();

            lista = BLLLinha_Pesquisa.PesquisarAreaConhecimento(areaConhecimento, "todas");

            RptConsulta.DataSource = lista;
            RptConsulta.DataBind();
        }
        private void CarregaAreaConhecimento()
        {
            MODArea_Conhecimento areaConhecimento = new MODArea_Conhecimento();

            TxtAreaConhecimento.DataSource     = BLLLinha_Pesquisa.PesquisarAreaConhecimento(areaConhecimento, "todas");
            TxtAreaConhecimento.DataValueField = "Id";
            TxtAreaConhecimento.DataTextField  = "Nome";
            TxtAreaConhecimento.DataBind();
        }
Esempio n. 3
0
        protected void BtnCadastrar_Click(object sender, EventArgs e)
        {
            MODArea_Conhecimento area = new MODArea_Conhecimento();

            area.Id   = TxtIdArea.Text.Trim();
            area.Nome = TxtAreaConhecimento.Text.Trim().ToUpper();

            List <MODArea_Conhecimento> lista = new List <MODArea_Conhecimento>();

            lista = BLLLinha_Pesquisa.PesquisarAreaConhecimento(area, "existente");

            if (TxtIdArea.Text.Trim() == "" || TxtIdArea.Text.Length > 10)
            {
                LblResposta.Text = Erros.CodigoVazio;
            }
            else if (TxtIdArea.Text.Length < 8)
            {
                LblResposta.Text = "O código deve ter ao menos 8 caracteres";
            }
            else if (TxtAreaConhecimento.Text.Trim() == "" || TxtAreaConhecimento.Text.Length > 80)
            {
                LblResposta.Text = Erros.NomeVazio;
            }
            else if (lista.Count > 0)
            {
                LblResposta.Text = Erros.AreaConExiste;
            }
            else
            {
                try
                {
                    BLLLinha_Pesquisa.InserirAreaConhecimento(area);

                    LblResposta.Text = "Area do conhecimento cadastrada com sucesso!";
                }
                catch (Exception)
                {
                    Response.Write("<script>alert('Erro ao inserir!');</script>");
                    throw;
                }
            }
        }