private void btnSalvar_Click(object sender, EventArgs e) { if (txtCodFunc.Text != "" && txtCodLoja.Text != "" && txtDescricao.Text != "") { if (loja.RetCodLojaExiste(int.Parse(txtCodLoja.Text)) == true && func.RetCodFuncExiste(int.Parse(txtCodFunc.Text)) == true) { sala.descricao = txtDescricao.Text; sala.LOJA_codLoja = int.Parse(txtCodLoja.Text); sala.FUNC_codFuncResp = int.Parse(txtCodFunc.Text); if (sala.Inserir(sala) == true) { MessageBox.Show("Sala cadastrada com sucesso!"); } } else { MessageBox.Show("Loja ou funcionário não existem!"); } } else { MessageBox.Show("Preencha os dados!"); } }
private void btnSalvar_Click(object sender, EventArgs e) { if (txtNome.Text != "" && mskCPF.Text != "" && mskDataNascimento.Text != "" && cboTipoFunc.Text != "" && txtLogin.Text != "" && txtSenha.Text != "" && cboStatusFunc.Text != "" && txtCodContato.Text != "" && txtCodigoFuncResp.Text != "") { contato.endereco = txtEndereco.Text; contato.numero = int.Parse(txtNumero.Text); contato.conplemento = txtConplemento.Text; contato.bairro = txtBairro.Text; contato.cidade = txtCidade.Text; contato.estado = txtEstado.Text; contato.pais = txtPais.Text; contato.telFixo = txtTel.Text; contato.celular = txtCel.Text; contato.email = txtEmail.Text; if (func.VerificarLogin(txtLogin.Text) == false) { if (func.RetCodFuncExiste(int.Parse(txtCodigoFuncResp.Text)) == true) // Verifica se o usuario que ele colocou como responsavel existe ou não { if (cboTipoFunc.Text == "Gerente") { func.tipoFuncionario = 2; } else { func.tipoFuncionario = 3; } func.nome = txtNome.Text; func.cpf = mskCPF.Text; func.dataNasc = mskDataNascimento.Text; func.loginFunc = txtLogin.Text; func.senha = txtSenha.Text; func.statusFunc = int.Parse(cboStatusFunc.Text); func.CONTATO_codContato = int.Parse(txtCodContato.Text); func.FUNC_codFuncResp = int.Parse(txtCodigoFuncResp.Text); MessageBox.Show("Inserido com sucesso"); contato.Inserir(contato); func.Inserir(func); frmCadastrarFuncAdm cadastrarFunc = new frmCadastrarFuncAdm(); if (Application.OpenForms.OfType <frmCadastrarFuncAdm>().Count() > 0) { Application.OpenForms[cadastrarFunc.Name].Close(); } } else { MessageBox.Show("O funcionário responsavel não existe ou não tem permissão para ser responsavel", "ERRO"); } } else { MessageBox.Show("O login de usuário já existe!", "ERRO"); } } }