private void BtnAltAluno_Click_1(object sender, EventArgs e) { var matsel = this.dtGrdMat.CurrentRow.Cells[0].Value.ToString(); formAluno formAlunoAlt = new formAluno(); StringBuilder cQuery = new StringBuilder(); cQuery.Append("SELECT *, Convert(datetime,datamat) AS DATAMAT, Case WHEN tipoplano = '1' THEN '1 - Mensal' Else '2 - Anual' END AS PLANO FROM aluno WHERE idAluno = '" + matsel + "' "); Database.engineDb conn1 = new Database.engineDb(); DataSet ds = conn1.RetornaDataSet(cQuery.ToString()); formAlunoAlt.mskID.Text = ds.Tables[0].Rows[0].ItemArray[0].ToString(); formAlunoAlt.txtNome.Text = ds.Tables[0].Rows[0].ItemArray[1].ToString(); formAlunoAlt.txtCPF.Text = ds.Tables[0].Rows[0].ItemArray[2].ToString(); formAlunoAlt.txtRG.Text = ds.Tables[0].Rows[0].ItemArray[3].ToString(); formAlunoAlt.cmbUF.Text = ds.Tables[0].Rows[0].ItemArray[4].ToString(); formAlunoAlt.txtCidade.Text = ds.Tables[0].Rows[0].ItemArray[5].ToString(); formAlunoAlt.txtCEP.Text = ds.Tables[0].Rows[0].ItemArray[6].ToString(); formAlunoAlt.txtBairro.Text = ds.Tables[0].Rows[0].ItemArray[7].ToString(); formAlunoAlt.txtEndereco.Text = ds.Tables[0].Rows[0].ItemArray[8].ToString(); formAlunoAlt.dtMatricula.Text = ds.Tables[0].Rows[0].ItemArray[12].ToString(); formAlunoAlt.txtPlano.Text = ds.Tables[0].Rows[0].ItemArray[13].ToString(); formAlunoAlt.dtMatricula.Enabled = false; formAlunoAlt.txtPlano.Enabled = false; formAlunoAlt.ShowDialog(); }
private void BtnIncAluno_Click(object sender, EventArgs e) { formAluno formAlunoInc = new formAluno(); StringBuilder cQuery = new StringBuilder(); cQuery.Append("SELECT MAX(idAluno) + 1 as ID FROM aluno"); Database.engineDb conn1 = new Database.engineDb(); DataSet ds = conn1.RetornaDataSet(cQuery.ToString()); formAlunoInc.mskID.Text = ds.Tables[0].Rows[0].ItemArray[0].ToString(); formAlunoInc.txtNome.Clear(); formAlunoInc.txtCPF.Clear(); formAlunoInc.txtRG.Clear(); //formAlunoInc.cmbUF.Items(); formAlunoInc.txtCidade.Clear(); formAlunoInc.txtCEP.Clear(); formAlunoInc.txtBairro.Clear(); formAlunoInc.txtEndereco.Clear(); //formAlunoInc.dtMatricula //formAlunoInc.txtPlano.Clear(); formAlunoInc.inserir = true; formAlunoInc.ShowDialog(); }