예제 #1
0
 protected void dpSub_SelectedIndexChanged(object sender, EventArgs e)
 {
     MedicoDao medDao = new MedicoDao();
     List<String> lst = new List<String>();
     lst = medDao.lstMedSub(dpSub.SelectedValue);
     List<Medicos> lstMedicos = new List<Medicos>();
     lstMedicos = (List<Medicos>)ViewState["Medicos"];
     if (!dpSub.SelectedValue.Equals("0"))
     {
         List<Medicos> lstMedicosSub = new List<Medicos>();
         for (int i = 0; i < lst.Count; i++)
         {
             Medicos medico = new Medicos();
             medico = lstMedicos.Find(x => x.Value[0].Rut.Equals(lst[i].ToLower()));
             if (medico != null)
                 lstMedicosSub.Add(medico);
         }
         DataList2.DataSource = lstMedicosSub;
     }
     else
     {
         DataList2.DataSource = lstMedicos;
     }
     DataList2.DataBind();
 }
예제 #2
0
        protected void dpSub_SelectedIndexChanged(object sender, EventArgs e)
        {
            MedicoDao        medDao    = new MedicoDao();
            AgendaDao        oAgenda   = new AgendaDao();
            CultureInfo      ci        = new CultureInfo("Es-Es");
            List <String>    lst       = new List <String>();
            List <BO.Agenda> lstAgenda = new List <BO.Agenda>();

            lst = medDao.lstMedSub(dpSub.SelectedValue);
            List <Medicos> lstMedicos = new List <Medicos>();

            lstMedicos = (List <Medicos>)ViewState["Medicos"];
            if (!dpSub.SelectedValue.Equals("0") || (lst.Count != 0))
            {
                List <Medicos> lstMedicosSub = new List <Medicos>();
                for (int i = 0; i < lst.Count; i++)
                {
                    Medicos medico = new Medicos();
                    medico = lstMedicos.Find(x => x.Value[0].Rut.Equals(lst[i].ToLower()));
                    if (medico != null)
                    {
                        lstAgenda        = oAgenda.GetAgenda("", Convert.ToInt32(medico.IdMedico).ToString());
                        medico.FechaServ = lstAgenda[0].Fecha;
                        DateTime FechaPaso = DateTime.Parse(lstAgenda[0].Fecha.Substring(0, 2) + "/" + lstAgenda[0].Fecha.Substring(2, 2) + "/" + lstAgenda[0].Fecha.Substring(4, 4));
                        medico.Fecha = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(ci.DateTimeFormat.GetDayName(FechaPaso.DayOfWeek)) + " " + FechaPaso.ToString("dd/MM/yyyy")
                                       + " " + lstAgenda[0].Fecha.Substring(8, 2) + ":" + lstAgenda[0].Fecha.Substring(10, 2) + " hrs";
                        medico.Especialidad = lstAgenda[0].Especialidad;
                        lstMedicosSub.Add(medico);
                    }
                }
                DataList2.DataSource = lstMedicosSub;
                DataList2.DataBind();
                //DataPager1.DataBind();
            }
            else
            {
                DataList2.DataSource = lstMedicos;
                DataList2.DataBind();
                //DataPager1.DataBind();
            }
        }