Beispiel #1
0
 private void cargarComplejos()
 {
     cmb_Complejo.DataSource     = ComplejoDeportivoDao.ObtenerComplejos();
     cmb_Complejo.DataValueField = "id";
     cmb_Complejo.DataTextField  = "nombre";
     cmb_Complejo.DataBind();
 }
Beispiel #2
0
        protected void btnGuardarImagen_Click(object sender, EventArgs e)
        {
            if (FileUploadAvatar.HasFile)
            {
                //obtener datos de la imagen
                int    tam            = FileUploadAvatar.PostedFile.ContentLength;
                byte[] ImagenOriginal = new byte[tam];

                FileUploadAvatar.PostedFile.InputStream.Read(ImagenOriginal, 0, tam);
                Bitmap ImagenOriginalBinaria = new Bitmap(FileUploadAvatar.PostedFile.InputStream);

                //insertar en BD
                ComplejoDeportivoDao.AgregarAvatar(Session["IDCom"].ToString(), ImagenOriginal);
                lblestado.Text = "Imagen Guardada Exitosamente";
                //string ImagenDataURL64 = "data:image/jpg;base64," + Convert.ToBase64String(ImagenOriginal);
                //Image1.ImageUrl = ImagenDataURL64;
                imgAvatar.ImageUrl        = "~/AvatarComplejo.aspx?id=" + Session["IDCom"].ToString();
                FileUploadAvatar.Visible  = false;
                btn_guardarImagen.Visible = false;
                btn_CambiarImagen.Visible = true;
            }
            else
            {
                lblestado.Text = "Coloque un archivo de imagen valido";
            }
            lblestado.Visible = true;
        }
Beispiel #3
0
        protected void btn_Agregar_Click(object sender, EventArgs e)
        {
            Mapa m = new Mapa();

            if (string.IsNullOrEmpty(txt_Latitud.Text) || string.IsNullOrEmpty(txt_Longitud.Text))
            {
                m.latitud  = "-31.416563";
                m.longitud = "-64.183533";
            }
            else
            {
                m.latitud  = txt_Latitud.Text;
                m.longitud = txt_Longitud.Text;
            }
            int idMapa = MapaDao.insertarMapa(m);


            ComplejoDeportivo cd = new ComplejoDeportivo();

            cd.id   = int.Parse(Session["IDCom"].ToString());
            cd.mapa = idMapa;
            ComplejoDeportivoDao.ActualizarMapaComplejo(cd);

            limpiarCampos();

            cargarMapa(int.Parse(Session["IDCom"].ToString()));
        }
Beispiel #4
0
 protected void CargarRepeaterComplejosBuscar(string nomb, int?idUsuario, string d1, string d2, string d3, string d4)
 {
     encuentrosRepeater.DataSource = (from comp in ComplejoDeportivoDao.ObtenerComplejosFiltros(nomb, idUsuario, d1, d2, d3, d4)
                                      orderby comp.Nombre
                                      select comp);
     encuentrosRepeater.DataBind();
     //encuentrosRepeater.ItemCommand += new RepeaterCommandEventHandler(encuentroRepeater_ItemCommand);
 }
Beispiel #5
0
        //CANCHAS
        protected void btnClose_Click(object sender, EventArgs e)
        {
            spObtenerComplejosJoin_Result complejo = ComplejoDeportivoDao.ObtenerComplejoPorID(IDCom.Value);

            lblDepResultado.Text = complejo.Deportes;
            btnPopUp_ModalPopupExtender.Hide();
            LimpiarCanchas();
        }
Beispiel #6
0
 protected void Repeater1_ItemCommand1(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "btnEliminarImagen")
     {
         int idImagen = int.Parse(((LinkButton)e.CommandSource).CommandArgument);
         ComplejoDeportivoDao.EliminarImagenComp(idImagen);
         CargarRepeaterImagenes();
     }
 }
        protected void CargarTitulo()
        {
            spObtenerComplejosJoin_Result comp = new spObtenerComplejosJoin_Result();

            comp = ComplejoDeportivoDao.ObtenerComplejoPorUsuario(int.Parse(Session["ID"].ToString()));
            if (comp != null)
            {
                tituloComp.InnerText = comp.Nombre;
            }
        }
Beispiel #8
0
        protected void btnEliminarCan_Click(object sender, EventArgs e)
        {
            CanchaDao.EliminarCancha(IDCan.Value);
            CargarGrillaCanchas();

            if (ComplejoDeportivoDao.CuantasCanchasPorDeporte(IDCom.Value, ddlDep4.SelectedIndex) == 0)
            {
                ComplejoDeportivoDao.EliminarDeporteComplejo(IDCom.Value, ddlDep4.SelectedItem.ToString());
            }
            LimpiarCanchas();
        }
Beispiel #9
0
        protected void CargarGrillaComplejos()
        {
            gvComplejos.DataSource = null;

            gvComplejos.DataSource = (from comp in ComplejoDeportivoDao.ObtenerComplejosJoin()
                                      orderby comp.Nombre
                                      select comp);

            gvComplejos.DataKeyNames = new string[] { "ID" };
            gvComplejos.DataBind();
        }
Beispiel #10
0
        protected void btn_Eliminar_Click(object sender, EventArgs e)
        {
            MapaDao.eliminarMapa(int.Parse(Session["idMapa"].ToString()));
            ComplejoDeportivo cd = new ComplejoDeportivo();

            cd.id   = int.Parse(Session["idComplejo"].ToString());
            cd.mapa = null;
            ComplejoDeportivoDao.ActualizarMapaComplejo(cd);

            limpiarCampos();
            cargarGrilla();
        }
