Example #1
0
        protected void btnCentro_ServerClick(object sender, EventArgs e)
        {
            if (gvCentros.SelectedValue != "")
            {
                UsuarioNegocio UserNeg = new UsuarioNegocio();
                Usuario        Usuario = new Usuario();
                CentroDeporte  Centro  = new CentroDeporte();
                CentroNegocio  CenNeg  = new CentroNegocio();

                Session["Centro_Seleccionado"]  = gvCentros.SelectedValue;
                Session["Deporte_Seleccionado"] = ddActividad.SelectedValue;
                Usuario = (Usuario)(Session["User_Home"]);

                Centro = CenNeg.BuscarCentro((string)Session["Centro_Seleccionado"]);

                if (!UserNeg.valido_existe_bloqueado(Usuario.IDUsuario, Centro.ID))
                {
                    Response.Redirect("JugadorReservaSeleccion.aspx");
                }
                else
                {
                    Response.Write("<script>alert('El centro que intenta seleccionar no permite que reserves en su centro por mal comportamiento en las reservas, por favor contactarse con el centro');</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('Debe seleccionar un centro para continuar);</script>");
            }
        }
Example #2
0
        protected void btnConfirmar_Click(object sender, EventArgs e)
        {
            CentroDeporte Centro_Nuevo = new CentroDeporte();
            CentroDeporte Centro       = new CentroDeporte();
            CentroNegocio CenNeg       = new CentroNegocio();

            Centro = (CentroDeporte)(Session["Centro_Login"]);

            try
            {
                Centro_Nuevo.ID                   = Centro.ID;
                Centro_Nuevo.Nombre               = txbCentroNombre.Text;
                Centro_Nuevo.Direccion            = txbDireccion.Text;
                Centro_Nuevo.TiempoMinCancelacion = TimeSpan.Parse(txbCancelacionMinimna.Text);

                if (CenNeg.Actualizar(Centro_Nuevo))
                {
                    Response.Write("<script>alert('Datos Actualizados correctamente);</script>");
                }
                else
                {
                    Response.Write("<script>alert('Eror al actualizar');</script>");
                }
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }
Example #3
0
        protected void btnLogin_ServerClick(object sender, EventArgs e)
        {
            Barrio        Barrio = new Barrio();
            BarrioNegocio BarNeg = new BarrioNegocio();
            Usuario       User   = new Usuario();
            CentroDeporte Centro = new CentroDeporte();
            CentroNegocio CenNeg = new CentroNegocio();

            User             = (Usuario)Session["User_Home"];
            Centro.Direccion = txbDireccion.Value;
            Centro.Nombre    = txbNombre.Value;

            Centro.Barrio        = new Barrio();
            Centro.Barrio.Nombre = ddBarrio.SelectedValue;

            Barrio = BarNeg.BuscarPorNombre(ddBarrio.SelectedValue);

            Centro.Barrio = Barrio;
            Centro.Dueño  = new Usuario();
            Centro.Dueño  = User;

            if (CenNeg.Guardar(Centro))
            {
                Response.Write("<script>alert('Centro dado de alta correctamente');</script>");
                Response.Redirect("ComercianteHome.aspx");
            }
            else
            {
                Response.Write("<script>alert('Hubo un error al dar de alta, por favor verifique');</script>");
                Response.Redirect("ComercianteHome.aspx");
            }
        }
Example #4
0
        protected void btnBuscar_ServerClick(object sender, EventArgs e)
        {
            List <CentroDeporte> Lista  = new List <CentroDeporte>();
            CentroNegocio        CenNeg = new CentroNegocio();

            Lista = CenNeg.Listar_x_Filtros(ddBarrio.SelectedValue, ddLocalidad.SelectedValue, ddCiudad.SelectedValue, ddProvincia.SelectedValue, ddActividad.SelectedValue);

            gvCentros.DataSource = Lista;
            gvCentros.DataBind();
        }
Example #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CentroNegocio CenNeg = new CentroNegocio();
            CentroDeporte Centro = new CentroDeporte();

            Usuario Usuario = new Usuario();

            Usuario = (Usuario)(Session["User_Home"]);

            Centro = CenNeg.BuscarCentroXDueño(Usuario);
            Session["Centro_Login"] = Centro;
        }
Example #6
0
        void Carga_datos()
        {
            ReservaNegocio ResNeg  = new ReservaNegocio();
            List <Reserva> Lista   = new List <Reserva>();
            Usuario        Usuario = new Usuario();
            CentroDeporte  Centro  = new CentroDeporte();
            CentroNegocio  CenNeg  = new CentroNegocio();

            Usuario = (Usuario)Session["User_Home"];
            Centro  = CenNeg.BuscarCentroXDueño(Usuario);

            Lista = ResNeg.ListarPorCentro_TodosEstados(Centro);


            gvReservasHechas.DataSource = Lista;
            gvReservasHechas.DataBind();

            gvReservasAsistidas.DataSource = ResNeg.ListarPorCentro_Asistidos(Centro);
            gvReservasAsistidas.DataBind();
        }
Example #7
0
        void Carga_Datos_txb()
        {
            Usuario Usuario = new Usuario();

            Usuario = (Usuario)(Session["User_Home"]);
            CentroNegocio CenNeg = new CentroNegocio();
            CentroDeporte Centro = new CentroDeporte();

            Centro = CenNeg.BuscarCentroXDueño(Usuario);

            txbnombre.Text             = Usuario.Nombre;
            txbMail.Text               = Usuario.Mail;
            txbape.Text                = Usuario.Apellido;
            txbUser.Text               = Usuario.NombreUsuario;
            txbDireccion.Text          = Centro.Direccion;
            txbCentroNombre.Text       = Centro.Nombre;
            txbCancelacionMinimna.Text = Centro.TiempoMinCancelacion.ToString();

            Cargo_ddList();
        }
Example #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string        Cen, Deporte;
                CentroDeporte Centro = new CentroDeporte();
                CentroNegocio CenNeg = new CentroNegocio();
                List <Cancha> Cancha = new List <Cancha>();
                CanchaNegocio CanNeg = new CanchaNegocio();

                Cen     = (string)Session["Centro_Seleccionado"];
                Deporte = (string)Session["Deporte_Seleccionado"];
                Centro  = CenNeg.BuscarCentro(Cen);

                Cancha = CanNeg.ListarPorDeporte(Centro.ID, Deporte);

                Session["Cancha_Seleccionada"] = ddCanchas.SelectedValue;
                ddCanchas.DataSource           = Cancha;
                ddCanchas.DataBind();
            }
        }
