Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        protected void BAgregar_Click(object sender, EventArgs e)
        {
            string nombre;
            string apellidos;
            int telefono;
            string email;
            string direccion;
            DateTime afiliacion;
            int estado;

            if (!FUFotografía.HasFile) return;

            try { telefono = Convert.ToInt32(TBTeléfono.Text); }
            catch (Exception) { telefono = -1; }

            nombre = TBNombre.Text;
            apellidos = TBApellidos.Text;
            Utilerías.Objetos.Cliente NSocio = new Utilerías.Objetos.Cliente();
            try {
                if (FUFotografía.PostedFile != null &&
                    FUFotografía.PostedFile.FileName != "") {
                    byte[] imageSize = FUFotografía.FileBytes;
                    NSocio.Fotografía = imageSize;
                }
            } catch (Exception) {
                return;
            }

            email = TBEmail.Text;
            direccion = TBDirección.Text;
            afiliacion = DateTime.Now;
            estado = 1;

            NSocio.Nombre = nombre;
            NSocio.Apellidos = apellidos;

            NSocio.Teléfono = telefono;
            NSocio.Email = email;
            NSocio.Dirección = direccion;
            NSocio.Afiliación = afiliacion;
            NSocio.Estado = estado;
            try { registroBLL.RegistrarSocio(NSocio); }
            catch (Exception ex)
            {
                div.InnerHtml = "<script > alert(' " + ex.Message + "');</script > ";
                return;
            }

            div.InnerHtml = "<script > alert(' Se ha registrado el cliente de forma exitosa');</script > ";
        }
Exemplo n.º 3
0
        protected void BAgregar_Click(object sender, EventArgs e)
        {
            DataTable esSocio;
            int codigo_socio;
            DateTime fecha;
            int costo = 0;

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

            fecha = DateTime.Now;

            if (codigo_socio != -1)
            {
                Utilerías.Objetos.Cliente nCliente = new Utilerías.Objetos.Cliente();
                nCliente.NumeroSocio = codigo_socio;
                esSocio = insConsultasBLL.ConsultarSocio(nCliente);

                if (esSocio.Rows.Count != 0)
                {
                    costo = calcCosto("socio");
                }
            }

            else
            {
                costo = calcCosto("particular");
            }

            TBCosto.Text = costo.ToString();

            Venta nVenta = new Venta();
            nVenta.Cliente = codigo_socio;
            nVenta.Fecha = fecha;
            nVenta.Costo = costo;

            try { insRegistroBLL.RegistrarVenta(nVenta, pelisVendidas); }
            catch (Exception ex)
            {
                div.InnerHtml = "<script > alert(' " + ex.Message + "');</script > ";
                return;
            }

            div.InnerHtml = "<script > alert('Se registro la venta de forma exitosa');</script > ";

            for (int i = 0; i < pelisVendidas.Rows.Count; i++)
                pelisVendidas.Rows.RemoveAt(i);
        }
Exemplo n.º 4
0
        public void ProcessRequest(HttpContext ctx)
        {
            string id = ctx.Request.QueryString["id"];
            BLL.Consultas consulta = new Consultas();
            Utilerías.Objetos.Cliente c = new Utilerías.Objetos.Cliente();
            int idSocio;
            if (int.TryParse(id, out idSocio)) {
                c.NumeroSocio = idSocio;
                DataTable cliente = consulta.ConsultarSocio(c);
                byte[] pict = cliente.Rows[0].Field<byte[]>("fotografia");

                ctx.Response.ContentType = "image/bmp";
                ctx.Response.OutputStream.Write(pict, 0, pict.Length);

            }
        }
Exemplo n.º 5
0
        protected void BBuscar_Click(object sender, EventArgs e)
        {
            int código;
            try { código = Convert.ToInt32(TBCódigo.Text); } catch (Exception) { código = -1; }

            Utilerías.Objetos.Cliente nCliente = new Utilerías.Objetos.Cliente();
            nCliente.NumeroSocio = código;
            nCliente.Nombre = TBNombre.Text;

            cliente = insConsultasBLL.ConsultarSocio(nCliente);
            GVLista.DataSource = cliente;
            GVLista.DataBind();

            if (cliente.Rows[0].Field<byte[]>("fotografia") != null)
                IFotografía.ImageUrl = "/SocioFotografía.ashx?id=" + código.ToString();
            else
                IFotografía.ImageUrl = "/Avatar.png";
        }