Beispiel #11
0
        protected void btnEliminar_Click(object sender, EventArgs e)
        {
            if (ComplejoDeportivoDao.ExistenCanchasPorComplejo(ID.Value) == true)
            {
                CanchaDao.EliminarCanchasPorComplejo(ID.Value);
            }
            if (ServicioExtraDao.ExistenServiciosPorComplejo(ID.Value) > 0)
            {
                ServicioExtraDao.EliminarServiciosPorComplejo(ID.Value);
            }
            ComplejoDeportivoDao.EliminarComplejo(ID.Value);

            Limpiar();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            CargarTitulo();
            CargarRepeaterEncuentros();

            if (!IsPostBack)
            {
                //CargarDdlComplejos();
                CargarDdlDeportes();
                //ddlComp.AutoPostBack = true;
                ddlDeportes.AutoPostBack = true;

                if (ComplejoDeportivoDao.ObtenerComplejoPorUsuario(int.Parse(Session["ID"].ToString())) == null)
                {
                    Panel1.Visible = true;
                    Panel2.Visible = false;
                }
            }
        }
Beispiel #13
0
        protected void btnGuardarCan_Click(object sender, EventArgs e)
        {
            if (ddlDep4.SelectedValue != "0" && (ddlTipoCancha.SelectedValue != "0" && ddlTipoCancha.SelectedValue != ""))
            {
                Cancha cancha = new Cancha();

                cancha.nombre      = txtNomCan.Text;
                cancha.descripcion = txtDesCan.Text;

                int tipoCan;
                if (int.TryParse(ddlTipoCancha.Text, out tipoCan))
                {
                    cancha.idTipoCancha = tipoCan;
                }

                cancha.idComplejo = IDCom.Value;

                if (IDCan.HasValue)
                {
                    cancha.id = IDCan.Value;
                    CanchaDao.ActualizarCancha(cancha);
                }
                else
                {
                    CanchaDao.InsertarCancha(cancha);
                }

                if (ComplejoDeportivoDao.ExisteDeporte(IDCom.Value, ddlDep4.SelectedItem.ToString()) == false)
                {
                    ComplejoDeportivo complejo = new ComplejoDeportivo();
                    complejo.id       = IDCom.Value;
                    complejo.deportes = ddlDep4.SelectedItem.ToString();
                    ComplejoDeportivoDao.ActualizarDeportesComplejo(complejo);
                }

                CargarGrillaCanchas();
                LimpiarCanchas();
            }
        }
Beispiel #14
0
        // MAPA

        private void cargarMapa(int idComplejoDeportivo)
        {
            ComplejoDeportivo cd = ComplejoDeportivoDao.ObtenerComplejosPorID(idComplejoDeportivo);

            //int? id = cd.mapa.Value;
            if (!string.IsNullOrEmpty(cd.mapa.ToString()))
            {
                // int idMapa = int.Parse(id.ToString());
                int  idMapa = int.Parse(cd.mapa.Value.ToString());
                Mapa mapa   = MapaDao.obtenerMapaByID(idMapa);
                txt_Latitud.Text  = mapa.latitud;
                txt_Longitud.Text = mapa.longitud;

                btn_Agregar.Enabled   = false;
                btn_Modificar.Enabled = true;
                btn_Eliminar.Enabled  = true;
            }
            else
            {
                btn_Agregar.Enabled   = true;
                btn_Modificar.Enabled = false;
                btn_Eliminar.Enabled  = false;
            }
        }
Beispiel #15
0
        protected void btn_Agregar_Click(object sender, EventArgs e)
        {
            Mapa m = new Mapa();
            ComplejoDeportivo cd = new ComplejoDeportivo();

            // ** NO BORRAR **
            //double lat;
            //double lng;
            //if(double.TryParse(txt_Latitud.Text,out lat))
            //    m.latitud = lat;
            //if (double.TryParse(txt_Longitud.Text, out lng))
            //    m.longitud = lng;


            //m.latitud = txt_Latitud.Text;
            //m.longitud = txt_Longitud.Text;
            m.latitud  = txt_Latitud.Value;
            m.longitud = txt_Longitud.Value;

            int idMapa = MapaDao.insertarMapa(m);

            // cd.id = cmb_Complejo.SelectedIndex;
            // string comp = cmb_Complejo.SelectedItem.Text;
            int cmbID = 0;

            if (int.TryParse(cmb_Complejo.SelectedItem.Value, out cmbID))
            {
                cd.id = cmbID;
            }

            cd.mapa = idMapa;
            ComplejoDeportivoDao.ActualizarMapaComplejo(cd);

            limpiarCampos();
            cargarGrilla();
        }
Beispiel #16
0
        protected void btnSubir_Click(object sender, EventArgs e)
        {
            if (fUploadImagen.HasFile)
            {
                //obtener datos de la imagen
                int    tam            = fUploadImagen.PostedFile.ContentLength;
                byte[] ImagenOriginal = new byte[tam];

                fUploadImagen.PostedFile.InputStream.Read(ImagenOriginal, 0, tam);
                Bitmap ImagenOriginalBinaria = new Bitmap(fUploadImagen.PostedFile.InputStream);

                //insertar en BD
                ComplejoDeportivoDao.InsertarImagenComplejo(IDCom.Value, ImagenOriginal);
                lblEstadoImg.Text = "Imagen Guardada Exitosamente";
                string ImagenDataURL64 = "data:image/jpg;base64," + Convert.ToBase64String(ImagenOriginal);

                CargarRepeaterImagenes();
            }
            else
            {
                lblEstadoImg.Text = "Coloque un archivo de imagen valido";
            }
            lblestado.Visible = true;
        }