Example #9
0
        protected void Cargo_Info()
        {
            if (txbfecha.Text != "")
            {
                List <HorarioCancha> Lista   = new List <HorarioCancha>();
                HorarioNegocio       HorNeg  = new HorarioNegocio();
                HorarioCancha        Horario = new HorarioCancha();
                HorarioCancha        Aux     = new HorarioCancha();
                Cancha           Cancha      = new Cancha();
                CanchaNegocio    CanNeg      = new CanchaNegocio();
                CentroDeporte    Centro      = new CentroDeporte();
                CentroNegocio    CenNeg      = new CentroNegocio();
                Reserva          Reserva     = new Reserva();
                ReservaNegocio   ResNeg      = new ReservaNegocio();
                Actividad        Actividad   = new Actividad();
                ActividadNegocio ActNeg      = new ActividadNegocio();

                TimeSpan        Aux_Desde, Aux_Hasta;
                string          Cen;
                List <TimeSpan> Lista_Horarios = new List <TimeSpan>();;

                int      Dia = 0, Mes = 0, Anio = 0;
                int      Cont = 0;
                DateTime Date;
                //"November 19 2019"
                string[] separatingStrings = { " " };

                string text = txbfecha.Text;

                string[] words = text.Split(separatingStrings, System.StringSplitOptions.RemoveEmptyEntries);

                foreach (var word in words)
                {
                    if (Cont == 0)
                    {
                        if (word == "January")
                        {
                            Mes = 1;
                        }
                        if (word == "February")
                        {
                            Mes = 2;
                        }
                        if (word == "March")
                        {
                            Mes = 3;
                        }
                        if (word == "April")
                        {
                            Mes = 4;
                        }
                        if (word == "May")
                        {
                            Mes = 5;
                        }
                        if (word == "June")
                        {
                            Mes = 6;
                        }
                        if (word == "July")
                        {
                            Mes = 7;
                        }
                        if (word == "August")
                        {
                            Mes = 8;
                        }
                        if (word == "September")
                        {
                            Mes = 9;
                        }
                        if (word == "October")
                        {
                            Mes = 10;
                        }
                        if (word == "November")
                        {
                            Mes = 11;
                        }
                        if (word == "December")
                        {
                            Mes = 12;
                        }
                    }
                    if (Cont == 1)
                    {
                        try
                        {
                            Dia = Convert.ToInt32(word);
                        }
                        catch (Exception)
                        {
                            Dia = 9999999;
                        }
                    }
                    if (Cont == 2)
                    {
                        Anio = Convert.ToInt32(word);
                    }
                    Cont++;
                }
                string DiaString = Convert.ToString(Dia);

                if (DiaString.Length < 3)
                {
                    Date = new DateTime(Anio, Mes, Dia);

                    Session["Fecha_Seleccionado"] = Date;

                    Cen    = (string)Session["Centro_Seleccionado"];
                    Centro = CenNeg.BuscarCentro(Cen);

                    Cancha    = CanNeg.Buscar(ddCanchas.SelectedValue, Centro.ID);
                    Horario   = HorNeg.BuscarHorario(Cancha.ID);
                    Aux_Desde = Horario.HoraDesde;
                    Aux_Hasta = Horario.HoraHasta;

                    while (Aux_Desde <= Aux_Hasta)
                    {
                        Aux           = new HorarioCancha();
                        Aux.HoraDesde = Aux_Desde;

                        Lista_Horarios.Add(Aux_Desde);
                        Aux_Desde     = Aux_Desde + Horario.Duracion;
                        Aux.HoraHasta = Aux_Desde;
                        Aux.Duracion  = Horario.Duracion;

                        Reserva.Actividad = new Actividad();
                        Actividad.Nombre  = (string)Session["Deporte_seleccionado"];

                        Reserva.Actividad = ActNeg.BuscarActividad(Actividad.Nombre);
                        Reserva.Cancha    = new Cancha();
                        Reserva.Cancha    = Cancha;
                        Reserva.Fecha     = Date;
                        Reserva.HoraDesde = Aux.HoraDesde;
                        Reserva.HoraHasta = Aux.HoraHasta;

                        if (!ResNeg.Verifica_Reservado(Reserva))
                        {
                            Lista.Add(Aux);
                        }
                    }
                    lbHorarios_Disponibles.DataSource = Lista;
                    lbHorarios_Disponibles.DataBind();
                    Session["Pre_Reserva"] = Reserva;
                }
                else
                {
                    Response.Write("<script>alert('Primero debe seleccionar una fecha luego que se completo bien, por favor seleccione el boton Adelante!');</script>");
                }
            }
        }