Exemple #1
0
        public vtn_agregar_turno()
        {
            InitializeComponent();

            //Bloquea los dias pasados en el datapicker
            dtp_fechaturno.BlackoutDates.AddDatesInPast();


            CargarCBox cargaTat = new CargarCBox();

            cargaTat.CargarDuraciones(cbx_tiempotatu);
            cargaTat.CargarTatuadores(cbx_tatuador);
        }
        public vtn_modificar_turno()
        {
            InitializeComponent();

            btn_atcualizarturno.IsEnabled = false;
            //Bloquea los dias pasados en el datapicker
            dtp_fechaturno.BlackoutDates.AddDatesInPast();

            CargarCBox cargaCbox = new CargarCBox();

            cargaCbox.CargarDuraciones(cbx_tiempotatu);
            cargaCbox.CargarTatuadores(cbx_tatuador);
        }
Exemple #3
0
 private void Dtp_fechaturno_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         if (cbx_tatuador.Text != "")
         {
             CargarCBox cargaHora = new CargarCBox();
             cbx_horaturno.ItemsSource = null;
             try
             {
                 cargaHora.CargarHorarios(cbx_horaturno, cbx_tatuador.SelectedValue.ToString(), dtp_fechaturno.SelectedDate.Value.ToString("yyyy/MM/dd"));
             }
             catch (Exception error)
             {
                 MessageBox.Show("Error de clase cargarCBox: " + error.Message);
             }
         }
     }
     catch (Exception error2)
     {
         MessageBox.Show("Error de if " + error2.Message);
     }
 }
        private void Btn_buscarturno_Click(object sender, RoutedEventArgs e)
        {
            txtbl_buscarturno.Text = "";

            if (txt_nombrecliente.Text == "" && txt_telefcliente.Text == "")
            {
                txtbl_buscarturno.Text       = "Es necesario completar al menos uno de los campos";
                txtbl_buscarturno.Foreground = Brushes.Red;
            }
            else
            {
                query = "";
                if (txt_nombrecliente.Text != "" && txt_telefcliente.Text != "")
                {
                    query = "SELECT id_turno, telef_cliente, cod_tatuaje, nya_tatuador, lugar_cuerpo, taman_tatuaje, TIME_FORMAT(tiempo_tatuaje, '%H:%i') tiempo_tatuaje, costo_tatuaje, DATE_FORMAT(fecha_turno,'%d/%m/%Y') fecha_turno, TIME_FORMAT(hora_turno, '%H:%i') hora_turno FROM turnos " +
                            "INNER JOIN clientes ON turnos.idfk_cliente = clientes.id_cliente " +
                            "INNER JOIN atenciones ON turnos.idfk_atencion=atenciones.id_atencion " +
                            "INNER JOIN tatuadores ON turnos.idfk_tatuador=tatuadores.id_tatuador WHERE nya_cliente='" + txt_nombrecliente.Text + "' AND telef_cliente='" + txt_telefcliente.Text + "' AND estado_turno='Reservado';";
                }
                else
                {
                    if (txt_nombrecliente.Text != "")
                    {
                        query = "SELECT id_turno, telef_cliente, cod_tatuaje, nya_tatuador, lugar_cuerpo, taman_tatuaje, TIME_FORMAT(tiempo_tatuaje, '%H:%i') tiempo_tatuaje, costo_tatuaje, DATE_FORMAT(fecha_turno,'%d/%m/%Y') fecha_turno, TIME_FORMAT(hora_turno, '%H:%i') hora_turno FROM turnos " +
                                "INNER JOIN clientes ON turnos.idfk_cliente = clientes.id_cliente " +
                                "INNER JOIN atenciones ON turnos.idfk_atencion=atenciones.id_atencion " +
                                "INNER JOIN tatuadores ON turnos.idfk_tatuador=tatuadores.id_tatuador WHERE nya_cliente='" + txt_nombrecliente.Text + "' AND estado_turno='Reservado';";
                    }
                    else
                    {
                        query = "SELECT id_turno, telef_cliente, cod_tatuaje, nya_tatuador, lugar_cuerpo, taman_tatuaje, TIME_FORMAT(tiempo_tatuaje, '%H:%i') tiempo_tatuaje, costo_tatuaje, DATE_FORMAT(fecha_turno,'%d/%m/%Y') fecha_turno, TIME_FORMAT(hora_turno, '%H:%i') hora_turno FROM turnos " +
                                "INNER JOIN clientes ON turnos.idfk_cliente = clientes.id_cliente " +
                                "INNER JOIN atenciones ON turnos.idfk_atencion=atenciones.id_atencion " +
                                "INNER JOIN tatuadores ON turnos.idfk_tatuador=tatuadores.id_tatuador WHERE telef_cliente='" + txt_telefcliente.Text + "' AND estado_turno='Reservado';";
                    }
                }

                try
                {
                    idfound_turno     = 0;
                    telefound_cliente = "";
                    conexion.Open();
                    //Buscar el Id del turno para cargar los text box y combo box y luego modificar

                    /*MySqlCommand comando0 = new MySqlCommand("SELECT id_turno, telef_cliente, cod_tatuaje, nya_tatuador, lugar_cuerpo, taman_tatuaje, TIME_FORMAT(tiempo_tatuaje, '%H:%i') tiempo_tatuaje, costo_tatuaje, DATE_FORMAT(fecha_turno,'%d/%m/%Y') fecha_turno, TIME_FORMAT(hora_turno, '%H:%i') hora_turno FROM turnos " +
                     *  "INNER JOIN clientes ON turnos.idfk_cliente = clientes.id_cliente " +
                     *  "INNER JOIN atenciones ON turnos.idfk_atencion=atenciones.id_atencion " +
                     *  "INNER JOIN tatuadores ON turnos.idfk_tatuador=tatuadores.id_tatuador WHERE nya_cliente='" + txt_nombrecliente.Text + "' AND estado_turno='Reservado';", conexion);*/

                    MySqlCommand     comando0  = new MySqlCommand(query, conexion);
                    MySqlDataAdapter adaptador = new MySqlDataAdapter();
                    adaptador.SelectCommand = comando0;
                    tabla_idfound.Clear();
                    adaptador.Fill(tabla_idfound);
                    conexion.Close();

                    if (tabla_idfound.Tables[0].Rows.Count == 0)
                    {
                        txtbl_buscarturno.Text        = "No se encontró ningun turno para los datos especificados";
                        txtbl_buscarturno.Foreground  = Brushes.Red;
                        btn_atcualizarturno.IsEnabled = false;
                        //Limpiar_Campos();
                    }
                    else
                    {
                        btn_atcualizarturno.IsEnabled = true;
                        idfound_turno = Int32.Parse(tabla_idfound.Tables[0].Rows[0]["id_turno"].ToString());

                        cbx_motivo.Text = tabla_idfound.Tables[0].Rows[0]["cod_tatuaje"].ToString();
                        //cambio de text por display
                        cbx_tatuador.Text   = tabla_idfound.Tables[0].Rows[0]["nya_tatuador"].ToString();
                        cbx_lugar.Text      = tabla_idfound.Tables[0].Rows[0]["lugar_cuerpo"].ToString();
                        txt_tamañotatu.Text = tabla_idfound.Tables[0].Rows[0]["taman_tatuaje"].ToString();
                        cbx_tiempotatu.Text = tabla_idfound.Tables[0].Rows[0]["tiempo_tatuaje"].ToString();
                        txt_costotatu.Text  = tabla_idfound.Tables[0].Rows[0]["costo_tatuaje"].ToString();
                        dtp_fechaturno.Text = tabla_idfound.Tables[0].Rows[0]["fecha_turno"].ToString();
                        //dtp_fechaturno.SelectedDate = DateTime.ParseExact(tabla_idfound.Tables[0].Rows[0]["fecha_turno"].ToString(), "dd/MM/yyy", System.Globalization.CultureInfo.InvariantCulture);
                        cbx_horaturno.Text = tabla_idfound.Tables[0].Rows[0]["hora_turno"].ToString();
                        telefound_cliente  = tabla_idfound.Tables[0].Rows[0]["telef_cliente"].ToString();

                        CargarCBox cboxHorarios = new CargarCBox();
                        try
                        {
                            cbx_horaturno.ItemsSource = null;
                            cboxHorarios.CargarHorarios(cbx_horaturno, cbx_tatuador.SelectedValue.ToString(), dtp_fechaturno.SelectedDate.Value.ToString("yyyy/MM/dd"));
                        }
                        catch (Exception error)
                        {
                            MessageBox.Show("Error de clase cargarCBox Linea 135: " + error.Message);
                        }
                    }
                }
                catch (Exception error)
                {
                    MessageBox.Show("No se pudo operar sobre la BD, Linea 141 Error: " + error.Message);
                }
            }
        }