Beispiel #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.UnobtrusiveValidationMode = System.Web.UI.UnobtrusiveValidationMode.None;
            if (!IsPostBack)
            {
                ddlTipoCancha.Enabled = false;
                cargarBarrios();
                //CargarGrillaComplejos();
                btnEliminar.Enabled  = false;
                btnEliminar.CssClass = "btn btn-warning";
                CargarDeportes();
                CargarServicios();
                ddlDep4.AutoPostBack = true;
                ddlServ.AutoPostBack = true;
                CargarComplejo();

                if (ComplejoDeportivoDao.ObtenerComplejoPorUsuario(int.Parse(Session["ID"].ToString())) == null)
                {
                    Panel1.Visible = true;
                    Panel2.Visible = false;
                }
            }
            manejarValoracion();
        }
Beispiel #18
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            ComplejoDeportivo complejo = new ComplejoDeportivo();

            complejo.nombre            = txtNomb.Text;
            complejo.descripcion       = txtDesc.Text;
            complejo.deportes          = lblDepResultado.Text;
            complejo.responsable       = txtNomRes.Text + " " + txtApeRes.Text;
            complejo.idUsuario         = int.Parse(Session["ID"].ToString());
            complejo.promedioEstrellas = 0;
            complejo.idEstado          = 1;
            complejo.calle             = txtCalle.Text;

            int nroCalle;

            if (int.TryParse(txtNro.Text, out nroCalle))
            {
                complejo.nroCalle = nroCalle;
            }

            if (ddlBarrio.Text != "0")
            {
                int barrio;
                if (int.TryParse(ddlBarrio.Text, out barrio))
                {
                    complejo.idBarrio = barrio;
                }
            }
            else
            {
                complejo.idBarrio = null;
            }

            long tel;

            if (long.TryParse(txtTel.Text, out tel))
            {
                complejo.nroTelefono = tel;
            }

            TimeSpan horaApe;

            if (TimeSpan.TryParse(txtHoraApe.Text, out horaApe))
            {
                complejo.horaApertura = horaApe;
            }

            TimeSpan horaCie;

            if (TimeSpan.TryParse(txtHoraCie.Text, out horaCie))
            {
                complejo.horaCierre = horaCie;
            }

            //Guardar Avatar
            if (FileUploadAvatar.HasFile)
            {
                //obtener datos de la imagen
                int    tam            = FileUploadAvatar.PostedFile.ContentLength;
                byte[] ImagenOriginal = new byte[tam];

                FileUploadAvatar.PostedFile.InputStream.Read(ImagenOriginal, 0, tam);
                Bitmap ImagenOriginalBinaria = new Bitmap(FileUploadAvatar.PostedFile.InputStream);

                //insertar en BD
                complejo.avatar = ImagenOriginal;
                //string ImagenDataURL64 = "data:image/jpg;base64," + Convert.ToBase64String(ImagenOriginal);
                //Image1.ImageUrl = ImagenDataURL64;
                //imgAvatar.ImageUrl = "~/AvatarComplejo.aspx?id=" + Session["ID"].ToString();
                FileUploadAvatar.Visible  = false;
                btn_guardarImagen.Visible = false;
                btn_CambiarImagen.Visible = true;
            }

            else
            {
                //obtener datos de la imagen
                byte[] ImagenOriginal;
                string someUrl = @"C:\Users\linov\Documents\GitHub\desarrollo\HayEquipo\CapaPresentacion\Imagenes\complejo_logo_default.png";
                using (var webClient = new WebClient())
                {
                    ImagenOriginal = webClient.DownloadData(someUrl);
                }

                //insertar en BD
                complejo.avatar = ImagenOriginal;

                FileUploadAvatar.Visible  = false;
                btn_guardarImagen.Visible = false;
                btn_CambiarImagen.Visible = true;
            }

            if (IDCom.HasValue)
            {
                complejo.id = IDCom.Value;
                ComplejoDeportivoDao.ActualizarComplejo(complejo);
            }
            else
            {
                complejo.fechaRegistro = DateTime.Today;
                ComplejoDeportivoDao.InsertarComplejo(complejo);
            }

            CargarComplejo();
        }
