public List <CentroDeporte> Listar_x_Barrio(string Barrio) { Datos = new AccesoDatos(); List <CentroDeporte> Lista = new List <CentroDeporte>(); try { Datos.SetearQuery("SELECT C.[ID],C.[NOMBRE],C.[ID_BARRIO],C.[Direccion] FROM [TP_MATCHPOINT].[dbo].[Centros_Deportes] AS C INNER JOIN BARRIOS AS B ON C.ID_BARRIO = B.ID WHERE B.Nombre = '" + Barrio + "'"); Datos.EjecutarLector(); while (Datos.Lector.Read()) { CentroDeporte Centro = new CentroDeporte(); Centro.ID = Datos.Lector.GetInt32(0); Centro.Nombre = Datos.Lector.GetString(1); Centro.Barrio = new Barrio(); Centro.Barrio.ID = Datos.Lector.GetInt32(2); Centro.Direccion = Datos.Lector.GetString(3); Centro.Barrio.Nombre = Datos.Lector.GetString(4); Lista.Add(Centro); } return(Lista); } catch (Exception Ex) { throw Ex; } }
public CentroDeporte BuscarCentro(string Nombre) { Datos = new AccesoDatos(); CentroDeporte Aux = new CentroDeporte(); try { Datos.SetearQuery("SELECT a.[ID],a.[NOMBRE],a.[Direccion],b.ID,b.Nombre,b.ID_Localidad FROM [Centros_Deportes] as a join Barrios as b on b.ID = a.ID_BARRIO where a.Nombre = '" + Nombre + "'"); Datos.EjecutarLector(); if (Datos.Lector.Read()) { Aux.ID = Datos.Lector.GetInt32(0); Aux.Nombre = Datos.Lector.GetString(1); Aux.Direccion = Datos.Lector.GetString(2); Aux.Barrio = new Barrio(); Aux.Barrio.ID = Datos.Lector.GetInt32(3); Aux.Barrio.Nombre = Datos.Lector.GetString(4); Aux.Barrio.Localidad = new Localidad(); Aux.Barrio.Localidad.ID = Datos.Lector.GetInt32(5); } return(Aux); } catch (Exception Ex) { throw Ex; } }
public CentroDeporte BuscarCentroXDueño(Usuario User) { Datos = new AccesoDatos(); CentroDeporte Aux = new CentroDeporte(); List <CentroDeporte> Lista = new List <CentroDeporte>(); try { Datos.SetearQuery("SELECT C.[ID],C.[NOMBRE],C.[Direccion],c.id_barrio, c.tiempo_min_cancelacion FROM [Centros_Deportes] AS C INNER JOIN usuarios as u on u.id = c.ID_DUEÑO WHERE U.ID = " + User.IDUsuario); Datos.EjecutarLector(); if (Datos.Lector.Read()) { Aux = new CentroDeporte(); Aux.ID = Datos.Lector.GetInt32(0); Aux.Nombre = Datos.Lector.GetString(1); Aux.Direccion = Datos.Lector.GetString(2); Aux.Barrio = new Barrio(); Aux.Barrio.ID = Datos.Lector.GetInt32(3); Aux.TiempoMinCancelacion = Datos.Lector.GetTimeSpan(4); Lista.Add(Aux); } return(Aux); } catch (Exception Ex) { throw Ex; } }
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; } }
public void CargoDDList() { CanchaNegocio CanNeg = new CanchaNegocio(); CentroDeporte Centro = new CentroDeporte(); List <Actividad> ListaActividades = new List <Actividad>(); ActividadNegocio ActNeg = new ActividadNegocio(); HorarioCancha Horario = new HorarioCancha(); HorarioNegocio HorNeg = new HorarioNegocio(); Cancha Cancha = new Cancha(); Centro = (CentroDeporte)Session["Centro_Login"]; ListaCancha = CanNeg.Listar(Centro.ID); ListaActividades = ActNeg.Listar(); ddActividades.DataSource = ListaActividades; ddActividades.DataBind(); ddCanchas.DataSource = ListaCancha; ddCanchas.DataBind(); Cancha = CanNeg.Buscar(ddCanchas.SelectedValue, Centro.ID); Horario = HorNeg.BuscarHorario(Cancha.ID); txbDuracion.Value = Convert.ToString(Horario.Duracion); txbHoraDesde.Value = Convert.ToString(Horario.HoraDesde); txbHoraHasta.Value = Convert.ToString(Horario.HoraHasta); }
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>"); } }
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"); } }
public List <CentroDeporte> Listar_x_Filtros(string VarBarrio, string VarLocalidad, string VarCiudad, string VarPronvincia, string VarActividad) { Datos = new AccesoDatos(); List <CentroDeporte> Lista = new List <CentroDeporte>(); try { Datos.SetearQuery("select distinct a.[ID],a.[NOMBRE],a.[ID_BARRIO],a.[Direccion] , B.NOMBRE from Centros_Deportes as a join barrios as b on a.ID_BARRIO = b.ID join LOCALIDADES as c on c.ID = b.ID_Localidad join Ciudades as d on d.ID = c.ID_CIUDAD join PROVINCIAS as e on e.ID = d.ID_PROVINCIA join canchas as can on can.ID_Centro = a.ID join Actividades as act on act.ID = can.ID_Actividad where b.Nombre = '" + VarBarrio + "' and c.NOMBRE = '" + VarLocalidad + "' and d.NOMBRE = '" + VarCiudad + "' and e.NOMBRE = '" + VarPronvincia + "' and act.Nombre = '" + VarActividad + "'"); Datos.EjecutarLector(); while (Datos.Lector.Read()) { CentroDeporte Centro = new CentroDeporte(); Centro.ID = Datos.Lector.GetInt32(0); Centro.Nombre = Datos.Lector.GetString(1); Centro.Barrio = new Barrio(); Centro.Barrio.ID = Datos.Lector.GetInt32(2); Centro.Direccion = Datos.Lector.GetString(3); Centro.Barrio.Nombre = Datos.Lector.GetString(4); Lista.Add(Centro); } return(Lista); } catch (Exception Ex) { throw Ex; } }
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; }
public bool Guardar(CentroDeporte Centro) { try { AccesoDatos Datos = new AccesoDatos(); Datos.SetearQuery("INSERT INTO CENTROS_DEPORTES VALUES ('" + Centro.Nombre + "', " + Centro.Barrio.ID + ",'" + Centro.Direccion + "'," + Centro.Dueño.IDUsuario + ",'00:00')"); Datos.Ejecucion_Accion(); return(true); } catch (Exception Ex) { throw Ex; } }
public CentroDeporte BuscoID(string Nombre) { AccesoDatos Datos = new AccesoDatos(); CentroDeporte Aux = new CentroDeporte(); Datos.SetearQuery("SELECT ID FROM Centros_Deportes WHERE NOMBRE = '" + Nombre + "'"); Datos.EjecutarLector(); if (Datos.Lector.Read()) { Aux.ID = Datos.Lector.GetInt32(0); Aux.Nombre = Nombre; } return(Aux); }
public bool Actualizar(CentroDeporte Centro) { try { AccesoDatos Datos = new AccesoDatos(); Datos.SetearQuery("UPDATE CENTROS_DEPORTES SET NOMBRE = '" + Centro.Nombre + "',DIRECCION = '" + Centro.Direccion + "', TIEMPO_MIN_CANCELACION = '" + Centro.TiempoMinCancelacion + "' WHERE ID = " + Centro.ID); Datos.Ejecucion_Accion(); return(true); } catch (Exception Ex) { throw Ex; } }
public List <Reserva> ListarPorCentro(CentroDeporte Centro) { try { List <Reserva> Lista = new List <Reserva>(); Reserva Aux = new Reserva(); AccesoDatos Datos = new AccesoDatos(); Datos.SetearQuery("SELECT R.[ID] ,R.[ID_Cancha],C.nombre,R.[ID_Actividad],A.Nombre,R.[FECHA],R.[HORA_DESDE],R.[HORA_HASTA],R.[ID_Usuario],R.[ID_Estado_Reserva] ,er.DESCRIPCION,cen.NOMBRE , cen.direccion FROM [Reservas] AS R JOIN CANCHAS AS C ON C.ID = R.ID_Cancha JOIN Actividades AS A ON A.ID = R.ID_Actividad JOIN Usuarios AS U ON U.ID = R.ID_Usuario JOIN Estado_Reserva AS ER ON ER.ID = R.ID_Estado_Reserva join Centros_Deportes as cen on cen.ID = c.ID_Centro WHERE R.id_estado_reserva = 1 and Cen.ID = " + Centro.ID); Datos.EjecutarLector(); while (Datos.Lector.Read()) { Aux = new Reserva(); Aux.ID = Datos.Lector.GetInt32(0); Aux.Cancha = new Cancha(); Aux.Cancha.ID = Datos.Lector.GetInt32(1); Aux.Cancha.Nombre = Datos.Lector.GetString(2); Aux.Actividad = new Actividad(); Aux.Actividad.ID = Datos.Lector.GetInt32(3); Aux.Actividad.Nombre = Datos.Lector.GetString(4); Aux.Fecha = Datos.Lector.GetDateTime(5); Aux.HoraDesde = Datos.Lector.GetTimeSpan(6); Aux.HoraHasta = Datos.Lector.GetTimeSpan(7); Aux.Usuario = new Usuario(); Aux.Usuario.IDUsuario = Datos.Lector.GetInt32(8); Aux.Estado = new EstadoReserva(); Aux.Estado.ID = Datos.Lector.GetInt32(9); Aux.Estado.Descripcion = Datos.Lector.GetString(10); Aux.Cancha.Centro = new CentroDeporte(); Aux.Cancha.Centro.Nombre = Datos.Lector.GetString(11); Aux.Cancha.Centro.Direccion = Datos.Lector.GetString(12); Lista.Add(Aux); } return(Lista); } catch (Exception Ex) { throw Ex; } }
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(); }
protected void Actualizo_dd() { CanchaNegocio CanNeg = new CanchaNegocio(); CentroDeporte Centro = new CentroDeporte(); ActividadNegocio ActNeg = new ActividadNegocio(); HorarioCancha Horario = new HorarioCancha(); HorarioNegocio HorNeg = new HorarioNegocio(); Cancha Cancha = new Cancha(); Centro = (CentroDeporte)Session["Centro_Login"]; Cancha = CanNeg.Buscar(ddCanchas.SelectedValue, Centro.ID); Horario = HorNeg.BuscarHorario(Cancha.ID); txbDuracion.Value = Convert.ToString(Horario.Duracion); txbHoraDesde.Value = Convert.ToString(Horario.HoraDesde); txbHoraHasta.Value = Convert.ToString(Horario.HoraHasta); }
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(); }
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(); } }
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>"); } } }