public static void imprimirFicha(int _cod_ficha_be, string _nome_impressora) { nome_impressora = _nome_impressora; // 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); } } }
public static void imprimirEtiqueta(int _cod_ficha_be, string _nome_impressora, int qtdEtiquetas) { impressora_etiqueta = _nome_impressora; // Imprimir o BE if (_cod_ficha_be > 0) { using (var etiqueta = new Microsoft.Reporting.WebForms.LocalReport()) { etiqueta.ReportPath = "Etiqueta/etiqueta.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); etiqueta.DataSources.Add(datasource); ExportarEtiq(etiqueta); for (int x = 0; x < qtdEtiquetas; x++) { ImprimirEtiq(etiqueta); } } } }
public void insert(Ficha ficha) { try { dao = new FichaDAO(); if (ficha.Id == 0) { dao.insert(ficha); } else { dao.update(ficha); } } catch (OperacaoDAOException ex) { throw new BusinessException(ex.Message); } catch (DataBaseNotFoundException ex) { throw new BusinessException(ex.Message); } catch (NullReferenceException ex) //temporario { throw new BusinessException(ex.Message); } }
protected void btnPesquisar_Click(object sender, EventArgs e) { //int _nr_be = Convert.ToInt32(txbBE.Text); GridView1.DataSource = FichaDAO.GetListaFicha(txbNome.Text); GridView1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { string conexion = ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString; oneUser = FichaDAO.GetOne(new Tabla_Catalogo_FichaIdentificacionDTO { Id_FichaIdentificacion = Id_FichaIdentificacion }); if (!IsPostBack) { loadDiagnosticos(); loadProcedimiento(); loadUsuario(); SqlConnection cnn; cnn = new SqlConnection(conexion); cnn.Open(); string consulta = "select Id_Consulta from Tabla_Registro_Consulta where Id_Agenda=" + Id_Agenda + ""; SqlCommand comando = new SqlCommand(consulta, cnn); Id_Consulta = Convert.ToInt32(comando.ExecuteScalar()); Session["Id_Consultas"] = Id_Consulta; if (Id_Consulta != 0) { SqlCommand comando2 = new SqlCommand("SP_Registro_Consultas", cnn); comando2.CommandType = CommandType.StoredProcedure; comando2.Parameters.AddWithValue("@Opcion", "ENCONTRAR"); comando2.Parameters.AddWithValue("@Id_Consulta", Id_Consulta); SqlDataReader reader = comando2.ExecuteReader(); if (reader.Read()) { lblNombre.Text = NombreCompleto; //lblNombrecompleto.Text = NombreCompleto; lblfechaconsulta.Text = reader.IsDBNull(reader.GetOrdinal("Fecha_Consulta")) ? String.Empty : reader.GetDateTime(reader.GetOrdinal("Fecha_Consulta")).ToString(); lblsubjetivo.Text = reader.IsDBNull(reader.GetOrdinal("Subjetivo_Consulta")) ? " " : reader.GetString(reader.GetOrdinal("Subjetivo_Consulta")).ToString().Trim(); lblobjetivo.Text = reader.IsDBNull(reader.GetOrdinal("Objetivo_Consulta")) ? " " : reader.GetString(reader.GetOrdinal("Objetivo_Consulta")).ToString().Trim(); //txtdiagnostico.Text = reader.GetString(reader.GetOrdinal("Diagnostico_Consulta")).ToString().Trim(); Se elimino el txtdiagnostico //txtSearch.Text = reader.IsDBNull(reader.GetOrdinal("Diagnostico_Consulta")) ? "" : reader.GetString(reader.GetOrdinal("Diagnostico_Consulta")).ToString().Trim(); //txtProc.Text = reader.IsDBNull(reader.GetOrdinal("Procedimiento_Consulta")) ? "" : reader.GetString(reader.GetOrdinal("Procedimiento_Consulta")).ToString().Trim(); lblanalisis.Text = reader.IsDBNull(reader.GetOrdinal("Analisis_Consulta")) ? " " : reader.GetString(reader.GetOrdinal("Analisis_Consulta")).ToString().Trim(); lblplan.Text = reader.IsDBNull(reader.GetOrdinal("Plan_Consulta")) ? " " : reader.GetString(reader.GetOrdinal("Plan_Consulta")).ToString().Trim(); Session["Fechaconsulta"] = reader.GetDateTime(reader.GetOrdinal("Fecha_Consulta")).ToString(); } } else { DateTime hoy = DateTime.Now; fecha_actual = hoy.ToString("dd-MM-yyyy HH:mm:ss"); lblfechaconsulta.Text = fecha_actual; lblNombre.Text = NombreCompleto; Session["Fechaconsulta"] = fecha_actual; } cnn.Close(); } }
protected void changePaciente(object sender, EventArgs e) { Id_FichaIdentificacion = Convert.ToInt32(ddlFichas.SelectedItem.Value); var oneFicha = FichaDAO.GetOne(new Tabla_Catalogo_FichaIdentificacionDTO { Id_FichaIdentificacion = Id_FichaIdentificacion }); Response.Redirect("ConsultaMenu.aspx?Id_Agenda=0&Id_FichaIdentificacion=" + Id_FichaIdentificacion); }
public void remove(Ficha ficha) { try { dao = new FichaDAO(); dao.remove(ficha.Id); } catch (DataBaseNotFoundException ex) { throw new BusinessException(ex.Message); } catch (OperacaoDAOException ex) { throw new BusinessException(ex.Message); } }
public DataTable findNumero(Ficha ficha) { try { dao = new FichaDAO(); return(dao.findNumero(ficha)); } catch (OperacaoDAOException ex) { throw new BusinessException(ex.Message); } catch (DataBaseNotFoundException ex) { throw new BusinessException(ex.Message); } }
public Ficha findById(int id) { try { dao = new FichaDAO(); return(dao.findById(id)); } catch (OperacaoDAOException ex) { throw new BusinessException(ex.Message); } catch (DataBaseNotFoundException ex) { throw new BusinessException(ex.Message); } }
protected void upload(object sender, EventArgs e) { var oneFicha = FichaDAO.GetOne(new Tabla_Catalogo_FichaIdentificacionDTO { Id_FichaIdentificacion = Id_FichaIdentificacion }); string pathToCreate = "~/Pacientes/" + oneFicha.Id_FichaIdentificacion; if (!Directory.Exists(Server.MapPath(pathToCreate))) { Directory.CreateDirectory(Server.MapPath(pathToCreate)); } if (fleUpload.PostedFile != null) { fleUpload.SaveAs(Server.MapPath(pathToCreate) + "/" + fleUpload.PostedFile.FileName); } loadFile(oneFicha); }
protected void btnAtualizar_Click(object sender, EventArgs e) { string mensagem = ""; Ficha f = new Ficha(); f.cod_ficha = Convert.ToInt32(lbBE.Text); f.documento = txbDocumento.Text; f.rf = txbRF.Text; f.cns = txbCNS.Text; f.tipo_paciente = ddlTipoPaciente.SelectedValue; f.nome_paciente = txbNomePaciente.Text; if (txbNascimento.Text == "") { DateTime seData = new DateTime(1800, 1, 1); f.dt_nascimento = seData; } else { f.dt_nascimento = Convert.ToDateTime(txbNascimento.Text); } f.idade = txbIdade.Text; f.sexo = ddlSexo.SelectedValue; f.raca = ddlRaca.SelectedValue; f.endereco_rua = txbEndereco.Text; f.numero_casa = txbNumero.Text; f.complemento = txbComplemento.Text; f.bairro = txbBairro.Text; f.municipio = txbMunicipio.Text; f.uf = txbUF.Text; f.cep = txbCEP.Text; f.nome_pai_mae = txbPais.Text; f.responsavel = txbResponsavel.Text; f.telefone = txbTelefone.Text; f.telefone1 = txbTelefone1.Text; f.telefone2 = txbTelefone2.Text; f.email = txbEmail.Text; f.procedencia = ddlProcedencia.SelectedValue; f.info_resgate = txbInfoResgate.Text; mensagem = FichaDAO.AtualizarFicha(f.cod_ficha, f.documento, f.cns, f.tipo_paciente, f.nome_paciente, f.dt_nascimento, f.idade, f.sexo, f.raca, f.endereco_rua, f.numero_casa, f.complemento, f.bairro, f.municipio, f.uf, f.cep, f.nome_pai_mae, f.responsavel, f.telefone, f.telefone1, f.telefone2, f.email, f.procedencia, f.rf, f.info_resgate); ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + mensagem + "');", true); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Session["lAnalisis"] = new List <AnalisisClinicoDTO>(); loadPaquetes(); loadAnalisis(); } var Id_Paciente = Request.QueryString["Id_Paciente"]; if (Id_Paciente != null) { oneUser = FichaDAO.GetOne(new Tabla_Catalogo_FichaIdentificacionDTO { Id_FichaIdentificacion = Convert.ToInt32(Id_Paciente) }); spanName.InnerText = oneUser.Nombre_FichaIdentificacion.Trim() + " " + oneUser.ApPaterno_FichaIdentificacion.Trim(); } loadSelected(); }
protected void Button1_Click1(object sender, EventArgs e) { //using (var ds = CriarDataSet()) using (var relatorio = new Microsoft.Reporting.WebForms.LocalReport()) { relatorio.ReportPath = "Relatorios/Ficha.rdlc"; //relatorio.ReportPath = "Relatorios/Report.rdlc"; //relatorio.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("hspmPsDataSet", (DataTable)ds.Item)); FichaDAO sr = new FichaDAO(); List <Ficha> sc = new List <Ficha>(); //Ficha sc = new Ficha(); sc = sr.GetFicha(1);// ficha teste nº 1 IEnumerable <Ficha> ie; ie = sc.AsQueryable(); ReportDataSource datasource = new ReportDataSource("Ficha", ie); relatorio.DataSources.Add(datasource); Exportar(relatorio); Imprimir(relatorio); } }
protected void GrabafichaIdentificacion() { string nombrefila = ""; if (FileUpload1.HasFile) { string guardarPath = HttpContext.Current.Server.MapPath("ImagenesFicha/"); nombrefila = FileUpload1.FileName; string checarpath = guardarPath + nombrefila; string nombrefilachecar = ""; if (System.IO.File.Exists(checarpath)) { int contador = 2; while (System.IO.File.Exists(checarpath)) { nombrefilachecar = contador.ToString() + nombrefila; checarpath = guardarPath + nombrefilachecar; contador++; } nombrefila = nombrefilachecar.Trim(); Alerta2.Text = "A file with the same name already exists." + "<br />Your file was saved as " + nombrefila; } else { Alerta2.Text = "Your file was uploaded successfully."; } guardarPath = guardarPath + nombrefila; FileUpload1.SaveAs(guardarPath); } else { nombrefila = Session["imagen"].ToString(); Session["imagen"] = null; } /*SqlConnection cnn = new SqlConnection(ConfigurationManager.AppSettings.Get("strConnection"));*/ string conexion = ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString; SqlConnection cnn; cnn = new SqlConnection(conexion); cnn.Open(); SqlCommand comando = new SqlCommand("SP_Catalogo_FichaIdentificacion", cnn); comando.CommandType = CommandType.StoredProcedure; if (Id_FichaIdentificacion == 0) { comando.Parameters.AddWithValue("@Opcion", "INSERTAR"); } else { comando.Parameters.AddWithValue("@Opcion", "ACTUALIZAR"); comando.Parameters.AddWithValue("@Id_FichaIdentificacion", Id_FichaIdentificacion); } // string fechafichaidentificacion = txtFechaIdent.Value; //comando.Parameters.AddWithValue("@Cve_FichaIdentificacion", txtClaveIdent.Text.Trim()); //comando.Parameters.AddWithValue("@Fecha_FichaIdentificacion", Convert.ToDateTime(fechafichaidentificacion).ToString("yyyy/MM/dd")); comando.Parameters.AddWithValue("@Nombre_FichaIdentificacion", txtNombreIdent.Text.Trim()); comando.Parameters.AddWithValue("@ApPaterno_FichaIdentificacion", txtApPaIdent.Text.Trim()); comando.Parameters.AddWithValue("@ApMaterno_FichaIdentificacion", txtApMaIdent.Text.Trim()); //comando.Parameters.AddWithValue("@LugarNacimiento_FichaIdentificacion", txtLugarNaIdent.Text.Trim()); //comando.Parameters.AddWithValue("@FechaNacimiento_FichaIdentificacion", Convert.ToDateTime(txtFechaNaIdent.Value).ToString("yyyy/MM/dd")); //comando.Parameters.AddWithValue("@FechaPrimeraVisita_FichaIdentificacion", Convert.ToDateTime(txtFechaPriIdent.Value).ToString("yyyy/MM/dd")); //comando.Parameters.AddWithValue("@TelefonoCasa_FichaIdentificacion", txtTelCaIdent.Text.Trim()); comando.Parameters.AddWithValue("@TelefonoOfinica_FichaIdentificacion", txtTelOfiIdent.Text.Trim()); comando.Parameters.AddWithValue("@TelefonoMovil_FichaIdentificacion", txtTelMovIndent.Text.Trim()); comando.Parameters.AddWithValue("@CorreoElectronico_FichaIdentificacion", txtCorreoIdent.Text.Trim()); //comando.Parameters.AddWithValue("@CasoEmergencia_FichaIdentificacion", txtCasoEmeIdent.Text.Trim()); comando.Parameters.AddWithValue("@Foto_FichaIdentificacion", nombrefila.Trim()); comando.Parameters.AddWithValue("@Direccion_Calle_FichaIdentificacion", txtCalleIdent.Text.Trim()); comando.Parameters.AddWithValue("@Direccion_NoInt_FichaIdentificacion", txtNuIntIdent.Text.Trim()); //comando.Parameters.AddWithValue("@Direccion_NoExt_FichaIdentificacion", txtNuExtIdent.Text.Trim()); comando.Parameters.AddWithValue("@Direccion_Colonia_FichaIdentificacion", txtColoIdent.Text.Trim()); comando.Parameters.AddWithValue("@Direccion_Municipio_FichaIdentificacion", txtMuniIdent.Text.Trim()); //comando.Parameters.AddWithValue("@Direccion_Estado_FichaIdentificacion", txtEstIdent.Text.Trim()); //comando.Parameters.AddWithValue("@Direccion_Pais_FichaIdentificacion", txtPaisIdent.Text.Trim()); comando.Parameters.AddWithValue("@Direccion_CP_FichaIdentificacion", txtCoPosIdent.Text.Trim()); //comando.Parameters.AddWithValue("@ddlEmpresa", ddlEmpresa.SelectedValue); //comando.Parameters.AddWithValue("@ddlSucursal", Convert.ToInt32(ddlSucursal.SelectedValue)); //comando.Parameters.AddWithValue("@ddlSexo", ddlSexo.SelectedValue); //comando.Parameters.AddWithValue("@ddlEdoCivil", ddlEdoCivil.SelectedValue); //comando.Parameters.AddWithValue("@ddlOcupacion", ddlOcupacion.SelectedValue); //comando.Parameters.AddWithValue("@ddlEscolaridad", ddlEscolaridad.SelectedValue); //comando.Parameters.AddWithValue("@ddlEmpresaConvenio", ddlEmpresaConvenio.SelectedValue); //comando.Parameters.AddWithValue("@ddlReferidoPor", ddlReferidoPor.SelectedValue); //comando.Parameters.AddWithValue("@ddlAseguradora", ddlAseguradora.SelectedValue); SqlDataReader reader = comando.ExecuteReader(); reader.Read(); reader.Close(); comando = null; String Registro_Operacion_Btacora = ""; string Descripcion_Bitacora = ""; if (Id_FichaIdentificacion == 0) { Registro_Operacion_Btacora = "SP_Catalogo_FichaIdentificacion" + "@Opcion" + " = " + "INSERTAR" + "@Descripcion_EdoCivil" + " = " + txtNombreIdent.Text; Descripcion_Bitacora = "Inserta FichaIdentificacion nueva"; } else { Registro_Operacion_Btacora = "SP_Catalogo_FichaIdentificacion" + "@Opcion" + " = " + "ACTUALIZAR" + "@Id_FichaIdentificacion" + " = " + Convert.ToString(Id_FichaIdentificacion).Trim() + "@Descripcion_EdoCivil" + " = " + txtNombreIdent.Text; Descripcion_Bitacora = "Actualizar FichaIdentificacion"; } SqlCommand comandoBitacora = new SqlCommand("SP_Registro_Bitacora", cnn); comandoBitacora.CommandType = CommandType.StoredProcedure; comandoBitacora.Parameters.AddWithValue("@Id_Empresa", Convert.ToInt32(Session["Id_Empresa"])); comandoBitacora.Parameters.AddWithValue("@Id_Sucursal", Convert.ToInt32(Session["Id_Sucursal"])); comandoBitacora.Parameters.AddWithValue("@Id_Usuario", Convert.ToInt32(Session["Id_Usuario"])); comandoBitacora.Parameters.AddWithValue("@Registro_Operacion_Btacora", Registro_Operacion_Btacora); comandoBitacora.Parameters.AddWithValue("@Descripcion_Bitacora", Descripcion_Bitacora); SqlDataReader readerBitacora = comandoBitacora.ExecuteReader(); readerBitacora.Read(); readerBitacora.Close(); comandoBitacora = null; cnn.Close(); var oneFicha = FichaDAO.GetLast(); string pathToCreate = "~/Pacientes/" + oneFicha.Id_FichaIdentificacion; if (!Directory.Exists(Server.MapPath(pathToCreate))) { Directory.CreateDirectory(Server.MapPath(pathToCreate)); } Response.Redirect("FichaIdentificacion.aspx"); }
private void BindFicha(int _nr_be) { Ficha ficha = new Ficha(); ficha = FichaDAO.GetDadosBE(_nr_be); lbBE.Text = _nr_be.ToString(); txbSetor.Text = ficha.setor; //txbTipoPaciente.Text = ficha.tipo_paciente; if (ficha.tipo_paciente == "MUNÍCIPE") { ddlTipoPaciente.SelectedIndex = 0; } else if (ficha.tipo_paciente == "FUNCIONÁRIO") { ddlTipoPaciente.SelectedIndex = 1; } txbDtFicha.Text = ficha.dt_rh_be.ToString(); txbProntuario.Text = ficha.prontuario.ToString(); txbRF.Text = ficha.rf; txbNomePaciente.Text = ficha.nome_paciente; txbNascimento.Text = ficha.dt_nascimento.ToShortDateString(); txbIdade.Text = ficha.idade; txbQueixa.Text = ficha.queixa; txbCNS.Text = ficha.cns; txbDocumento.Text = ficha.documento; txbEndereco.Text = ficha.endereco_rua; txbNumero.Text = ficha.numero_casa; txbComplemento.Text = ficha.complemento; txbBairro.Text = ficha.bairro; txbMunicipio.Text = ficha.municipio; txbUF.Text = ficha.uf; txbCEP.Text = ficha.cep; txbPais.Text = ficha.nome_pai_mae; txbResponsavel.Text = ficha.responsavel; txbTelefone.Text = ficha.telefone; txbTelefone1.Text = ficha.telefone1; txbTelefone2.Text = ficha.telefone2; txbEmail.Text = ficha.email; txbInfoResgate.Text = ficha.info_resgate; if (ficha.procedencia == "ESPONTÂNEA") { ddlProcedencia.SelectedIndex = 0; } if (ficha.procedencia == "BOMBEIRO") { ddlProcedencia.SelectedIndex = 1; } if (ficha.procedencia == "POLÍCIA MILITAR") { ddlProcedencia.SelectedIndex = 2; } if (ficha.procedencia == "GCM") { ddlProcedencia.SelectedIndex = 3; } if (ficha.procedencia == "METRÔ") { ddlProcedencia.SelectedIndex = 4; } if (ficha.procedencia == "AMA - SÉ") { ddlTipoPaciente.SelectedIndex = 5; } if (ficha.procedencia == "SAMU") { ddlProcedencia.SelectedIndex = 6; } if (ficha.procedencia == "AMBULÂNCIA PARTICULAR") { ddlProcedencia.SelectedIndex = 5; } if (ficha.sexo == "Masculino") { ddlSexo.SelectedIndex = 0; } if (ficha.sexo == "Feminino") { ddlSexo.SelectedIndex = 1; } if (ficha.sexo == "Não informado") { ddlSexo.SelectedIndex = 2; } if (ficha.raca == "Branca") { ddlRaca.SelectedIndex = 0; } if (ficha.raca == "Preta") { ddlRaca.SelectedIndex = 1; } if (ficha.raca == "Parda") { ddlRaca.SelectedIndex = 2; } if (ficha.raca == "Amarela") { ddlRaca.SelectedIndex = 3; } if (ficha.raca == "Indígena") { ddlRaca.SelectedIndex = 4; } }
private void loadPacientes() { ddlUsuarios.DataSource = FichaDAO.GetAll(); ddlUsuarios.DataBind(); }
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); } } }
protected void Page_Load(object sender, EventArgs e) { bool estatuspermiso = false; estatuspermiso = Convert.ToBoolean(Session["estatuspermiso"]); int usuario = Convert.ToInt32(Session["inicio"]); //LlenarUsuario(); //loadPacientes(); //if (Id_FichaIdentificacion != 0) //{ // ddlUsuarios.SelectedValue = Id_FichaIdentificacion.ToString(); // loadUsuario(); // } if (Session["inicio"] == null || usuario == 0) { Response.Redirect("Default.aspx"); } else if (estatuspermiso == false) { string valornombrepagina = "Agenda.aspx"; string consulta; SqlCommand comando; int numeroidmodulo = 0; string consulta2; SqlCommand comando2; int valoridperfildeusuario = 0; valoridperfildeusuario = Convert.ToInt32(Session["inicioidperfil"]); string conexion = ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString; SqlConnection cnn; cnn = new SqlConnection(conexion); cnn.Open(); consulta = "Select Id_Modulo from Tabla_Catalogo_Modulo where Programa_Modulo='" + valornombrepagina + "'"; comando = new SqlCommand(consulta, cnn); numeroidmodulo = Convert.ToInt32(comando.ExecuteScalar()); consulta2 = "select Estatus_Permiso from Tabla_Registro_Permisos_Perfil where Id_Modulo=" + numeroidmodulo + " and Id_Perfil=" + valoridperfildeusuario + ""; comando2 = new SqlCommand(consulta2, cnn); estatuspermiso = Convert.ToBoolean(comando2.ExecuteScalar()); cnn.Close(); if (estatuspermiso == true) { } else { //System.Web.HttpContext.Current.Response.Write("<script>javascript: alert('Este usuario no tiene acceso a la pagina solicitada');</script>"); Session["alerta"] = "<p style=\"color: white;background-color: blue\">No tiene permiso para acceder a 'Agenda'</p>"; Response.Redirect("MenuInicial.aspx"); } } if (!IsPostBack) { ddlUsuarios.DataSource = FichaDAO.GetAll(); ddlUsuarios.DataBind(); // ddlUsuarios.Text = NombreCompleto; DateTime hoy = DateTime.Now; fecha_actual = hoy.ToString("dd-MM-yyyy HH:mm:ss"); DropDownDiaComienzo.SelectedValue = hoy.Day.ToString(); DropDownMesComienzo.SelectedIndex = (hoy.Month) - 1; DropDownAnioComienzo.SelectedValue = hoy.Year.ToString(); DropDownDiaFinal.SelectedValue = hoy.Day.ToString(); DropDownMesFinal.SelectedIndex = (hoy.Month) - 1; DropDownAnioFinal.SelectedValue = hoy.Year.ToString(); rbNormal.Checked = true; LlenarCMBCategoria(); if (Id_Agenda != 0) { string conexion = ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString; SqlConnection cnn; cnn = new SqlConnection(conexion); cnn.Open(); SqlCommand comando = new SqlCommand("SP_Registro_Agenda", cnn); comando.CommandType = CommandType.StoredProcedure; comando.Parameters.AddWithValue("@Opcion", "ENCONTRAR"); comando.Parameters.AddWithValue("@Id_Agenda", Id_Agenda); SqlDataReader reader = comando.ExecuteReader(); if (reader.Read()) { txtaltaagenda.Value = reader.GetDateTime(reader.GetOrdinal("Fecha_Agenda")).ToString(); DateTime inicioagenda = reader.GetDateTime(reader.GetOrdinal("Inicio_Agenda")); txtDiaComienzo.Value = inicioagenda.ToString(); DropDownDiaComienzo.SelectedValue = inicioagenda.Day.ToString(); DropDownMesComienzo.SelectedIndex = (inicioagenda.Month) - 1; DropDownAnioComienzo.SelectedValue = inicioagenda.Year.ToString(); DropDownHoraComienzo.SelectedValue = inicioagenda.ToString("%h"); DropDownMinutoComienzo.SelectedValue = inicioagenda.ToString("mm"); DropDowndiatardeComienzo.SelectedValue = inicioagenda.ToString("tt"); string prioridad = reader.GetString(reader.GetOrdinal("Prioridad_Agenda")).Trim(); if (prioridad == "Normal") { rbNormal.Checked = true; rbUrgente.Checked = false; } else if (prioridad == "Urgente") { rbUrgente.Checked = true; rbNormal.Checked = false; } DropDownEstadoCitas.SelectedValue = reader.GetString(reader.GetOrdinal("EstadoCitas_Agenda")).ToString().Trim(); DateTime finagenda = reader.GetDateTime(reader.GetOrdinal("Fin_Agenda")); txtDiaFinal.Value = finagenda.ToString(); DropDownDiaFinal.SelectedValue = finagenda.Day.ToString(); DropDownMesFinal.SelectedIndex = (finagenda.Month) - 1; DropDownAnioFinal.SelectedValue = finagenda.Year.ToString(); DropDownHoraFinal.SelectedValue = finagenda.ToString("%h"); DropDownMinutoFinal.SelectedValue = finagenda.ToString("mm"); DropDowndiatardeFinal.SelectedValue = finagenda.ToString("tt"); txtasunto.Text = reader.GetString(reader.GetOrdinal("Asunto_Agenda")).ToString().Trim(); txtdescripcionagenda.Text = reader.GetString(reader.GetOrdinal("Descripcion_Agenda")).ToString(); ddlCategoria.SelectedIndex = reader.GetInt32(reader.GetOrdinal("Id_Categoria")); //ddlUsuarios.SelectedIndex = reader.GetInt32(reader.GetOrdinal("Id_FichaIdentificacion")); } } if (Id_FichaIdentificacion != 0) { ddlUsuarios.SelectedValue = Id_FichaIdentificacion.ToString(); ////txtidfichaidentificacion.Text = Id_FichaIdentificacion.ToString(); //ddlUsuarios.Text = NombreCompleto.ToString(); //ddlUsuarios.SelectedIndex = Id_FichaIdentificacion; //txtnombrecompleto.Text = Id_FichaIdentificacion.ToString(); } } if (txtaltaagenda.Value == "") { txtaltaagenda.Value = DateTime.Now.ToString(); } }
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"); }