Exemple #1
0
        public void Deletar(int id)
        {
            Model.Entities.tb_prestador remove = db.tb_prestador.FirstOrDefault(t => t.id_prestador == id);
            db.tb_prestador.Remove(remove);

            db.SaveChanges();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            Model.Entities.tb_prestador pres   = new Model.Entities.tb_prestador();
            Business.PrestadorBusiness  buspre = new Business.PrestadorBusiness();
            pres.ds_cel        = txtCel.Text;
            pres.ds_cep        = txtCep.Text;
            pres.ds_cpf        = txtCpf.Text;
            pres.ds_email      = txtEmail.Text;
            pres.ds_rg         = txtRg.Text;
            pres.ds_tel        = txtTel.Text;
            pres.dt_nasc       = dtpNasc.Value;
            pres.end_prestador = txtEnd.Text;
            pres.uf_estado     = cboUf.Text;
            pres.nm_cargo      = cboSetor.Text;
            pres.nm_prestador  = txtNome.Text;
            pres.nu_prestador  = txtNu.Text;
            pres.bt_ativo      = false;
            if (rdnF.Checked == true)
            {
                pres.ds_genero = "F";
            }
            else
            {
                pres.ds_genero = "M";
            }

            buspre.Inserir(pres);
            MessageBox.Show("Pedido enviado com sucesso, enviaremos um email informando se sua conta foi aceita", "Fast Care", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Exemple #3
0
        public void RejeitarPestador(int id)
        {
            Model.Entities.tb_prestador antigo = db.tb_prestador.FirstOrDefault(t => t.id_prestador == id);

            db.tb_prestador.Remove(antigo);

            db.SaveChanges();
        }
Exemple #4
0
        public void AceitarPrestador(int id)
        {
            Model.Entities.tb_prestador antigo = db.tb_prestador.FirstOrDefault(t => t.id_prestador == id);

            antigo.bt_ativo = true;

            db.SaveChanges();
        }
 private void ValidarPrestador(Model.Entities.tb_prestador pres)
 {
     if (!Utils.Validacao.ValidarRequerido(pres.nm_prestador))
     {
         throw new ArgumentException("O campo Nome é obrigatório");
     }
     //if (!Utils.Validacao.ValidarCpf(emp.ds_cpf))
     //    throw new ArgumentException("O campo CPF é obrigatório");
     ////////if (!Utils.Validacao.ValidarRequerido(pres.uf_estado))
     ////////    throw new ArgumentException("O campo UF é obrigatório");
     if (!Utils.Validacao.ValidarRg(pres.ds_rg))
     {
         throw new ArgumentException("O campo RG é obrigatório");
     }
     if (!Utils.Validacao.ValidarCep(pres.ds_cep))
     {
         throw new ArgumentException("O campo Cep deve ser preenchido");
     }
     if (pres.end_prestador == " -  - " || !Utils.Validacao.ValidarRequerido(pres.end_prestador))
     {
         throw new ArgumentException("Cep inválido");
     }
     if (!Utils.Validacao.ValidarRequerido(pres.nu_prestador))
     {
         throw new ArgumentException("O campo Nº é obrigatório");
     }
     if (!Utils.Validacao.ValidarEmail(pres.ds_email))
     {
         throw new ArgumentException("O Email é inválido");
     }
     if (!Utils.Validacao.ValidarCelOuTel(pres.ds_cel))
     {
         throw new ArgumentException("O Celular é inválido");
     }
     if (!Utils.Validacao.ValidarCelOuTel(pres.ds_tel))
     {
         throw new ArgumentException("O Telefone inválido");
     }
     if (!Utils.Validacao.ValidarDt(pres.dt_nasc))
     {
         throw new ArgumentException("A Data de nascimento é inválida");
     }
     if (pres.ds_genero == string.Empty)
     {
         throw new ArgumentException("O campo Gênero é obrigatório");
     }
 }
Exemple #6
0
        public void Alterar(Model.Entities.tb_prestador prest)
        {
            Model.Entities.tb_prestador antigo = db.tb_prestador.FirstOrDefault(t => t.id_prestador == prest.id_prestador);

            antigo.ds_cel        = prest.ds_cel;
            antigo.ds_cep        = prest.ds_cep;
            antigo.ds_cpf        = prest.ds_cpf;
            antigo.ds_email      = prest.ds_email;
            antigo.ds_rg         = prest.ds_rg;
            antigo.ds_tel        = prest.ds_tel;
            antigo.dt_nasc       = prest.dt_nasc;
            antigo.end_prestador = prest.end_prestador;
            antigo.nm_cargo      = prest.nm_cargo;
            antigo.nm_prestador  = prest.nm_prestador;
            antigo.nu_prestador  = prest.nu_prestador;

            db.SaveChanges();
        }
Exemple #7
0
 public void inserir(Model.Entities.tb_prestador p)
 {
     db.tb_prestador.Add(p);
     db.SaveChanges();
 }
        public void Alterar(Model.Entities.tb_prestador prest)
        {
            ValidarPrestador(prest);

            db.Alterar(prest);
        }
        public void Inserir(Model.Entities.tb_prestador prest)
        {
            ValidarPrestador(prest);

            db.inserir(prest);
        }