Esempio n. 1
0
        protected void btnCadastrar_Click(object sender, EventArgs e)
        {
            string     nomeCond  = txtNome.Text;
            string     idadeCond = txtIdade.Text;
            string     cpfCond   = txtCpf.Text;
            string     blocoCond = DDLBloco.Text;
            string     aptoCond  = DDLApartamento.Text;
            TB_MORADOR v         = new TB_MORADOR()
            {
                nome = nomeCond, idade = idadeCond, cpf = cpfCond, bloco = blocoCond, apto = aptoCond
            };
            ControleCondDBEntities contextCond = new ControleCondDBEntities();

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

            if (String.IsNullOrEmpty(valor))
            {
                contextCond.TB_MORADOR.Add(v);
                lblmsg.Text = "Registro Inserido!";
                Clear();
            }
            else
            {
                int        id   = Convert.ToInt32(valor);
                TB_MORADOR cond = contextCond.TB_MORADOR.First(c => c.id == id);
                cond.nome   = v.nome;
                cond.idade  = v.idade;
                cond.cpf    = v.cpf;
                cond.bloco  = v.bloco;
                cond.apto   = v.apto;
                lblmsg.Text = "Registro Alterado";
            }
            contextCond.SaveChanges();
            CarregarLista();
        }
Esempio n. 2
0
        protected void btnCadastrar_Click(object sender, EventArgs e)
        {
            string   blocoCond     = txtBloco.Text;
            string   aptoCond      = txtQtdApto.Text;
            string   andarCond     = txtQtdAndar.Text;
            string   moradoresCond = txtTotalMoradores.Text;
            TB_BLOCO v             = new TB_BLOCO()
            {
                numero_bloco = blocoCond, qtd_apartamentos = aptoCond, qtd_andar = andarCond, total_moradores = moradoresCond
            };
            ControleCondDBEntities contextCond = new ControleCondDBEntities();

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

            if (String.IsNullOrEmpty(valor))
            {
                contextCond.TB_BLOCO.Add(v);
                lblmsg.Text = "Registro Inserido!";
                Clear();
            }
            else
            {
                int      id   = Convert.ToInt32(valor);
                TB_BLOCO cond = contextCond.TB_BLOCO.First(c => c.id == id);
                cond.numero_bloco     = v.numero_bloco;
                cond.qtd_apartamentos = v.qtd_apartamentos;
                cond.qtd_andar        = v.qtd_andar;
                cond.total_moradores  = v.total_moradores;
                lblmsg.Text           = "Registro Alterado";
            }
            contextCond.SaveChanges();
            CarregarLista();
        }
Esempio n. 3
0
        protected void btnCadastrar_Click(object sender, EventArgs e)
        {
            string         aptoCond      = txtApto.Text;
            string         moradoresCond = txtMoradores.Text;
            string         blocoCond     = DDLBloco.Text;
            TB_APARTAMENTO v             = new TB_APARTAMENTO()
            {
                numero_apto = aptoCond, qtd_moradores = moradoresCond, bloco = blocoCond
            };
            ControleCondDBEntities contextCond = new ControleCondDBEntities();

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

            if (String.IsNullOrEmpty(valor))
            {
                contextCond.TB_APARTAMENTO.Add(v);
                lblmsg.Text = "Registro Inserido!";
                Clear();
            }
            else
            {
                int            id   = Convert.ToInt32(valor);
                TB_APARTAMENTO cond = contextCond.TB_APARTAMENTO.First(c => c.id == id);
                cond.numero_apto   = v.numero_apto;
                cond.qtd_moradores = v.qtd_moradores;
                cond.bloco         = v.bloco;
                lblmsg.Text        = "Registro Alterado";
            }
            contextCond.SaveChanges();
            CarregarLista();
        }
Esempio n. 4
0
        private void CarregarLista()
        {
            ControleCondDBEntities context = new ControleCondDBEntities();
            List <TB_COND>         lstCond = context.TB_COND.ToList <TB_COND>();

            GVCond.DataSource = lstCond;
            GVCond.DataBind();
        }
