Example #1
0
        protected void btnAgregarHorario_Click(object sender, EventArgs e)
        {
            lbError.Visible = false;
            Boolean  operation = true;
            DateTime dia       = new DateTime();

            dia = Convert.ToDateTime(txtDia.Text);
            HORARIO_CENTRO horario = new HORARIO_CENTRO();

            horario.DIA_HORARIO      = dia.ToString("dd/MM/yyy");
            horario.HORA_INICIO_D    = txtHoraI.Text + ":00";
            horario.HORA_TERMINO_D   = txtHoraT.Text + ":00";
            horario.HORARIO_COMPLETO = txtHoraI.Text + " - " + txtHoraT.Text;

            if (horarioActual.Count > 0)
            {
                foreach (HORARIO_CENTRO item in horarioActual)
                {
                    if (item.DIA_HORARIO.Equals(horario.DIA_HORARIO))
                    {
                        if (item.HORA_INICIO_D.Equals(horario.HORA_INICIO_D))
                        {
                            operation = false;
                        }
                    }
                }
            }

            if (operation == true)
            {
                if (listaHorario.Count > 0)
                {
                    foreach (HORARIO_CENTRO item in listaHorario)
                    {
                        if (item.DIA_HORARIO.Equals(horario.DIA_HORARIO) && item.HORA_INICIO_D.Equals(horario.HORA_INICIO_D))
                        {
                            lbError.Visible = true;
                            operation       = false;
                        }
                    }
                }
            }

            if (operation == true)
            {
                lbError.Visible   = false;
                lbHorario.Visible = true;
                listaHorario.Add(horario);
                grHorario.DataSource = listaHorario;
                grHorario.DataBind();
                txtDia.Text   = "";
                txtHoraI.Text = "";
                txtHoraT.Text = "";
            }
            else
            {
                lbError.Visible = true;
            }
        }
Example #2
0
        protected void grReserva_SelectedIndexChanged(object sender, EventArgs e)
        {
            reservaUpdate = new Adapter.AdapterReserva();
            GridViewRow gvr = grReserva.SelectedRow;
            long reserva = (long)grReserva.DataKeys[gvr.RowIndex].Value;
            foreach (Adapter.AdapterReserva item in listaReserva)
            {
                if (item._ID_RESERVA_CENTRO == reserva)
                {
                    reservaUpdate = item;
                    break;
                }
            }
            btnRegistroReserva.Visible = false;
            btnModificarReserva.Visible = true;

            DEPARTAMENTO departamento = Controller.ControllerDepartamento.buscarIdDepartamento(reservaUpdate._ID_DEPARTAMENTO);

            List<CENTRO> listaCI = Controller.ControllerCentro.listaCentroEdificio(departamento.ID_EDIFICIO);
            dplCentro.DataSource = listaCI;
            dplCentro.DataValueField = "ID_CENTRO";
            dplCentro.DataTextField = "NOMBRE_CENTRO";
            dplCentro.DataBind();
            dplCentro.Items.Insert(0, "Seleccione un Centro");
            dplCentro.SelectedIndex = 0;

            List<HORARIO_CENTRO> listaC = Controller.ControllerHorarioCentro.listadoHorario(reservaUpdate._ID_CENTRO);
            foreach (HORARIO_CENTRO item in listaC)
            {
                DateTime dia = Convert.ToDateTime(item.DIA_HORARIO);
                item.DIA_HORARIO = dia.ToString("dd/MM/yyy");
            }
            dplDia.DataSource = listaC;
            dplDia.DataValueField = "ID_HORARIO_CENTRO";
            dplDia.DataTextField = "DIA_HORARIO";
            dplDia.DataBind();
            dplDia.Items.Insert(0, "Seleccione un Dia");
            dplDia.SelectedIndex = 0;

            HORARIO_CENTRO aux = Controller.ControllerHorarioCentro.buscarIdHorarioCentro(reservaUpdate._ID_HORARIO_CENTRO);
            List<HORARIO_CENTRO> listaHorario = Controller.ControllerHorarioCentro.listadoHorarioDia(reservaUpdate._ID_CENTRO, aux.DIA_HORARIO);
            dplHorario.DataSource = listaHorario;
            dplHorario.DataValueField = "ID_HORARIO_CENTRO";
            dplHorario.DataTextField = "HORARIO_COMPLETO";
            dplHorario.DataBind();
            dplHorario.Items.Insert(0, "Seleccione un Horario");
            dplHorario.SelectedIndex = 0;

            dplCentro.SelectedValue = reservaUpdate._ID_CENTRO.ToString();
            dplDia.SelectedValue = reservaUpdate._ID_HORARIO_CENTRO.ToString();
            dplHorario.SelectedValue = reservaUpdate._ID_HORARIO_CENTRO.ToString();
            lbTotal.Text = reservaUpdate._COSTO_BOLETA.ToString();
        }
        protected void grHorarioActual_SelectedIndexChanged(object sender, EventArgs e)
        {
            int index = grHorarioActual.SelectedIndex;

            idHorario = 0;
            HORARIO_CENTRO horario = listaHorarioActual[index];

            string año = horario.DIA_HORARIO.Substring(6, 4);
            string mes = horario.DIA_HORARIO.Substring(3, 2);
            string dia = horario.DIA_HORARIO.Substring(0, 2);

            txtDia.Text   = año + "-" + mes + "-" + dia;
            txtHoraI.Text = horario.HORA_INICIO_D;
            txtHoraT.Text = horario.HORA_TERMINO_D;
            idHorario     = horario.ID_HORARIO_CENTRO;
        }
Example #4
0
 public static HORARIO_CENTRO buscarIdHorarioCentro(long horario)
 {
     using (EasyLifeEntities dbc = new EasyLifeEntities())
     {
         HORARIO_CENTRO aux = (from u in dbc.HORARIO_CENTRO
                               where u.ID_HORARIO_CENTRO == horario
                               select u).FirstOrDefault();
         if (aux != null)
         {
             return(aux);
         }
         else
         {
             return(null);
         }
     }
 }
Example #5
0
 protected void dplDia_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         long                  horario      = Convert.ToInt64(dplDia.SelectedValue);
         long                  centro       = Convert.ToInt64(dplCentro.SelectedValue);
         HORARIO_CENTRO        aux          = Controller.ControllerHorarioCentro.buscarIdHorarioCentro(horario);
         List <HORARIO_CENTRO> listaHorario = Controller.ControllerHorarioCentro.listadoHorarioDia(centro, aux.DIA_HORARIO);
         dplHorario.DataSource     = listaHorario;
         dplHorario.DataValueField = "ID_HORARIO_CENTRO";
         dplHorario.DataTextField  = "HORARIO_COMPLETO";
         dplHorario.DataBind();
         dplHorario.Items.Insert(0, "Seleccione un Horario");
         dplHorario.SelectedIndex = 0;
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine("Error:  " + ex);
     }
 }