protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { //Label1.Attributes.Add("onclick", "javascript:ActivarPostClickAceptar();" + Page.ClientScript.GetPostBackEventReference(this.Label1, string.Empty) + ";"); //LinkButton3_ModalPopupExtender.Hide(); String cadena; String[] master = Utilidades.Seguridad.DesEncriptarSap(Request.QueryString["r"], out cadena); HiddenField hdMaster = (HiddenField)Master.FindControl("hdToken"); HttpContext context; context = HttpContext.Current; Agenda agendas = new Agenda(); agendas = (Agenda)context.Items["Agenda"]; ViewState["origen"] = (String)context.Items["origen"]; ViewState["Rut"] = (String)context.Items["Rut"]; ViewState["IdEspecialidad"] = (String)context.Items["IdEspecialidad"]; ViewState["Especialidad"] = (String)context.Items["Especialidad"]; List <Agenda> lstbusqueda = new List <Agenda>(); lstbusqueda = (List <Agenda>)context.Items["Agendas"]; ViewState["Agendas"] = lstbusqueda; List <Medicos> lstMedicos = (List <Medicos>)context.Items["Medicos"]; ViewState["lstMedicos"] = lstMedicos; Medicos medico = new Medicos(); medico = (Medicos)context.Items["Medico"]; hdMaster.Value = Request.QueryString["r"]; if (master.Length > 6) { HiddenField hdtipo = (HiddenField)Master.FindControl("hdTipo"); hdtipo.Value = "V"; } Literal litPag = (Literal)Master.FindControl("litPag1"); litPag.Text = "Reserva de hora > Detalle Agenda >"; ViewState["lstmedicos"] = lstbusqueda; DateTime fechaAgenda = DateTime.Parse(agendas.Fecha.Substring(0, 2) + "-" + agendas.Fecha.Substring(2, 2) + "-" + agendas.Fecha.Substring(4, 4)); CultureInfo ci = new CultureInfo("Es-Es"); lbFecha.Text = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(ci.DateTimeFormat.GetDayName(fechaAgenda.DayOfWeek) + " " + fechaAgenda.Day) + " de " + CultureInfo.CurrentCulture.TextInfo.ToTitleCase(ci.DateTimeFormat.GetMonthName(fechaAgenda.Month) + " " + fechaAgenda.Year); MedicoDao oMedicoDao = new MedicoDao(); ViewState["medico"] = medico; ViewState["Agenda"] = agendas; ImgDr.ImageUrl = medico.Value[0].oImagenes.Url; lbNombre.Text = medico.Value[0].Nombres + " " + medico.Value[0].Apellidos; String fecha = agendas.Fecha.Substring(0, 8); ViewState["Fecha"] = agendas.Fecha; List <DispoDiaria> lstDis = new List <DispoDiaria>(); lstDis = oMedicoDao.GetDisponibilidadDiaria(medico.Value[0].VMA, fecha, agendas.Id_especialidad); dlDisHora.DataSource = lstDis; dlDisHora.DataBind(); List <String> lstMes = new List <string>(); lstMes = oMedicoDao.GetDisponibilidadMensual("01" + agendas.Fecha.Substring(2, 6), medico.Value[0].VMA); calendar.VisibleDate = new DateTime(int.Parse(lstMes[0].Substring(4, 4)), int.Parse(lstMes[0].Substring(2, 2)), 01); calendar.SelectedDate = new DateTime(int.Parse(agendas.Fecha.Substring(4, 4)), int.Parse(agendas.Fecha.Substring(2, 2)), int.Parse(agendas.Fecha.Substring(0, 2))); ViewState["Mes"] = lstMes; lbEspecialidad.Text = agendas.Especialidad; PacienteDao oPaciente = new PacienteDao(); } }
protected void calendar_VisibleMonthChanged(object sender, MonthChangedEventArgs e) { DateTime fecha = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1); if (e.NewDate >= fecha) { MedicoDao oMedicoDao = new MedicoDao(); Medicos medico = new Medicos(); medico = (Medicos)ViewState["medico"]; List <String> lstMes = new List <string>(); lstMes = oMedicoDao.GetDisponibilidadMensual("01" + e.NewDate.ToString("MMyyyy"), medico.Value[0].VMA); ViewState["Mes"] = lstMes; } else { calendar.VisibleDate = e.PreviousDate; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { //Label1.Attributes.Add("onclick", "javascript:ActivarPostClickAceptar();" + Page.ClientScript.GetPostBackEventReference(this.Label1, string.Empty) + ";"); //LinkButton3_ModalPopupExtender.Hide(); HttpContext context; context = HttpContext.Current; BO.Agenda agendas = new BO.Agenda(); if (Request.QueryString["vma"] == null) { agendas = (BO.Agenda)context.Items["Agenda"]; ViewState["origen"] = (String)context.Items["origen"]; ViewState["IdEspecialidad"] = (String)context.Items["IdEspecialidad"]; ViewState["Especialidad"] = (String)context.Items["Especialidad"]; List <BO.Agenda> lstbusqueda = new List <BO.Agenda>(); lstbusqueda = (List <BO.Agenda>)context.Items["Agendas"]; ViewState["Agendas"] = lstbusqueda; List <Medicos> lstMedicos = (List <Medicos>)context.Items["Medicos"]; ViewState["lstMedicos"] = lstMedicos; Medicos medico = new Medicos(); medico = (Medicos)context.Items["Medico"]; ViewState["lstmedicos"] = lstbusqueda; DateTime fechaAgenda = DateTime.Parse(medico.FechaServ.Substring(0, 2) + "-" + medico.FechaServ.Substring(2, 2) + "-" + medico.FechaServ.Substring(4, 4)); //DateTime.Parse(agendas.Fecha.Substring(0, 2) + "-" + agendas.Fecha.Substring(2, 2) + "-" + agendas.Fecha.Substring(4, 4)); CultureInfo ci = new CultureInfo("Es-Es"); lbFecha.Text = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(ci.DateTimeFormat.GetDayName(fechaAgenda.DayOfWeek) + " " + fechaAgenda.Day) + " de " + CultureInfo.CurrentCulture.TextInfo.ToTitleCase(ci.DateTimeFormat.GetMonthName(fechaAgenda.Month) + " " + fechaAgenda.Year); MedicoDao oMedicoDao = new MedicoDao(); ViewState["medico"] = medico; ViewState["Agenda"] = agendas; ImgDr.ImageUrl = medico.Value[0].oImagenes.Url; lbNombre.Text = medico.Value[0].Nombres + " " + medico.Value[0].Apellidos; String fecha = medico.FechaServ.Substring(0, 8); ViewState["Fecha"] = medico.FechaServ; List <DispoDiaria> lstDis = new List <DispoDiaria>(); lstDis = oMedicoDao.GetDisponibilidadDiaria(medico.Value[0].VMA, fecha, agendas.Id_especialidad); dlDisHora.DataSource = lstDis; dlDisHora.DataBind(); List <String> lstMes = new List <string>(); lstMes = oMedicoDao.GetDisponibilidadMensual("01" + medico.FechaServ.Substring(2, 6), medico.Value[0].VMA); calendar.VisibleDate = new DateTime(int.Parse(lstMes[0].Substring(4, 4)), int.Parse(lstMes[0].Substring(2, 2)), 01); calendar.SelectedDate = new DateTime(int.Parse(medico.FechaServ.Substring(4, 4)), int.Parse(medico.FechaServ.Substring(2, 2)), int.Parse(medico.FechaServ.Substring(0, 2))); ViewState["Mes"] = lstMes; lbEspecialidad.Text = medico.Especialidad;// agendas.Especialidad; } else { AgendaDao AgendaDao = new AgendaDao(); String vma = Request.QueryString["vma"]; List <BO.Agenda> lstbusqueda = new List <BO.Agenda>(); lstbusqueda = AgendaDao.GetAgenda("", vma); agendas = lstbusqueda[0]; MedicoDao oMedicoDao = new MedicoDao(); Medicos oMedico = new Medicos(); oMedico = oMedicoDao.GetMedico(lstbusqueda[0].RutMed); ViewState["origen"] = "3"; ViewState["IdEspecialidad"] = lstbusqueda[0].Id_especialidad; ViewState["Especialidad"] = lstbusqueda[0].Especialidad; ViewState["Agendas"] = lstbusqueda; ViewState["lstmedicos"] = lstbusqueda; DateTime fechaAgenda = DateTime.Parse(agendas.Fecha.Substring(0, 2) + "-" + agendas.Fecha.Substring(2, 2) + "-" + agendas.Fecha.Substring(4, 4)); CultureInfo ci = new CultureInfo("Es-Es"); lbFecha.Text = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(ci.DateTimeFormat.GetDayName(fechaAgenda.DayOfWeek) + " " + fechaAgenda.Day) + " de " + CultureInfo.CurrentCulture.TextInfo.ToTitleCase(ci.DateTimeFormat.GetMonthName(fechaAgenda.Month) + " " + fechaAgenda.Year); ViewState["medico"] = oMedico; ViewState["Agenda"] = agendas; ImgDr.ImageUrl = oMedico.Value[0].oImagenes.Url; lbNombre.Text = oMedico.Value[0].Nombres + " " + oMedico.Value[0].Apellidos; String fecha = agendas.Fecha.Substring(0, 8); ViewState["Fecha"] = agendas.Fecha; List <DispoDiaria> lstDis = new List <DispoDiaria>(); lstDis = oMedicoDao.GetDisponibilidadDiaria(oMedico.Value[0].VMA, fecha, agendas.Id_especialidad); dlDisHora.DataSource = lstDis; dlDisHora.DataBind(); List <String> lstMes = new List <string>(); lstMes = oMedicoDao.GetDisponibilidadMensual("01" + agendas.Fecha.Substring(2, 6), oMedico.Value[0].VMA); calendar.VisibleDate = new DateTime(int.Parse(lstMes[0].Substring(4, 4)), int.Parse(lstMes[0].Substring(2, 2)), 01); calendar.SelectedDate = new DateTime(int.Parse(agendas.Fecha.Substring(4, 4)), int.Parse(agendas.Fecha.Substring(2, 2)), int.Parse(agendas.Fecha.Substring(0, 2))); ViewState["Mes"] = lstMes; lbEspecialidad.Text = agendas.Especialidad; } } }