示例#1
0
        protected void grResultado_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            Evento = new localhost.EventoBO();
            if (e.CommandName == "SELECT")
            {
                indice              = Convert.ToInt32(e.CommandArgument);
                Session["Id"]       = Convert.ToInt32(grResultado.Rows[indice].Cells[0].Text);
                txtNombre.Text      = HttpUtility.HtmlDecode(grResultado.Rows[indice].Cells[1].Text);
                txtDescripcion.Text = HttpUtility.HtmlDecode(grResultado.Rows[indice].Cells[2].Text);
                txtDireccion.Text   = HttpUtility.HtmlDecode(grResultado.Rows[indice].Cells[3].Text);

                ddlEstatus.SelectedValue = HttpUtility.HtmlDecode(grResultado.Rows[indice].Cells[4].Text);
                Session["Id"]            = Convert.ToInt32(grResultado.Rows[indice].Cells[0].Text);
                Evento.IdEventos         = Convert.ToInt32(grResultado.Rows[indice].Cells[0].Text);
                latitude.Text            = servicio.BuscarEventoDAO(Evento).Rows[0].ItemArray[6].ToString();
                longitude.Text           = servicio.BuscarEventoDAO(Evento).Rows[0].ItemArray[7].ToString();

                //Session["IdU"] =Convert.ToInt32(servicio.BuscarUbicacionesDAO(Ubicacion).Rows[0].ItemArray[0].ToString());

                try
                {
                    //Foto.IdEvento = (int)Session["Id"];
                    //FileUpload1. = servicio.BuscarFotoDAO(Foto).Rows[0].ItemArray[1];
                }
                catch
                { }
            }
            if (e.CommandName == "Delete")
            {
                indice = Convert.ToInt32(e.CommandArgument);

                Evento.IdEventos = Convert.ToInt32(grResultado.Rows[indice].Cells[0].Text);
                Foto.IdSitio     = Convert.ToInt32(grResultado.Rows[indice].Cells[0].Text);
                try
                {
                    Foto.IdFoto = Convert.ToInt32(servicio.BuscarFotoDAO(Foto).Rows[0].ItemArray[0].ToString());
                    servicio.EliminarFotoDAO(Foto);
                }
                catch { }


                try
                {
                    servicio.EliminarEventoDAO(Evento);
                    Mensaje("Se elimino exitosamente");
                }
                catch
                {
                    Mensaje("Ocurrio un error al eliminar intentelo más tarde");
                }
                Evento = new localhost.EventoBO();
                llenarDataGrid(Evento);
            }
        }
示例#2
0
 public object llenarDatos()
 {
     Evento             = new localhost.EventoBO();
     US                 = (DataTable)Session["Usuarios"];
     Evento.Nombre      = txtNombre.Text;
     Evento.Descripcion = txtDescripcion.Text;
     Evento.Longitud    = longitude.Text;
     Evento.Latitud     = latitude.Text;
     Evento.Direccion   = txtDireccion.Text;
     //Evento.idUsuario = Convert.ToInt32(US.Rows[0].ItemArray[0]);
     return(Evento);
 }
示例#3
0
 public void limpiar()
 {
     txtNombre.Text = "";
     //address.Text = "";
     txtDescripcion.Text      = "";
     ddlEstatus.SelectedValue = "Activo";
     FileUpload2       = null;
     latitude.Text     = 20.96645955666419.ToString();
     longitude.Text    = (-89.62270814819334).ToString();
     txtDireccion.Text = "";
     Evento            = new localhost.EventoBO();
     llenarDataGrid(Evento);
 }
示例#4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         Evento = new localhost.EventoBO();
         llenarDataGrid(Evento);
         US = (DataTable)Session["Usuarios"];
         if (Convert.ToInt32(US.Rows[0].ItemArray[9]) != 1)
         {
             ddl.Visible = false;
         }
     }
 }
示例#5
0
        public void Agregar()
        {
            string Res = ValidarCampos();

            llenarDatos();

            if (Res.Trim().Length == 0)
            {
                int i = 0;
                try
                {
                    i = servicio.agregarEventoDAO(Evento);
                }
                catch
                {
                    i = 0;
                }
                if (i == 1)
                {
                    if (FileUpload2.HasFile)
                    {
                        Foto.IdSitio = Convert.ToInt32(servicio.BuscarEventoDAO(Evento).Rows[0].ItemArray[0].ToString());

                        int j = servicio.agregarFotoDAO(Foto);
                        if (j == 1)
                        {
                            Mensaje("Los datos se agregaron correctamente");
                            llenarDataGrid(Evento);
                            limpiar();
                        }
                        else
                        {
                            Mensaje("Error al agregar imagen intentalo más tarde");
                        }
                    }
                    else
                    {
                        Mensaje("La información del Evento se agrego correctamente");
                    }
                }

                else
                {
                    Mensaje("Los datos no se agregaron, intenta de nuevo");
                }
                Evento = new localhost.EventoBO();
                llenarDataGrid(Evento);
            }
        }