Ejemplo n.º 1
0
        private void CarregarLista()
        {
            TarefasDBEntities context    = new TarefasDBEntities();
            List <TB_TAREFA>  lstTarefa  = context.TB_TAREFA.ToList <TB_TAREFA>();
            List <TB_PROJETO> lstProjeto = context.TB_PROJETO.ToList <TB_PROJETO>();

            GVTarefa.DataSource = lstTarefa;
            GVTarefa.DataBind();

            GVProjeto.DataSource = lstProjeto;
            GVProjeto.DataBind();
        }
Ejemplo n.º 2
0
        protected void btnCadastrar_Click(object sender, EventArgs e)
        {
            string   descricaoProjeto = txtDescricao.Text;
            DateTime datainicio       = Convert.ToDateTime(txtdatainicio.Text);
            DateTime dataimplantacao  = Convert.ToDateTime(txtdataimplantacao.Text);
            DateTime datateste        = Convert.ToDateTime(txtdatateste.Text);
            int      qtdpessoa        = Convert.ToInt32(txtQtdPessoas.Text);
            string   telefone1        = txtTelefone1.Text;
            string   telefone2        = txtTelefone2.Text;
            string   observacao       = txtobservacao.Text;

            TB_PROJETO v = new TB_PROJETO()
            {
                descricao      = descricaoProjeto,
                dt_implantacao = dataimplantacao,
                dt_ini_proj    = datainicio,
                dt_teste       = datateste,
                observacao     = observacao,
                contato_tel1   = telefone1,
                contato_tel2   = telefone2,
                qtd_pessoas    = qtdpessoa
            };
            TarefasDBEntities contextProjeto = new TarefasDBEntities();

            string valor = Request.QueryString["idItem"];

            if (String.IsNullOrEmpty(valor))
            {
                contextProjeto.TB_PROJETO.Add(v);
                lblmsg.Text = "Registro Inserido!";
                Clear();
            }
            else
            {
                int        id      = Convert.ToInt32(valor);
                TB_PROJETO projeto = contextProjeto.TB_PROJETO.First(c => c.id == id);
                projeto.descricao      = v.descricao;
                projeto.dt_ini_proj    = v.dt_ini_proj;
                projeto.dt_implantacao = v.dt_implantacao;
                projeto.dt_teste       = v.dt_teste;
                projeto.contato_tel1   = v.contato_tel1;
                projeto.contato_tel2   = v.contato_tel2;
                projeto.observacao     = v.observacao;
                projeto.qtd_pessoas    = v.qtd_pessoas;

                lblmsg.Text = "Registro Alterado!";
            }

            contextProjeto.SaveChanges();
        }
        private void CarregarDadosPagina()
        {
            string            valor         = Request.QueryString["idItem"];
            int               idItem        = 0;
            TB_TAREFA         v             = new TB_TAREFA();
            TarefasDBEntities contextTarefa = new TarefasDBEntities();

            if (!String.IsNullOrEmpty(valor))
            {
                idItem = Convert.ToInt32(valor);
                v      = contextTarefa.TB_TAREFA.First(c => c.ID == idItem);

                txtdataentrega.Text   = v.DT_ENTREGA.ToString();
                txtdataatividade.Text = v.DT_ATIVIDADE.ToString();
                txtdatalimite.Text    = v.DT_LIMITE_ENTREGA.ToString();
                txtDescricao.Text     = v.DESCRICAO;
            }
        }
Ejemplo n.º 4
0
        private void CarregarDadosPagina()
        {
            string            valor          = Request.QueryString["idItem"];
            int               idItem         = 0;
            TB_PROJETO        v              = new TB_PROJETO();
            TarefasDBEntities contextProjeto = new TarefasDBEntities();

            if (!String.IsNullOrEmpty(valor))
            {
                idItem = Convert.ToInt32(valor);
                v      = contextProjeto.TB_PROJETO.First(c => c.id == idItem);

                txtdataimplantacao.Text = v.dt_implantacao.ToString();
                txtdatainicio.Text      = v.dt_ini_proj.ToString();
                txtdatateste.Text       = v.dt_teste.ToString();
                txtQtdPessoas.Text      = Convert.ToString(v.qtd_pessoas);
                txtTelefone1.Text       = v.contato_tel1;
                txtTelefone2.Text       = v.contato_tel2;
                txtDescricao.Text       = v.descricao;
            }
        }
Ejemplo n.º 5
0
        protected void GVTarefa_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int idItem = Convert.ToInt32(e.CommandArgument.ToString());
            TarefasDBEntities context = new TarefasDBEntities();
            TB_TAREFA         tarefa  = new TB_TAREFA();

            tarefa = context.TB_TAREFA.First(c => c.ID == idItem);

            if (e.CommandName == "ALTERAR")
            {
                Response.Redirect("Tarefa.aspx?idItem=" + idItem);
            }
            else if (e.CommandName == "EXCLUIR")
            {
                context.TB_TAREFA.Remove(tarefa);
                context.SaveChanges();

                string msg    = "Tarefa excluida com sucesso!";
                string titulo = "Informação";
                CarregarLista();
                DisplayAlert(titulo, msg, this);
            }
        }
        protected void btnCadastrar_Click(object sender, EventArgs e)
        {
            string    descricaoTarefa = txtDescricao.Text;
            DateTime  dataAtividade   = Convert.ToDateTime(txtdataatividade.Text);
            DateTime  dataEentrega    = Convert.ToDateTime(txtdataentrega.Text);
            DateTime  dataLimite      = Convert.ToDateTime(txtdatalimite.Text);
            TB_TAREFA v = new TB_TAREFA()
            {
                DESCRICAO         = descricaoTarefa,
                DT_ATIVIDADE      = dataAtividade,
                DT_ENTREGA        = dataEentrega,
                DT_LIMITE_ENTREGA = dataLimite
            };
            TarefasDBEntities contextTarefa = new TarefasDBEntities();

            string valor = Request.QueryString["idItem"];

            if (String.IsNullOrEmpty(valor))
            {
                contextTarefa.TB_TAREFA.Add(v);
                lblmsg.Text = "Registro Inserido!";
                Clear();
            }
            else
            {
                int       id     = Convert.ToInt32(valor);
                TB_TAREFA tarefa = contextTarefa.TB_TAREFA.First(c => c.ID == id);
                tarefa.DESCRICAO         = v.DESCRICAO;
                tarefa.DT_ATIVIDADE      = v.DT_ATIVIDADE;
                tarefa.DT_ENTREGA        = v.DT_ENTREGA;
                tarefa.DT_LIMITE_ENTREGA = v.DT_LIMITE_ENTREGA;
                lblmsg.Text = "Registro Alterado!";
            }

            contextTarefa.SaveChanges();
        }