private void txtEmail_Leave(object sender, EventArgs e) { if (Vemail.validarEmail(txtEmail.Text)) { txtEmail.BackColor = Color.White; // MessageBox.Show("E-MAIL INFORMADO É VÁLIDO! POR FAVOR, CONTINUE O CADASTRO!", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { txtEmail.BackColor = Color.Red; MessageBox.Show("E-MAIL INFORMADO É INVÁLIDO! POR FAVOR, VERIFIQUE SE DIGITOU CORRETAMENTE E TENTE NOVAMENTE!", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void btnGravar_Click(object sender, EventArgs e) { if ((txtNome.Text == "") || (txtTel.Text == "") || (txtNr.Text == "") || (txtMaskCep.Text == "") || (txtEnd.Text == "") || (cboUF.Text == "") || (txtBairro.Text == "") || (txtCidade.Text == "")) { MessageBox.Show("Os campos com * são Obrigatórios", "Item Novo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { ObjClnMecanica.Nome = txtNome.Text; ObjClnMecanica.Tel = txtTel.Text; ObjClnMecanica.Endereco = txtEnd.Text; ObjClnMecanica.Nr = txtNr.Text; ObjClnMecanica.Cep = txtMaskCep.Text.Replace("-", ""); ObjClnMecanica.UF = cboUF.Text; ObjClnMecanica.Bairro = txtBairro.Text; // ObjClnMecanica.CNPJ = maskedTextBox1.Text; ObjClnMecanica.Email = txtEmail.Text; ObjClnMecanica.Cidade = txtCidade.Text; if (txtCodFORNECEDOR.Text == "" || (Vemail.validarEmail(txtEmail.Text))) { ObjClnMecanica.Gravar(); MessageBox.Show("Registo gravado com Sucesso", "Item Novo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (txtCodFORNECEDOR.Text != "") { ObjClnMecanica.COD_Fornecedor1 = txtCodFORNECEDOR.Text; ObjClnMecanica.Alterar(); MessageBox.Show("Registro Número " + txtCodFORNECEDOR.Text + ", Alterado com sucesso", "alteração", MessageBoxButtons.OK, MessageBoxIcon.Information); } Close(); } }