protected void btnGravar_Click(object sender, EventArgs e) { nome_impressora = ddlImpressora.SelectedValue; vias = Convert.ToInt32(ddlVias.SelectedValue); string mensagem = ""; int _pront = 0; if (txbProntuario.Text != "") { _pront = Convert.ToInt32(txbProntuario.Text); } string _inform_complement = ""; for (int i = 0; i < chkFormaChegada.Items.Count; i++) { if (chkFormaChegada.Items[i].Selected == true) // getting selected value from CheckBox List { _inform_complement += chkFormaChegada.Items[i].Text + ", "; // add selected Item text to the String . } } if (_inform_complement != "") { _inform_complement = _inform_complement.Substring(0, _inform_complement.Length - 2); // Remove Last "," from the string . } Ficha be = new Ficha(); be.dt_rh_be = Convert.ToDateTime(txbDtFicha.Text); be.prontuario = _pront; be.rf = txbRF.Text; be.documento = txbDocumento.Text; be.cns = txbCNS.Text; be.tipo_paciente = rbTipoPaciente.SelectedValue; be.nome_paciente = txbNomePaciente.Text; if (txbNascimento.Text == "") { DateTime seData = new DateTime(1800, 1, 1); be.dt_nascimento = seData; } else { be.dt_nascimento = Convert.ToDateTime(txbNascimento.Text); } be.idade = txbIdade.Text; be.sexo = ddlSexo.SelectedValue; be.raca = ddlRaca.SelectedValue; be.endereco_rua = txbEndereco.Text; be.numero_casa = txbNumero.Text; be.complemento = txbComplemento.Text; be.bairro = txbBairro.Text; be.municipio = txbMunicipio.Text; be.uf = txbUF.Text; be.cep = txbCEP.Text; be.nome_pai_mae = txbPais.Text; be.responsavel = txbResponsavel.Text; be.telefone = txbTelefone.Text; be.telefone1 = txbTelefone1.Text; be.telefone2 = txbTelefone2.Text; be.email = txbEmail.Text; be.procedencia = ddlProcedencia.SelectedValue; be.informacao_complementar = _inform_complement; be.queixa = txbQueixa.Text; be.setor = ddlSetor.SelectedValue; be.usuario = System.Web.HttpContext.Current.User.Identity.Name; be.info_resgate = txbInfoResgate.Text; int _cod_ficha_be = FichaDAO.GravaFicha(be.dt_rh_be , be.prontuario , be.documento , be.cns , be.tipo_paciente , be.nome_paciente , be.dt_nascimento , be.idade , be.sexo , be.raca , be.endereco_rua , be.numero_casa , be.complemento , be.bairro , be.municipio , be.uf , be.cep , be.nome_pai_mae , be.responsavel , be.telefone , be.telefone1 , be.telefone2 , be.email , be.procedencia , be.informacao_complementar , be.queixa , be.setor , be.usuario , be.info_resgate , be.rf ); mensagem = "Ficha: " + Convert.ToString(_cod_ficha_be); while (vias > 0) { ImpressaoFicha.imprimirFicha(_cod_ficha_be, nome_impressora); vias--; } Response.Redirect("~/Administrativo/FichaRetroativa.aspx"); }
protected void btnGravar_Click(object sender, EventArgs e) { string mensagem = ""; int _pront = 0; if (txbProntuario.Text != "") { _pront = Convert.ToInt32(txbProntuario.Text); } Ficha be = new Ficha(); be.prontuario = _pront; be.documento = txbDocumento.Text; be.tipo_paciente = rbTipoPaciente.SelectedValue; be.nome_paciente = txbNomePaciente.Text; if (txbNascimento.Text == "") { DateTime seData = new DateTime(1800, 1, 1); be.dt_nascimento = seData; } else { be.dt_nascimento = Convert.ToDateTime(txbNascimento.Text); } be.idade = txbIdade.Text; be.sexo = ddlSexo.SelectedValue; be.raca = ddlRaca.SelectedValue; be.endereco_rua = txbEndereco.Text; be.numero_casa = txbNumero.Text; be.complemento = txbComplemento.Text; be.bairro = txbBairro.Text; be.municipio = txbMunicipio.Text; be.uf = txbUF.Text; be.cep = txbCEP.Text; be.nome_pai_mae = txbPais.Text; be.responsavel = txbResponsavel.Text; be.telefone = txbTelefone.Text; be.procedencia = txbProcedencia.Text; be.queixa = txbQueixa.Text; be.setor = ddlSetor.SelectedValue; be.usuario = System.Web.HttpContext.Current.User.Identity.Name; int _cod_ficha_be = FichaDAO.GravaFicha(be.dt_rh_be , be.prontuario , be.documento , be.tipo_paciente , be.nome_paciente , be.dt_nascimento , be.idade , be.sexo , be.raca , be.endereco_rua , be.numero_casa , be.complemento , be.bairro , be.municipio , be.uf , be.cep , be.nome_pai_mae , be.responsavel , be.telefone , be.procedencia , be.queixa , be.setor , be.usuario ); mensagem = "Ficha: " + Convert.ToString(_cod_ficha_be); ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + mensagem + "');", true); ClearInputs(Page.Controls);// limpa os textbox // Imprimir o BE if (_cod_ficha_be > 0) { using (var relatorio = new Microsoft.Reporting.WebForms.LocalReport()) { relatorio.ReportPath = "Relatorios/Ficha.rdlc"; FichaDAO sr = new FichaDAO(); List <Ficha> sc = new List <Ficha>(); //Ficha sc = new Ficha(); sc = sr.GetFicha(_cod_ficha_be); IEnumerable <Ficha> ie; ie = sc.AsQueryable(); ReportDataSource datasource = new ReportDataSource("Ficha", ie); relatorio.DataSources.Add(datasource); Exportar(relatorio); Imprimir(relatorio); } } }