Beispiel #19
0
 public void manejarValoracion()
 {
     if (ValoracionDao.existePromedioComplejoxid(ComplejoDeportivoDao.ObtenerIdComplejo(Session["ID"].ToString()), "1") == true)
     {
         RadioButtonList1.SelectedValue = Convert.ToString(ValoracionDao.obtenerPromedioComplejoxid(ComplejoDeportivoDao.ObtenerIdComplejo(Session["ID"].ToString()), "1"));
         foreach (ListItem item in RadioButtonList1.Items)
         {
             if (Convert.ToInt32(item.Value) < ValoracionDao.obtenerPromedioComplejoxid(ComplejoDeportivoDao.ObtenerIdComplejo(Session["ID"].ToString()), "1") && item.Text == "★")
             {
                 item.Attributes.CssStyle.Add("color", "orange");
             }
         }
         RadioButtonList1.Enabled = false;
         lblmsjrb1.Text           = "Calificacion Promedio de Canchas es: " + RadioButtonList1.SelectedValue + " Puntos";
     }
     else
     {
         RadioButtonList1.Enabled = false;
         lblmsjrb1.Text           = "Usted no ha sido calificado en esta seccion";
     }
     if (ValoracionDao.existePromedioComplejoxid(ComplejoDeportivoDao.ObtenerIdComplejo(Session["ID"].ToString()), "2") == true)
     {
         RadioButtonList2.SelectedValue = Convert.ToString(ValoracionDao.obtenerPromedioComplejoxid(ComplejoDeportivoDao.ObtenerIdComplejo(Session["ID"].ToString()), "2"));
         foreach (ListItem item in RadioButtonList2.Items)
         {
             if (Convert.ToInt32(item.Value) < ValoracionDao.obtenerPromedioComplejoxid(ComplejoDeportivoDao.ObtenerIdComplejo(Session["ID"].ToString()), "2") && item.Text == "★")
             {
                 item.Attributes.CssStyle.Add("color", "orange");
             }
         }
         RadioButtonList2.Enabled = false;
         lblmsjrb2.Text           = "Calificacion Promedio de Atencion es: " + RadioButtonList2.SelectedValue + " Puntos";
     }
     else
     {
         RadioButtonList2.Enabled = false;
         lblmsjrb2.Text           = "Usted no ha sido calificado en esta seccion";
     }
     if (ValoracionDao.existePromedioComplejoxid(ComplejoDeportivoDao.ObtenerIdComplejo(Session["ID"].ToString()), "3") == true)
     {
         RadioButtonList3.SelectedValue = Convert.ToString(ValoracionDao.obtenerPromedioComplejoxid(ComplejoDeportivoDao.ObtenerIdComplejo(Session["ID"].ToString()), "3"));
         foreach (ListItem item in RadioButtonList3.Items)
         {
             if (Convert.ToInt32(item.Value) < ValoracionDao.obtenerPromedioComplejoxid(ComplejoDeportivoDao.ObtenerIdComplejo(Session["ID"].ToString()), "3") && item.Text == "★")
             {
                 item.Attributes.CssStyle.Add("color", "orange");
             }
         }
         RadioButtonList3.Enabled = false;
         lblmsjrb3.Text           = "Calificacion Promedio de Servicios es: " + RadioButtonList3.SelectedValue + " Puntos";
     }
     else
     {
         RadioButtonList3.Enabled = false;
         lblmsjrb3.Text           = "Usted no ha sido calificado en esta seccion";
     }
     if (ValoracionDao.existePromedioGeneralComplejo(ComplejoDeportivoDao.ObtenerIdComplejo(Session["ID"].ToString())) == true)
     {
         RadioButtonList4.SelectedValue = Convert.ToString(ValoracionDao.obtenerPromediogeneralComplejo(ComplejoDeportivoDao.ObtenerIdComplejo(Session["ID"].ToString())));
         foreach (ListItem item in RadioButtonList4.Items)
         {
             if (Convert.ToInt32(item.Value) < ValoracionDao.obtenerPromediogeneralComplejo(ComplejoDeportivoDao.ObtenerIdComplejo(Session["ID"].ToString())) && item.Text == "★")
             {
                 item.Attributes.CssStyle.Add("color", "orange");
             }
         }
         RadioButtonList4.Enabled = false;
         lblmsjrb4.Text           = "Calificacion General del complejo es: " + RadioButtonList4.SelectedValue + " Puntos";
     }
     else
     {
         RadioButtonList4.Enabled = false;
         lblmsjrb4.Text           = "Usted no ha sido calificado";
     }
 }
Beispiel #20
0
 protected void CargarRepeaterImagenes()
 {
     Repeater1.DataSource = ComplejoDeportivoDao.ObtenerImagenesComp(IDCom.Value);
     Repeater1.DataBind();
     Repeater1.ItemCommand += new RepeaterCommandEventHandler(Repeater1_ItemCommand1);
 }
Beispiel #21
0
        protected void gvComplejos_SelectedIndexChanged(object sender, EventArgs e)
        {
            Limpiar();
            int idSeleccionado = int.Parse(gvComplejos.SelectedDataKey.Value.ToString());

            IDCom            = idSeleccionado;
            Session["IDCom"] = idSeleccionado;
            spObtenerComplejosJoin_Result compSelec = ComplejoDeportivoDao.ObtenerComplejoPorID(idSeleccionado);

            txtNomb.Text = compSelec.Nombre;
            txtDesc.Text = compSelec.Descripcion;
            if (compSelec.Deportes != string.Empty)
            {
                lblDepResultado.Text = compSelec.Deportes;
            }
            else
            {
                lblDepResultado.Text = "-";
            }
            txtCalle.Text           = compSelec.Calle;
            txtNro.Text             = compSelec.NroCalle.ToString();
            ddlBarrio.SelectedValue = (compSelec.IDBarrio).ToString();
            txtTel.Text             = compSelec.Telefono.ToString();
            txtHoraApe.Text         = compSelec.Apertura.ToString();
            txtHoraCie.Text         = compSelec.Cierre.ToString();
            if (ComplejoDeportivoDao.existeAvatar(Session["IDCom"].ToString()) != false)
            {
                imgAvatar.ImageUrl = "~/AvatarComplejo.aspx?id=" + Session["IDCom"].ToString();
                CambiarImagen();
            }
            else
            {
                imgAvatar.ImageUrl        = "~/Imagenes/complejo_logo_default.png";
                btn_guardarImagen.Visible = true;
            }
            if (compSelec.FechaRegistro.ToString() != string.Empty)
            {
                DateTime fecha = (DateTime)Convert.ChangeType(compSelec.FechaRegistro, typeof(DateTime));
                lblFecResultado.Text = fecha.ToString(@"dd/MM/yyyy");
            }
            else
            {
                lblFecResultado.Text = "-";
            }

            CargarRepeaterImagenes();
            lblFecha.Visible        = true;
            lblFecResultado.Visible = true;
            lblDeportes.Visible     = true;
            lblDepResultado.Visible = true;
            btnEliminar.Enabled     = true;
            btnCanchas.Enabled      = true;
            btnServicios.Enabled    = true;

            // Agregado por Nico
            Session["idMapa"] = compSelec.Mapa;
            cargarMapa(idSeleccionado);

            //Agregado por Franco R
            if (ValoracionDao.existePromedioGeneralComplejo(Session["IDCom"].ToString()) == true &&
                ValoracionDao.existePromedioComplejoxid(Session["IDCom"].ToString(), "1") == true &&
                ValoracionDao.existePromedioComplejoxid(Session["IDCom"].ToString(), "2") == true &&
                ValoracionDao.existePromedioComplejoxid(Session["IDCom"].ToString(), "3") == true)
            {
                RadioButtonList1.Visible = true;
                RadioButtonList2.Visible = true;
                RadioButtonList3.Visible = true;
                RadioButtonList4.Visible = true;
                calif.Visible            = true;
                canchas.Visible          = true;
                atencion.Visible         = true;
                servicios.Visible        = true;
                promedio.Visible         = true;
                NoHay.Visible            = false;
                lblmsjrb1.Visible        = true;
                lblmsjrb2.Visible        = true;
                lblmsjrb3.Visible        = true;
                lblmsjrb4.Visible        = true;
                manejarValoracion(Session["IDCom"].ToString());
            }
            else
            {
                RadioButtonList1.Visible = false;
                RadioButtonList2.Visible = false;
                RadioButtonList3.Visible = false;
                RadioButtonList4.Visible = false;
                calif.Visible            = false;
                canchas.Visible          = false;
                atencion.Visible         = false;
                servicios.Visible        = false;
                promedio.Visible         = false;
                lblmsjrb1.Visible        = false;
                lblmsjrb2.Visible        = false;
                lblmsjrb3.Visible        = false;
                lblmsjrb4.Visible        = false;
                NoHay.Visible            = true;
            }
        }
