예제 #1
0
        private void inserir()
        {
            segurado = new segurado_tb();

            pessoa_tb pessoa = new pessoa_tb();

            pessoa.nome     = txtNome.Text;
            pessoa.cpf_cnpj = txtCPF_CNPJ.Text;
            pessoa.email    = txtEmail.Text;

            segurado.pessoa_tb = pessoa;

            using (var ctx = new CTX_GERCOM())
            {
                try
                {
                    ctx.segurado_tb.Add(segurado);
                    ctx.SaveChanges();
                }
                catch (Exception ex)
                {
                    throw;
                }
            }
        }
예제 #2
0
        public void gvSegurado_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                segurado_tb obj = ((segurado_tb)e.Row.DataItem);

                ((HyperLink)e.Row.FindControl("lnkEditar")).NavigateUrl = string.Concat("SeguradoDetalhe?id=", obj.segurado_id);
                ((HyperLink)e.Row.FindControl("lnkEditar")).Text        = obj.segurado_id.ToString();
            }
        }
예제 #3
0
        private void CarregarTela()
        {
            if (!string.IsNullOrEmpty(Request["id"]))
            {
                segurado = new Segurado().RecuperarPelaChave(Convert.ToInt32(Request["id"]));

                txtNome.Text     = segurado.pessoa_tb.nome;
                txtCPF_CNPJ.Text = segurado.pessoa_tb.cpf_cnpj;
                txtEmail.Text    = segurado.pessoa_tb.email;

                estado = EntityState.Modified;
            }
            else
            {
                estado = EntityState.Added;
            }

            ViewState["vsEstado"] = estado;
        }
예제 #4
0
        private void alterar()
        {
            using (var ctx = new CTX_GERCOM())
            {
                segurado = new Segurado().RecuperarPelaChave(ctx, Convert.ToInt32(Request["id"]));

                pessoa_tb pessoa = new pessoa_tb();

                pessoa.nome     = txtNome.Text;
                pessoa.cpf_cnpj = txtCPF_CNPJ.Text;
                pessoa.email    = txtEmail.Text;


                try
                {
                    segurado.pessoa_tb = pessoa;
                    ctx.SaveChanges();
                }
                catch (Exception ex)
                {
                    throw;
                }
            }
        }
예제 #5
0
 public void RecuperarDados()
 {
     segurado = new SeguradoRepositorio().RecuperarPelaChave(Convert.ToInt32(Request["id"]));
 }