Esempio n. 5
0
        private void CarregarLista()
        {
            ControleCondDBEntities context  = new ControleCondDBEntities();
            List <TB_BLOCO>        lstBloco = context.TB_BLOCO.ToList <TB_BLOCO>();

            GVBloco.DataSource = lstBloco;
            GVBloco.DataBind();
        }
Esempio n. 6
0
        private void CarregarLista()
        {
            ControleCondDBEntities context    = new ControleCondDBEntities();
            List <TB_MORADOR>      lstMorador = context.TB_MORADOR.ToList <TB_MORADOR>();

            GVMorador.DataSource = lstMorador;
            GVMorador.DataBind();
        }
Esempio n. 7
0
        private void CarregarLista()
        {
            ControleCondDBEntities context        = new ControleCondDBEntities();
            List <TB_APARTAMENTO>  lstApartamento = context.TB_APARTAMENTO.ToList <TB_APARTAMENTO>();

            GVApartamento.DataSource = lstApartamento;
            GVApartamento.DataBind();
        }
Esempio n. 8
0
        private void CarregarDadosPagina()
        {
            string         valor  = Request.QueryString["idItem"];
            int            idItem = 0;
            TB_APARTAMENTO cond   = new TB_APARTAMENTO();


            if (!String.IsNullOrEmpty(valor))
            {
                ControleCondDBEntities contextCond = new ControleCondDBEntities();
                idItem = Convert.ToInt32(valor);
                cond   = contextCond.TB_APARTAMENTO.First(c => c.id == idItem);

                txtApto.Text      = cond.numero_apto;
                txtMoradores.Text = cond.qtd_moradores;
                DDLBloco.Text     = cond.bloco;
            }
        }
Esempio n. 9
0
        private void CarregarDadosPagina()
        {
            string   valor  = Request.QueryString["idItem"];
            int      idItem = 0;
            TB_BLOCO cond   = new TB_BLOCO();


            if (!String.IsNullOrEmpty(valor))
            {
                ControleCondDBEntities contextCond = new ControleCondDBEntities();
                idItem = Convert.ToInt32(valor);
                cond   = contextCond.TB_BLOCO.First(c => c.id == idItem);

                txtBloco.Text          = cond.numero_bloco;
                txtQtdApto.Text        = cond.qtd_apartamentos;
                txtQtdAndar.Text       = cond.qtd_andar;
                txtTotalMoradores.Text = cond.total_moradores;
            }
        }
Esempio n. 10
0
        private void CarregarDadosPagina()
        {
            string     valor  = Request.QueryString["idItem"];
            int        idItem = 0;
            TB_MORADOR cond   = new TB_MORADOR();


            if (!String.IsNullOrEmpty(valor))
            {
                ControleCondDBEntities contextCond = new ControleCondDBEntities();
                idItem = Convert.ToInt32(valor);
                cond   = contextCond.TB_MORADOR.First(c => c.id == idItem);

                txtNome.Text        = cond.nome;
                txtIdade.Text       = cond.idade;
                txtCpf.Text         = cond.cpf;
                DDLBloco.Text       = cond.bloco;
                DDLApartamento.Text = cond.apto;
            }
        }
Esempio n. 11
0
        protected void GVBloco_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int idItem = Convert.ToInt32(e.CommandArgument.ToString());
            ControleCondDBEntities contextBloco = new ControleCondDBEntities();
            TB_BLOCO bloco = new TB_BLOCO();

            bloco = contextBloco.TB_BLOCO.First(c => c.id == idItem);

            if (e.CommandName == "ALTERAR")
            {
                Response.Redirect("CadastroBloco.aspx?idItem=" + idItem);
            }
            else if (e.CommandName == "EXCLUIR")
            {
                contextBloco.TB_BLOCO.Remove(bloco);
                contextBloco.SaveChanges();
                string msg    = "Excluída com sucesso !";
                string titulo = "Informação";
                CarregarLista();
                DisplayAlert(titulo, msg, this);
            }
        }