Beispiel #22
0
        //    void encuentroRepeater_ItemCommand(object source, RepeaterCommandEventArgs e)
        //    {
        //    if (e.CommandName == "btnUnirseEncuentro")
        //    {
        //        string idEncuentro = ((LinkButton)e.CommandSource).CommandArgument;

        //        int idSeleccionado = int.Parse(((LinkButton)e.CommandSource).CommandArgument);
        //        IDCom = idSeleccionado;
        //        Session["IDCom"] = idSeleccionado;
        //        spObtenerComplejosJoin_Result compSelec = ComplejoDeportivoDao.ObtenerComplejoPorID(idSeleccionado);

        //        myModalLabel2.InnerText = compSelec.Nombre;
        //            if (ValoracionDao.existePromedioGeneralComplejo(idSeleccionado.ToString()))
        //            {
        //                RadioButtonList2.SelectedValue = Convert.ToString(ValoracionDao.obtenerPromediogeneralComplejo(idSeleccionado.ToString()));
        //                foreach (ListItem item in RadioButtonList2.Items)
        //                {
        //                    if (Convert.ToInt32(item.Value) < ValoracionDao.obtenerPromediogeneralComplejo(idSeleccionado.ToString()) && item.Text == "★")
        //                    {
        //                        item.Attributes.CssStyle.Add("color", "orange");
        //                    }

        //                }
        //                RadioButtonList2.Enabled = false;
        //                //lblValoracion.Text = "Calificacion Promedio General es: " + RadioButtonList2.SelectedValue + " Puntos";

        //            }else
        //            {
        //                RadioButtonList2.Enabled = false;
        //                RadioButtonList2.Visible = false;
        //                //lblValoracion.Text = "nua odarolav odis ah on ojelpmoC etsE";
        //            }
        //        lblDeportes.Text = compSelec.Deportes;
        //        lblDescripcion.Text = compSelec.Descripcion;
        //        listServicios.Items.Clear();
        //        lblServicios.Text = "Servicios: ";
        //        if (ServicioExtraDao.ExistenServiciosPorComplejo(compSelec.ID) > 0)
        //        {
        //            CargarListServicios(compSelec.ID);
        //        }
        //        else
        //        {
        //            lblServicios.Text = "Servicios: - ";
        //            divListServ.Visible = false;
        //        }
        //        lblDireccion.Text = "Dirección: " + compSelec.Calle + " " + compSelec.NroCalle.ToString();
        //        Barrio bar = BarrioDao.ObtenerBarriosPorID(int.Parse(compSelec.IDBarrio.ToString()));
        //        lblBarrio.Text = "Barrio: " + bar.nombre;
        //        lblZona.Text = "Zona: " + ZonaDao.ObtenerZonasPorID(int.Parse(bar.idZona.ToString())).nombre;
        //        lblTelefono.Text = "Teléfono: " + compSelec.Telefono.ToString();
        //        if (compSelec.Apertura != null && compSelec.Cierre != null)
        //        {
        //            TimeSpan hA = (TimeSpan)Convert.ChangeType(compSelec.Apertura, typeof(TimeSpan));
        //            TimeSpan hC = (TimeSpan)Convert.ChangeType(compSelec.Cierre, typeof(TimeSpan));
        //            lblHorarios.Text = "Horarios: " + hA.ToString(@"hh\:mm") + " a " + hC.ToString(@"hh\:mm");
        //        }
        //        else
        //        {
        //            lblHorarios.Text = "Horarios: - ";
        //        }

        //        if (ComplejoDeportivoDao.existeAvatar(Session["IDCom"].ToString()) != false)
        //        {
        //                byte[] avtr = ComplejoDeportivoDao.ObtenerAvatar(Session["IDCom"].ToString());
        //                string ImagenDataURL64 = "data:image/jpg;base64," + Convert.ToBase64String(avtr);
        //                imgAvatar.ImageUrl = ImagenDataURL64;
        //        }
        //        else
        //        {
        //            imgAvatar.ImageUrl = "~/Imagenes/complejo_logo_default.png";
        //        }

        //        if (ComplejoDeportivoDao.existeImagen(Session["IDCom"].ToString(), 1) != false)
        //        {
        //                byte[] Img1 = ComplejoDeportivoDao.ObtenerImagen(Session["IDCom"].ToString(), 1);
        //                string ImagenDataURL64 = "data:image/jpg;base64," + Convert.ToBase64String(Img1);
        //                img1.Src = ImagenDataURL64;
        //            }
        //        else
        //        {
        //            img1.Src = "~/Imagenes/complejo_logo_default.png";
        //        }
        //        if (ComplejoDeportivoDao.existeImagen(Session["IDCom"].ToString(), 2) != false)
        //        {
        //                byte[] Img2 = ComplejoDeportivoDao.ObtenerImagen(Session["IDCom"].ToString(), 2);
        //                string ImagenDataURL64 = "data:image/jpg;base64," + Convert.ToBase64String(Img2);
        //                img2.Src = ImagenDataURL64;
        //            }
        //        else
        //        {
        //            img2.Src = "~/Imagenes/complejo_logo_default.png";
        //        }
        //        if (ComplejoDeportivoDao.existeImagen(Session["IDCom"].ToString(), 3) != false)
        //        {
        //                byte[] Img3 = ComplejoDeportivoDao.ObtenerImagen(Session["IDCom"].ToString(), 3);
        //                string ImagenDataURL64 = "data:image/jpg;base64," + Convert.ToBase64String(Img3);
        //                img3.Src = ImagenDataURL64;
        //            }
        //        else
        //        {
        //            img3.Src = "~/Imagenes/complejo_logo_default.png";
        //        }

        //        btnPopUp_ModalPopupExtender2.Show();
        //    }
        //}

        protected void explorar_Click(object sender, EventArgs e)
        {
            int idSeleccionado = int.Parse((sender as LinkButton).CommandArgument);

            IDCom            = idSeleccionado;
            Session["IDCom"] = idSeleccionado;
            spObtenerComplejosJoin_Result compSelec = ComplejoDeportivoDao.ObtenerComplejoPorID(idSeleccionado);

            myModalLabel2.InnerText = compSelec.Nombre;
            if (ValoracionDao.existePromedioGeneralComplejo(idSeleccionado.ToString()))
            {
                RadioButtonList2.SelectedValue = Convert.ToString(ValoracionDao.obtenerPromediogeneralComplejo(idSeleccionado.ToString()));
                foreach (ListItem item in RadioButtonList2.Items)
                {
                    if (Convert.ToInt32(item.Value) < ValoracionDao.obtenerPromediogeneralComplejo(idSeleccionado.ToString()) && item.Text == "★")
                    {
                        item.Attributes.CssStyle.Add("color", "orange");
                    }
                }
                RadioButtonList2.Enabled = false;
                //lblValoracion.Text = "Calificacion Promedio General es: " + RadioButtonList2.SelectedValue + " Puntos";
            }
            else
            {
                RadioButtonList2.Enabled = false;
                RadioButtonList2.Visible = false;
                //lblValoracion.Text = "nua odarolav odis ah on ojelpmoC etsE";
            }
            lblDeportes.Text    = compSelec.Deportes;
            lblDescripcion.Text = compSelec.Descripcion;
            listServicios.Items.Clear();
            lblServicios.Text = "Servicios: ";
            if (ServicioExtraDao.ExistenServiciosPorComplejo(compSelec.ID) > 0)
            {
                CargarListServicios(compSelec.ID);
            }
            else
            {
                lblServicios.Text   = "Servicios: - ";
                divListServ.Visible = false;
            }
            lblDireccion.Text = "Dirección: " + compSelec.Calle + " " + compSelec.NroCalle.ToString();
            Barrio bar = BarrioDao.ObtenerBarriosPorID(int.Parse(compSelec.IDBarrio.ToString()));

            lblBarrio.Text   = "Barrio: " + bar.nombre;
            lblZona.Text     = "Zona: " + ZonaDao.ObtenerZonasPorID(int.Parse(bar.idZona.ToString())).nombre;
            lblTelefono.Text = "Teléfono: " + compSelec.Telefono.ToString();
            if (compSelec.Apertura != null && compSelec.Cierre != null)
            {
                TimeSpan hA = (TimeSpan)Convert.ChangeType(compSelec.Apertura, typeof(TimeSpan));
                TimeSpan hC = (TimeSpan)Convert.ChangeType(compSelec.Cierre, typeof(TimeSpan));
                lblHorarios.Text = "Horarios: " + hA.ToString(@"hh\:mm") + " a " + hC.ToString(@"hh\:mm");
            }
            else
            {
                lblHorarios.Text = "Horarios: - ";
            }

            if (ComplejoDeportivoDao.existeAvatar(Session["IDCom"].ToString()) != false)
            {
                byte[] avtr            = ComplejoDeportivoDao.ObtenerAvatar(Session["IDCom"].ToString());
                string ImagenDataURL64 = "data:image/jpg;base64," + Convert.ToBase64String(avtr);
                imgAvatar.ImageUrl = ImagenDataURL64;
            }
            else
            {
                imgAvatar.ImageUrl = "~/Imagenes/complejo_logo_default.png";
            }

            if (ComplejoDeportivoDao.existeImagen(Session["IDCom"].ToString(), 1) != false)
            {
                byte[] Img1            = ComplejoDeportivoDao.ObtenerImagen(Session["IDCom"].ToString(), 1);
                string ImagenDataURL64 = "data:image/jpg;base64," + Convert.ToBase64String(Img1);
                img1.Src = ImagenDataURL64;
            }
            else
            {
                img1.Src = "~/Imagenes/complejo_logo_default.png";
            }
            if (ComplejoDeportivoDao.existeImagen(Session["IDCom"].ToString(), 2) != false)
            {
                byte[] Img2            = ComplejoDeportivoDao.ObtenerImagen(Session["IDCom"].ToString(), 2);
                string ImagenDataURL64 = "data:image/jpg;base64," + Convert.ToBase64String(Img2);
                img2.Src = ImagenDataURL64;
            }
            else
            {
                img2.Src = "~/Imagenes/complejo_logo_default.png";
            }
            if (ComplejoDeportivoDao.existeImagen(Session["IDCom"].ToString(), 3) != false)
            {
                byte[] Img3            = ComplejoDeportivoDao.ObtenerImagen(Session["IDCom"].ToString(), 3);
                string ImagenDataURL64 = "data:image/jpg;base64," + Convert.ToBase64String(Img3);
                img3.Src = ImagenDataURL64;
            }
            else
            {
                img3.Src = "~/Imagenes/complejo_logo_default.png";
            }

            btnPopUp_ModalPopupExtender2.Show();
        }
