private void btnEntrar_Click(object sender, EventArgs e) { if (rbAluno.Checked) { MatriculaForm mf = new MatriculaForm(); this.Hide(); mf.ShowDialog(); return; } try { int retorno; LoginModel login = new LoginModel(); LoginController lg = new LoginController(); login.Login = txtLogin.Text; login.Senha = txtSenha.Text; retorno = lg.logar(login); if (retorno.Equals(1)) { MainForm adm = new MainForm(); this.Hide(); adm.ShowDialog(); } else { MessageBoxAdv.Show("Login ou senha inválido"); } } catch (Exception ex) { MessageBox.Show("Error:" + ex); } }
private void btnAlterar_Click(object sender, EventArgs e) { try { int cod = Convert.ToInt32(dgConsultas.Table.SelectedRecords[0].Record["codigo"]); DataTable dt = new DataTable(); dt = matriculaController.pesquisarAlunoEsp(cod).Tables[0]; MatriculaModel matricula = new MatriculaModel(); matricula.Nome = dt.Rows[0]["nome"].ToString(); matricula.Nascimento = dt.Rows[0]["dtNasc"].ToString(); matricula.Sexo = Convert.ToChar(dt.Rows[0]["sexo"]); matricula.Nacionalidade = dt.Rows[0]["nacionalidade"].ToString(); matricula.Naturalidade = dt.Rows[0]["naturalidade"].ToString(); matricula.EstadoCivil = dt.Rows[0]["estadoCivil"].ToString(); matricula.Estado = dt.Rows[0]["estado"].ToString(); matricula.Religiao = dt.Rows[0]["religiao"].ToString(); matricula.TpSanguineo = dt.Rows[0]["tipoSanguineo"].ToString(); matricula.Rh = dt.Rows[0]["rh"].ToString(); matricula.NomePai = dt.Rows[0]["nomePai"].ToString(); matricula.NomeMae = dt.Rows[0]["nomeMae"].ToString(); matricula.Email = dt.Rows[0]["email"].ToString(); matricula.Cep = dt.Rows[0]["cep"].ToString(); matricula.Endreco = dt.Rows[0]["endereco"].ToString(); matricula.Numero = dt.Rows[0]["numero"].ToString(); matricula.Complemento = dt.Rows[0]["complemento"].ToString(); matricula.Bairro = dt.Rows[0]["bairro"].ToString(); matricula.Municipio = dt.Rows[0]["municipio"].ToString(); matricula.Cpf = dt.Rows[0]["cpf"].ToString(); matricula.EmissaoCpf = dt.Rows[0]["dataEmissaoCpf"].ToString(); matricula.Rg = dt.Rows[0]["rg"].ToString(); matricula.EmissaoRg = dt.Rows[0]["dataEmissaoRg"].ToString(); matricula.Titulo = dt.Rows[0]["tituloEleitor"].ToString(); matricula.SecaoTitulo = dt.Rows[0]["secao"].ToString(); matricula.ZonaTitulo = dt.Rows[0]["zona"].ToString(); matricula.Escola = dt.Rows[0]["escola"].ToString(); matricula.CidadeEscola = dt.Rows[0]["cidadeEscola"].ToString(); matricula.EstadoEscola = dt.Rows[0]["estadoEscola"].ToString(); matricula.ConclusaoEscola = dt.Rows[0]["anoConclusao"].ToString(); matricula.Classificacao = dt.Rows[0]["classificacao"].ToString(); matricula.Pontuacao = dt.Rows[0]["pontuacao"].ToString(); matricula.Curso = dt.Rows[0]["curso"].ToString(); matricula.Turno = dt.Rows[0]["turno"].ToString(); matricula.Foto = (byte[]) dt.Rows[0]["foto"]; matricula.ExpedidoRG = dt.Rows[0]["expedidoRG"].ToString(); matricula.Cor = dt.Rows[0]["cor"].ToString(); matricula.ReservaMilitar = dt.Rows[0]["reservaMilitar"].ToString(); matricula.DataMilitar = dt.Rows[0]["dataMilitar"].ToString(); matricula.ExpedidoMilitar = dt.Rows[0]["expedidoMilitar"].ToString(); DataTable dtTelefone = new DataTable(); DataTable dtCelular = new DataTable(); dtTelefone = new TelefonesController().pesquisarTelefone(cod).Tables[0]; dtCelular = new TelefonesController().pesquisarCelular(cod).Tables[0]; int telCount = dtTelefone.Rows.Count, celCount = dtCelular.Rows.Count; string[] tel = new string[telCount], cel = new string[celCount]; for (int i = 0; i < telCount; i++ ) { tel[i] = dtTelefone.Rows[i]["telefone"].ToString(); } for (int i = 0; i < celCount; i++) { cel[i] = dtCelular.Rows[i]["celular"].ToString(); } MatriculaForm mat = new MatriculaForm(cod, matricula, cel, tel); mat.Show(); } catch(Exception ex) { MessageBoxAdv.Show(""+ex); } }