private void btn_cadastrar_Click(object sender, EventArgs e) { DialogResult msg = MessageBox.Show("Deseja Cadastrar as medidas do Aluno?", "Medidas", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (msg == DialogResult.Yes) { this.Visible = false; var TelaMedidas = new frm_Sistema(); TelaMedidas.usC_medidasAluno1.lbl_idResult.Visible = true; TelaMedidas.usC_medidasAluno1.lbl_id.Visible = true; TelaMedidas.usC_medidasAluno1.cmbbox_aluno.Text = txtbox_nome.Text.ToUpper(); this.Parent.Controls.Add(TelaMedidas.usC_medidasAluno1); TelaMedidas.usC_medidasAluno1.Visible = true; } verificador.verificadorDeCamposPreenchidos = 0; verificador.VerificaCamposPreenchidos(this); if (cmbbox_valor.Text != "OUTROS" && verificador.verificadorDeCamposPreenchidos == 17) { Cadastrando(); } else if (cmbbox_valor.Text == "OUTROS" && verificador.verificadorDeCamposPreenchidos == 18) { Cadastrando(); } else { verificador.VerificaCamposTempoReal.Tick += VerificaCamposTempoReal_Tick; MessageBox.Show("O preenchimento dos campos é obrigatório!", "ATENÇÃO", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
public void Cadastrando() { verificador.VerificaCamposTempoReal.Stop(); string Whatsaap; SqlDateTime DataPagamento = SqlDateTime.Null; CD_NovoAluno cadastrarNovoAluno = new CD_NovoAluno(); if (chckbox_whatsaap.Checked) { Whatsaap = "S"; } else { Whatsaap = "N"; } if (cmbbox_valor.Text == "OUTROS") { cmbbox_valor.Items.Add(msktbox_outroValor.Text); cmbbox_valor.SelectedItem = msktbox_outroValor.Text; } else { msktbox_outroValor.Text = "0000"; } cadastrarNovoAluno.InserindoNovoAluno(txtbox_nome.Text, msktbox_dtNascimento.Text, cmbbox_sexo.Text, msktbox_rg.Text, mstkbox_cpf.Text, msktbox_telefone.Text, Whatsaap, txtbox_endereco.Text, txtbox_numero.Text, txtbox_bairro.Text, cmbbox_uf.Text, msktbox_cep.Text, cmbbox_cidade.Text, msktbox_dtMatricula.Text, cmbbox_marketing.Text, txtbox_email.Text); if (cadastrarNovoAluno.IdRetorno != 0) { if (chckbox_pago.Checked) { DataPagamento = DateTime.Now; cadastrarNovoAluno.InserindoPagamento(DataPagamento, cmbbox_valor.Text, cmbbox_plano.Text, "PAGO"); UP_Matriculados inserindoNovaFatura = new UP_Matriculados(); inserindoNovaFatura.InserindoNovaFaturaMatriculados(cadastrarNovoAluno.IdRetorno, cmbbox_valor.Text, cmbbox_plano.Text, "HAVER"); } else { cadastrarNovoAluno.InserindoPagamento(SqlDateTime.Null, cmbbox_valor.Text, cmbbox_plano.Text, "HAVER"); } if (cadastrarNovoAluno.IdRetorno != 0) { DialogResult msg = MessageBox.Show("Deseja Cadastrar as medidas do Aluno?", "Medidas", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (msg == DialogResult.Yes) { this.Visible = false; var TelaMedidas = new frm_Sistema(); TelaMedidas.usC_medidasAluno1.lbl_idResult.Text = cadastrarNovoAluno.IdRetorno.ToString(); TelaMedidas.usC_medidasAluno1.lbl_idResult.Visible = true; TelaMedidas.usC_medidasAluno1.lbl_id.Visible = true; TelaMedidas.usC_medidasAluno1.cmbbox_aluno.Text = txtbox_nome.Text.ToUpper(); TelaMedidas.Visible = true; } } } cadastrarNovoAluno.InserindoFrequencia(cadastrarNovoAluno.IdRetorno, "ATIVO"); LimpaCampos(); }