예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (int.TryParse(Request.QueryString["id"], out id)) {
                if (id >= 0) {
                    alquiler = new Alquiler();
                    alquiler.Id = id;
                    DTalquiler = consultas.ConsultarAlquileresId(alquiler);
                    DTalquilerPelículas = consultas.ConsultarAlquileresPelículas(alquiler);

                    GVAlquiler.DataSource = DTalquiler;
                    GVAlquiler.DataBind();
                    GVAlquilerPelícula.DataSource = DTalquilerPelículas;
                    GVAlquilerPelícula.DataBind();
                }
            }
        }
예제 #2
0
        protected void BBuscar_Click(object sender, EventArgs e)
        {
            DateTime fecha;
            DateTime entrega;
            int codigoSocio;

            try { codigoSocio = Convert.ToInt32(TBSocio.Text); }
            catch (Exception) { codigoSocio = -1; }

            fecha = CInicio.SelectedDate;
            entrega = CFinal.SelectedDate;

            Alquiler nAlquileres = new Alquiler();
            nAlquileres.Fecha = fecha;
            nAlquileres.Entrega = entrega;
            DataTable InfoAlquileres = insConsultasBLL.ConsultarAlquilerFecha(nAlquileres,codigoSocio);
            this.GVLista.DataSource = InfoAlquileres;
            this.GVLista.DataBind();
        }
예제 #3
0
        protected void BAgregar_Click(object sender, EventArgs e)
        {
            DateTime fecha;
            DateTime entrega;
            int plazo;
            int costo;
            int codigo_socio;

            fecha = DateTime.Now;

            try { codigo_socio = Convert.ToInt32(this.TBCliente.Text); }
            catch (Exception) { codigo_socio = -1; }

            Utilerías.Objetos.Cliente nCliente = new Utilerías.Objetos.Cliente();
            nCliente.NumeroSocio = codigo_socio;
            DataTable moroso = insConsultasBLL.ConsultarSocio(nCliente);

            if(moroso.Rows.Count != 0)
            {
                int estado = Convert.ToInt32(moroso.Rows[0]["estado"]);
                if (estado == 1)
                {
                    div.InnerHtml = "<script > alert('El usuario esta moroso');</script > ";
                }
                else
                {
                    costo = calcCosto();
                    entrega = calcEntrega();
                    plazo = cantDias();

                    TBCosto.Text = costo.ToString();
                    TBDevolución.Text = entrega.ToString();

                    Alquiler nAlquiler = new Alquiler();
                    nAlquiler.Socio = codigo_socio;
                    nAlquiler.Fecha = fecha;
                    nAlquiler.Entrega = entrega;
                    nAlquiler.Costo = costo;
                    nAlquiler.Plazo = plazo;
                    nAlquiler.Devuelto = false;

                    try { insRegistroBLL.RegistrarAlquiler(nAlquiler, pelisAlquiladas); }
                    catch (Exception ex)
                    {
                        div.InnerHtml = "<script > alert(' " + ex.Message + "');</script > ";
                        return;
                    }
                    div.InnerHtml = "<script > alert('Se ha registrado el alquiler exitosamente');</script > ";
                }

            }
            else
                div.InnerHtml = "<script > alert('No existe ningún socio asociado a ese código');</script > ";

            for(int i=0; i < pelisAlquiladas.Rows.Count; i++)
                   pelisAlquiladas.Rows.RemoveAt(i);
        }