//Retorna nombres de los pacientes
        public List<string> Busqueda_pacientes(string nombre)
        {
            try
            {
                List<string> usrs = new List<string>();

                var users = from p in entities.pacientes
                            where p.nombres.Contains(nombre)
                            select new {p.expediente,p.centro_actual,p.nombres,p.primer_apellido,p.segundo_apellido};

                Centro c = new Centro();

                foreach (var u in users)
                    usrs.Add(u.expediente+ " / " + c.getLugar(u.centro_actual) + " - " +u.nombres+" "+u.primer_apellido+" "+u.segundo_apellido);

                return usrs;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
        }
    private void setCheckBoxes()
    {
        try
        {
            BL.Rol rl = new Rol();
            List<string> pers = rl.getRolPermisos(descripciones_DDList.SelectedItem.Text);
            permisos_CBList.DataSource = pers;
            permisos_CBList.DataBind();

            foreach (ListItem it in permisos_CBList.Items)
                it.Selected = true;

            BL.Permiso per = new Permiso();
            List<string> otherPers = new List<string>();
            List<string> allPers = per.getPermisosID();

            foreach (string pr in allPers)
            {
                bool flag = false;
                foreach (string myper in pers)
                {
                    if (pr == myper)
                    {
                        flag = true;
                        break;
                    }
                }
                if (!flag)
                    otherPers.Add(pr);
            }
            otrosPermisos_CBList.DataSource = otherPers;
            otrosPermisos_CBList.DataBind();

            long c_id = rl.getCentroID(descripciones_DDList.SelectedItem.Text);
            BL.Centro c = new BL.Centro();
            string c_lugar = c.getLugar(c_id);
            centros.SelectedValue = c_lugar;

            /*for (int i = 0; i < centros.Items.Count; i++)
            {
                if (centros.Items[i].Text == c_lugar)
                {
                    centros.Items[i].Selected = true;

                    break;
                }
            }*/
        }
        catch (Exception ex)
        {
            Session["Error_Msg"] = ex.Message;
            Response.Redirect("~/Error.aspx", true);
        }
    }
Beispiel #3
0
        //Retorna nombres de los pacientes
        public List<string> Busqueda_pacientes(string nombre, string identificacion, DateTime fecha)
        {
            try
            {
                List<string> usrs = new List<string>();
                DateTime fechaIngresoFin = new DateTime(fecha.Year, fecha.Month, fecha.Day, 23, 59, 59);

                var users = from p in entities.pacientes
                            where p.nombres.Contains(nombre) && ((p.fecha_ingreso.CompareTo(fecha) == 0 || p.fecha_ingreso.CompareTo(fecha) > 0) && (p.fecha_ingreso.CompareTo(fechaIngresoFin) == 0 || p.fecha_ingreso.CompareTo(fechaIngresoFin) < 0)) && p.cedula.Contains(identificacion)
                            select new { p.expediente, p.centro_actual, p.nombres, p.primer_apellido, p.segundo_apellido };

                Centro c = new Centro();

                foreach (var u in users)
                    usrs.Add(u.expediente + " / " + c.getLugar(u.centro_actual) + " - " + u.nombres + " " + u.primer_apellido + " " + u.segundo_apellido);

                return usrs;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
        }