Example #1
0
        private void cboTerapeuta_SelectedIndexChanged_1(object sender, EventArgs e)
        {
            SqlConnection Conn = BDComun.obtenerConexion();

            dtgvTurnos.DataSource = null;
            SqlCommand cmd = Conn.CreateCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "select id_Turno 'Nro. Turno', Apellido,Nombre,Fecha,hora,Estado,Motivo from Turno t JOIN Paciente p on t.id_Paciente = p.nro_Paciente JOIN Estado_Turnos e on t.id_Estado=e.id_Estado_Turno where  id_Terapeuta='" + (((Terapeuta)cboTerapeuta.SelectedItem).Id) + "' and Fecha between '" + DateTime.Now.ToShortDateString() + "' and '" + DateTime.Now.AddDays(365).ToShortDateString() + "' order by Fecha";
            cmd.ExecuteNonQuery();

            DataTable      dt = new DataTable();
            SqlDataAdapter da = new SqlDataAdapter(cmd);

            da.Fill(dt);

            dtgvTurnos.DataSource = dt;

            Conn.Close();



            var cultureInfo  = new CultureInfo("es-Ar");
            var dateTimeInfo = cultureInfo.DateTimeFormat;
            var dayNames     = dateTimeInfo.DayNames;

            List <string>    Listadedias = new List <string>();
            List <DayOfWeek> L           = AgendaDAL.ObtenerListaDias(((Terapeuta)cboTerapeuta.SelectedItem).Id);

            foreach (DayOfWeek item in L)
            {
                Listadedias.Add(dayNames[(int)item]);
            }
            cboDia.DataSource = null;
            cboDia.DataSource = Listadedias;
        }