getCentroId() public method

public getCentroId ( string centro ) : long
centro string
return long
Example #1
0
    protected void acceptButton_Click(object sender, EventArgs e)
    {
        try
        {
            if (this.IsValid)
            {
                List<string> persAdded = new List<string>();

                foreach (ListItem it in permisos_CBList.Items)
                {
                    if (it.Selected == true)
                    {
                        persAdded.Add(it.Text);
                        it.Selected = false;
                    }
                }

                AdministradordeSistema admin = new AdministradordeSistema();//tmp-> deberia ser quien este logeado!
                Security sec = new Security();
                long centro = sec.getCentroId(centros.Text);
                admin.crearRol(descripcion_TB.Text, persAdded, centro);

                Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Rol Guardado')", true);
                LimpiarPage();
            }
        }
        catch (Exception err)
        {
            Session["Error_Msg"] = err.Message;
            Response.Redirect("~/Error.aspx", true);
        }
    }
    protected void acceptButton_Click(object sender, EventArgs e)
    {
        try
        {
            List<string> revokes = new List<string>();
            //bool flag = false;

            foreach (ListItem it in permisos_CBList.Items)
            {
                if (it.Selected == false)
                {
                    revokes.Add(it.Text);
                    //flag = true;
                }
            }

            List<string> grants = new List<string>();

            foreach (ListItem it in otrosPermisos_CBList.Items)
            {
                if (it.Selected == true)
                {
                    grants.Add(it.Text);
                    //flag = true;
                }
            }

            /*if (flag)
            {*/
                BL.Rol rl = new Rol();
                long rolId = rl.getRolID(descripciones_DDList.SelectedItem.Text);
                AdministradordeSistema admin = new AdministradordeSistema();

                Security sec = new Security();
                long centro = sec.getCentroId(centros.Text);
                admin.editarRol(rolId, descripciones_DDList.SelectedItem.Text, grants, revokes, centro);

                Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Rol Editado')", true);
                setCheckBoxes();
            /*}
            else
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Rol No Editado')", true);
            }*/
        }
        catch (Exception ex)
        {
            Session["Error_Msg"] = ex.Message;
            Response.Redirect("~/Error.aspx", true);
        }
    }
Example #3
0
    protected void btnBuscar_Click(object sender, EventArgs e)
    {
        try
        {
            BL.Paciente p = new BL.Paciente();
            BL.Security sec = new BL.Security();
            int CId = (int)sec.getCentroId(cboCentro.SelectedValue);
            long exp = long.Parse(txtExpediente.Text);
            if (p.leerPaciente(CId, exp))
            {
                txtCedula.Text = p.Cedula;
                txtNombres.Text = p.Nombres;
                txtPrimerApellido.Text = p.PrimerApellido;
                txtSegundoApellido.Text = p.SegundoApellido;
                txtDireccion.Text = p.Direccion;
                if (p.Sexo)
                {
                    rdMasculino.Selected = true;
                }
                else
                {
                    rdFemenino.Selected = true;
                }
                txtLugarNacimiento.Text = p.LugarNac;

                dia = p.FechaNac.Day.ToString();
                mes = p.FechaNac.Month.ToString();
                anio = p.FechaNac.Year.ToString();
                fecha = anio + (mes.Length == 1 ? "-0" : "-") + mes + (dia.Length == 1 ? "-0" : "-") + dia;
                txtFechaNacimiento.Text = fecha;

                dia = p.FechaIngreso.Day.ToString();
                mes = p.FechaIngreso.Month.ToString();
                anio = p.FechaIngreso.Year.ToString();
                fecha = anio + (mes.Length == 1 ? "-0" : "-") + mes + (dia.Length == 1 ? "-0" : "-") + dia;
                txtFechaIngreso.Text = fecha;
                Response.Write("<script>alert('El paciente Se ha encontrado exitosamente')</script>");
            }
            else
            {
                Response.Write("<script>alert('El paciente que busca no existe')</script>");
            }
        }
        catch (Exception err)
        {
            Session["Error_Msg"] = err.Message;
            Response.Redirect("~/Error.aspx", true);
        }
    }