Beispiel #23
0
        //protected void CargarGrillaComplejos()
        //{
        //    int idUsuario = int.Parse(Session["ID"].ToString());
        //    gvComplejos.DataSource = null;

        //    gvComplejos.DataSource = ComplejoDeportivoDao.ObtenerComplejoPorUsuario(idUsuario);

        //    gvComplejos.DataKeyNames = new string[] { "ID" };
        //    gvComplejos.DataBind();
        //}

        private void CargarComplejo()
        {
            Limpiar();
            int idUsuario = int.Parse(Session["ID"].ToString());
            //int idSeleccionado = int.Parse(gvComplejos.SelectedDataKey.Value.ToString());
            //IDCom = idSeleccionado;
            //Session["IDCom"] = idSeleccionado;
            spObtenerComplejosJoin_Result compSelec = ComplejoDeportivoDao.ObtenerComplejoPorUsuario(idUsuario);

            if (compSelec != null)
            {
                IDCom            = compSelec.ID;
                Session["IDCom"] = compSelec.ID;

                var nombresResp = compSelec.Responsable.Split(' ');
                txtNomRes.Text = nombresResp[0];
                txtApeRes.Text = nombresResp[1];
                txtNomb.Text   = compSelec.Nombre;
                txtDesc.Text   = compSelec.Descripcion;
                if (compSelec.Deportes != string.Empty)
                {
                    lblDepResultado.Text = compSelec.Deportes;
                }
                else
                {
                    lblDepResultado.Text = "-";
                }
                txtCalle.Text           = compSelec.Calle;
                txtNro.Text             = compSelec.NroCalle.ToString();
                ddlBarrio.SelectedValue = (compSelec.IDBarrio).ToString();
                txtTel.Text             = compSelec.Telefono.ToString();
                txtHoraApe.Text         = compSelec.Apertura.ToString();
                txtHoraCie.Text         = compSelec.Cierre.ToString();

                if (ComplejoDeportivoDao.existeAvatar(Session["IDCom"].ToString()) != false)
                {
                    imgAvatar.ImageUrl = "~/AvatarComplejo.aspx?id=" + Session["IDCom"].ToString();
                    CambiarImagen();
                }
                else
                {
                    imgAvatar.ImageUrl        = "~/Imagenes/complejo_logo_default.png";
                    btn_guardarImagen.Visible = true;
                }
                if (compSelec.FechaRegistro.ToString() != string.Empty)
                {
                    DateTime fecha = (DateTime)Convert.ChangeType(compSelec.FechaRegistro, typeof(DateTime));
                    lblFecResultado.Text = fecha.ToString(@"dd/MM/yyyy");
                }
                else
                {
                    lblFecResultado.Text = "-";
                }

                CargarRepeaterImagenes();
                lblFecha.Visible        = true;
                lblFecResultado.Visible = true;
                lblDeportes.Visible     = true;
                lblDepResultado.Visible = true;
                btnEliminar.Enabled     = true;
                btnCanchas.Enabled      = true;
                btnServicios.Enabled    = true;


                // Agregado por Nico
                Session["idMapa"] = compSelec.Mapa;
                cargarMapa(int.Parse(Session["IDCom"].ToString()));
            }

            //else
            //{
            //    Limpiar();
            //}
        }
