protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ClsCiudad ciudadDAO = new ClsCiudad(); drpCiudad.DataSource = ciudadDAO.consularTodo(); drpCiudad.DataValueField = "id_ciudad"; drpCiudad.DataTextField = "ciudad1"; drpCiudad.DataBind(); ClsEspecialidad especialidadDAO = new ClsEspecialidad(); drpEspecialidad.DataSource = especialidadDAO.consultarTodos(); drpEspecialidad.DataValueField = "id_especialidad"; drpEspecialidad.DataTextField = "especialidad1"; drpEspecialidad.DataBind(); if (int.Parse(Session["idRol"].ToString()) == 2) { ClsEnteSalud ente = new ClsEnteSalud(); ddlEnte.DataSource = ente.EnteAsociado(int.Parse(Session["idPersona"].ToString())); ddlEnte.DataValueField = "id_ente"; ddlEnte.DataTextField = "datos"; ddlEnte.DataBind(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ClsEnteSalud enteSalud = new ClsEnteSalud(); if (int.Parse(Session["idRol"].ToString()) == 1) { gdgGrid.DataSource = enteSalud.ConsultarEnte(); gdgGrid.DataBind(); if (gdgGrid.Rows.Count != 0) { gdgGrid.HeaderRow.TableSection = TableRowSection.TableHeader; // Agrega etiqueta: <thead> a la tabla } } else if (int.Parse(Session["idRol"].ToString()) == 2) { gdvEnte.DataSource = enteSalud.ConsultarEnteAsociado(int.Parse(Session["idPersona"].ToString())); gdvEnte.DataBind(); if (gdvEnte.Rows.Count != 0) { gdvEnte.HeaderRow.TableSection = TableRowSection.TableHeader; } } else { ClsCita cita = new ClsCita(); gdvCita.DataSource = cita.AllFindConsulCita(int.Parse(Session["idPersona"].ToString())); gdvCita.DataBind(); if (gdvCita.Rows.Count != 0) { gdvCita.HeaderRow.TableSection = TableRowSection.TableHeader; } } } }
protected void Page_Load(object sender, EventArgs e) { lblEspe.Text = ClsEspecialista.CountEspecialistas().ToString(); lblCita.Text = ClsCita.CountCita().ToString(); lblEnte.Text = ClsEnteSalud.CountEste().ToString(); if (!IsPostBack) { ClsEnteSalud enteSalud = new ClsEnteSalud(); gdgGrid.DataSource = enteSalud.ConsultarEnte(); gdgGrid.DataBind(); //gdgGrid.HeaderRow.TableSection = TableRowSection.TableHeader; // Agrega etiqueta: <thead> a la tabla } }
protected void gdgGrid_RowCommand(object sender, GridViewCommandEventArgs e) { GridViewRow filaSeleccionada = (GridViewRow)((Control)e.CommandSource).NamingContainer; int rowIndex = filaSeleccionada.RowIndex; if (e.CommandName == "Asignar") { int id_persona = 3; int id_ente = int.Parse(gdgGrid.Rows[rowIndex].Cells[0].Text); ClsEnteSalud ente = new ClsEnteSalud(); ente.AsignarPersona(id_persona, id_ente); Page.RegisterStartupScript("script", "<script languaje=JavaScript>alert('Asignación exitosa');location.href='dashboard.aspx';</script>"); } }
protected void btnRegistrarEnte_Click(object sender, EventArgs e) { string mensaje = string.Empty; ClsEnteSalud clsEnte = new ClsEnteSalud(); Ente_salud ente_Salud = new Ente_salud(); ClsPersona clsPersona = new ClsPersona(); Persona persona = new Persona(); //ente_Salud.id_persona = int.Parse(Session["idPersona"].ToString()); ente_Salud.nit = int.Parse(TextNit.Text); ente_Salud.razon_social = TextRazonS.Text; ente_Salud.representante = TextRepresentante.Text; ente_Salud.correo = TextCorreo.Text; ente_Salud.telefono = TextTelefono.Text; ente_Salud.sitio_web = textSitioW.Text; ente_Salud.id_ciudad = int.Parse(DropDownList.SelectedValue.ToString()); ente_Salud.capacidad_pacientes = int.Parse(TextCapacidad.Text); mensaje = clsEnte.Registrar(ente_Salud); Page.RegisterStartupScript("script", "<script languaje=JavaScript>alert('" + mensaje + "');location.href='agregarEnte.aspx';</script>"); }
public List <ente_salud> ConsultarEnte() { return(ClsEnteSalud.consultarEnte()); }