Example #4
0
    protected void btnEditar_Click(object sender, EventArgs e)
    {
        try
        {
            BL.Security sec = new BL.Security();
            int CId = (int)sec.getCentroId(cboCentro.SelectedValue);
            long exp = long.Parse(txtExpediente.Text);
            BL.Paciente pac = new BL.Paciente();
            if (pac.leerPaciente(CId, exp))
            {

                int yy = int.Parse(txtFechaNacimiento.Text.Substring(0, 4));
                int mm = int.Parse(txtFechaNacimiento.Text.Substring(5, 2));
                int dd = int.Parse(txtFechaNacimiento.Text.Substring(8, 2));
                DateTime fechaNac = new DateTime(yy, mm, dd);

                yy = int.Parse(txtFechaIngreso.Text.Substring(0, 4));
                mm = int.Parse(txtFechaIngreso.Text.Substring(5, 2));
                dd = int.Parse(txtFechaIngreso.Text.Substring(8, 2));
                DateTime fechaIng = new DateTime(yy, mm, dd);

                pac.asignarDatos(pac.CentroActual, Int64.Parse(txtExpediente.Text), txtNombres.Text, txtPrimerApellido.Text, txtSegundoApellido.Text,
                                          fechaNac, rdMasculino.Selected, fechaIng,
                                          txtCedula.Text, txtDireccion.Text, txtLugarNacimiento.Text,
                                          ddEstado.SelectedItem.Text);

                if (pac.editarPaciente())
                {
                    Response.Write("<script>alert('El paciente se ha editado exitosamente')</script>");
                }
                else
                {
                    Response.Write("<script>alert('No se ha podido editar el registro del paciente')</script>");
                }
            }
        }
        catch (Exception err)
        {
            Session["Error_Msg"] = err.Message;
            Response.Redirect("~/Error.aspx", true);
        }
    }
    protected void searchBtn_Click(object sender, EventArgs e)
    {
        try
        {
            this.Validate();

            if (this.IsValid)
            {
                Security sec = new Security();
                long centroSel = sec.getCentroId(centrosPermitidos.Text);

                GridView1.DataSource = sp.BusquedaRapida(nombres_TB.Text, primerApellido_TB.Text, segundoApellido_TB.Text, cedula_TB.Text, centroSel);
                GridView1.DataBind();
            }
        }
        catch (Exception ex)
        {
            Session["Error_Msg"] = ex.Message;
            Response.Redirect("~/Error.aspx", true);
        }
    }
Example #6
0
 protected void btnImprimir_Click(object sender, EventArgs e)
 {
     try
     {
         BL.Security sec = new BL.Security();
         int CId = (int)sec.getCentroId(cboCentro.SelectedValue);
         long exp = long.Parse(txtExpediente.Text);
         BL.Paciente pac = new BL.Paciente();
         if (pac.leerPaciente(CId, exp))
         {
             String pageArgs = String.Format("HojaPaciente.aspx?Expediente={0}&CentroActual={1}", exp,CId);
             LiteralControl lctl = new LiteralControl("<script type=\"text/javascript\"> function init(){" + String.Format("window.open('{0}', 'Información del Paciente', 'width=1000, height=600, scrollbars=yes');", pageArgs) + "} window.onload = init(); </script>");
             Page.Header.Controls.Add(lctl);
         }
     }
     catch (Exception err)
     {
         Session["Error_Msg"] = err.Message;
         Response.Redirect("~/Error.aspx", true);
     }
 }
Example #7
0
 protected void btnEliminar_Click(object sender, EventArgs e)
 {
     try
     {
         BL.Security sec = new BL.Security();
         int CId = (int)sec.getCentroId(cboCentro.SelectedValue);
         long exp = long.Parse(txtExpediente.Text);
         BL.Paciente pac = new BL.Paciente();
         if (pac.leerPaciente(CId, exp))
         {
             if (pac.eliminarPaciente())
             {
                 Response.Write("<script>alert('El registro del paciente ha sido eliminado')</script>");
                 cleanPage();
             }
             else
             {
                 Response.Write("<script>alert('No se ha podido eliminar el registro del paciente')</script>");
             }
         }
     }
     catch (Exception err)
     {
         Session["Error_Msg"] = err.Message;
         Response.Redirect("~/Error.aspx", true);
     }
 }