Beispiel #24
0
 protected void CargarRepeaterComplejos(string nomb, int?idUsuario, string d1, string d2, string d3, string d4)
 {
     encuentrosRepeater.DataSource = ComplejoDeportivoDao.ObtenerComplejosFiltros(nomb, idUsuario, d1, d2, d3, d4);
     encuentrosRepeater.DataBind();
     //encuentrosRepeater.ItemCommand += new RepeaterCommandEventHandler(encuentroRepeater_ItemCommand);
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     byte[] img = ComplejoDeportivoDao.ObtenerImagen(Session["IDCom"].ToString(), 3);
     Response.BinaryWrite(img);
 }
        //private void CargarDdlHoras()
        //{
        //    ComplejoDeportivo comp = new ComplejoDeportivo();
        //    comp = ComplejoDeportivoDao.ObtenerComplejosPorID(int.Parse(ddlComp.SelectedValue));

        //    //ddlHora.Items.Add(comp.horaApertura.ToString());
        //    TimeSpan time1 = new TimeSpan(0, 0, 0);
        //    TimeSpan time2 = new TimeSpan(1, 0, 0);
        //    time1 = TimeSpan.Parse(comp.horaApertura.ToString());
        //    while(time1 <= comp.horaCierre)
        //    {
        //        ddlHora.Items.Add(time1.ToString());
        //        time1=+time2;
        //    }
        //}

        //protected void ddlComp_SelectedIndexChanged(object sender, EventArgs e)
        //{
        //    ddlHora.Items.Clear();
        //    CargarDdlHoras();
        //}

        //VER COMO HACER PARA QUE TRAIGA TODAS LAS CANCHAS DEL COMPLEJO CON SU ESTADO EN BASE AL DIA Y LA HORA SELECCIONADA

        //protected void CargarGrillaCanchas()
        //{
        //    gvCanchas.DataSource = null;

        //    gvCanchas.DataSource = (from can in CanchaDao.ObtenerCanchasPorComplejos(IDCom.Value)
        //                            orderby can.Deporte, can.Nombre
        //                            select can);

        //    gvCanchas.DataKeyNames = new string[] { "ID" };
        //    gvCanchas.DataBind();
        //}

        //Modificado por eliminar tabla Responsable
        private void cargarAgenda()
        {
            gdv_Agenda.Columns[7].Visible = true;
            lbl_agendaFecha.Text          = "Agenda";// + cld_Fecha.SelectedDate;
            //******************************************
            // Generar Horarios
            spObtenerComplejosJoin_Result cd = ComplejoDeportivoDao.ObtenerComplejoPorUsuario(int.Parse(Session["ID"].ToString()));
            DateTime horaApertura            = DateTime.Parse((cd.Apertura).ToString());
            DateTime horario = DateTime.Parse((cd.Cierre - cd.Apertura).ToString());
            int      ha      = int.Parse(horaApertura.Hour.ToString());


            int horas = int.Parse(horario.Hour.ToString());

            List <AgendaEntidad> listaDatosAgenda    = AgendaDao.ObtenerAgendaComplejo(cd.ID, ddlDeportes.SelectedIndex);
            AgendaEntidad        agenda              = null;
            List <AgendaEntidad> listaAgendaGenerada = new List <AgendaEntidad>();

            foreach (AgendaEntidad a in listaDatosAgenda)
            {
                for (int i = 0; i < horas; i++)
                {
                    agenda                     = new AgendaEntidad();
                    agenda.idCancha            = a.idCancha;
                    agenda.nombreCancha        = a.nombreCancha;
                    agenda.nombreTipoCancha    = a.nombreTipoCancha;
                    agenda.horaInicioHorario   = TimeSpan.FromHours((ha + i));
                    agenda.precioCancha        = a.precioCancha;
                    agenda.capacidadTipoCancha = a.capacidadTipoCancha;;

                    listaAgendaGenerada.Add(agenda);
                }
            }

            //**************************************************
            // Quitar Horarios Reservados

            List <AgendaEntidad> listaHorariosReservados  = AgendaDao.ObtenerHorariosReservados2(cd.ID, cld_Fecha.SelectedDate);
            List <AgendaEntidad> listaHorariosDisponibles = new List <AgendaEntidad>();

            if (listaHorariosReservados.Count != 0)
            {
                foreach (AgendaEntidad lg in listaAgendaGenerada)
                {
                    foreach (AgendaEntidad lr in listaHorariosReservados)
                    {
                        // if (!(lg.idCancha == lr.idCancha && lg.horaInicioHorario == lr.horaInicioHorario))
                        if (lg.idCancha == lr.idCancha && lg.horaInicioHorario == lr.horaInicioHorario)
                        {
                            lg.idEstadoHorario = lr.idEstadoHorario;
                            //agenda = new AgendaEntidad();

                            //agenda.idCancha = lg.idCancha;
                            //agenda.nombreCancha = lg.nombreCancha;
                            //agenda.nombreTipoCancha = lg.nombreTipoCancha;
                            //agenda.horaInicioHorario = lg.horaInicioHorario;
                            //agenda.precioCancha = lg.precioCancha;
                            //agenda.capacidadTipoCancha = lg.capacidadTipoCancha;

                            //listaHorariosDisponibles.Add(agenda);
                        }
                    }
                }
            }
            //else { listaHorariosDisponibles = listaAgendaGenerada; }


            //*************************************************
            // Cargar Horarios
            // gdv_Agenda.DataSource = listaAgenda;
            // gdv_Agenda.DataSource = listaHorariosDisponibles;

            foreach (AgendaEntidad lg in listaAgendaGenerada)
            {
                //if (lg.idEstadoHorario == null)
                //{
                listaHorariosDisponibles.Add(lg);
                //}
            }

            if (listaHorariosDisponibles.Count > 0)
            {
                gdv_Agenda.DataSource = listaHorariosDisponibles;
            }
            else
            {
                gdv_Agenda.DataSource = listaAgendaGenerada;
            }


            //  gdv_Agenda.DataSource = AgendaDao.ObtenerAgendaComplejo(cmb_Complejo.SelectedIndex);
            gdv_Agenda.DataKeyNames = new string[] { "idCancha" };
            gdv_Agenda.DataBind();

            foreach (GridViewRow row in gdv_Agenda.Rows)
            {
                if (row.Cells[7].Text == "1")
                {
                    row.BackColor = Color.FromName("LightCoral");
                    //row.Enabled = false;
                }
            }

            gdv_Agenda.Columns[7].Visible = false;
        }