Example #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (TxtTitulo.Text != "" & TxtGenero.Text != "" & TxtPais.Text != "" & BAnoCom.selectedIndex != -1)//Controlo que todo haya sido asignado
     {
         Cls.ClsUs Objus = new Cls.ClsUs();
         //Declaro un objeto de la clase ClsPeliculas y le asigno una película
         Cls.ClsPeliculas ObjP = new Cls.ClsPeliculas();
         String           Titulo, Genero, Ano, Pais;
         Titulo = TxtTitulo.Text;
         Genero = TxtGenero.Text;
         Ano    = BAnoCom.selectedValue;
         Pais   = TxtPais.Text;
         ObjP.SetTitulo(Titulo);
         ObjP.SetGenero(Genero);
         ObjP.SetAno(Ano);
         ObjP.SetPais(Pais);
         Objus.APelicula(ObjP);                        //Inserto la película
         BCDGrid.DataSource = Objus.BuscarPeliculas(); //Realizo otra búsqueda de las películas y con ella actualizo la grilla con los resultados
         LimpiarFormulario();                          //Limpio el formulario de lo ingresado
     }
     else                                              //Si no se han ingresado todos los valores lo digo
     {
         LblError.Visible = true;
         LblError.Text    = "ERROR: No se han ingresado todos los valores del producto.";
     }
 }
Example #2
0
 private void Form1_Load(object sender, EventArgs e)
 {
     Cls.ClsUs ObjUsuario = new Cls.ClsUs();
     //Genero al iniciar el formulario el listado de fechas para el combobox BAnoCom
     for (int i = 2019; i >= 1895; i--)
     {
         BAnoCom.AddItem(i.ToString());
     }
     BCDGrid.DataSource = ObjUsuario.BuscarPeliculas();//Realizo la búsqueda de las películas y lo cargo en la grilla con lo buscado
 }
Example #3
0
 private void BttnVer_Click(object sender, EventArgs e)
 {
     Cls.ClsUs ObjUs = new Cls.ClsUs();
     this.Size = new Size(800, this.Size.Height); //Modifico el tamaño del formulario para mostrar la opción de ventas
     this.CenterToScreen();                       //Centro el formulario
     BttnSalir.Location   = new Point(732, 0);    //Modifico la posición del botón de cierre del formulario
     PnlVent.Visible      = true;                 //Hago visible el pannel
     PnlVenta.Visible     = false;
     BGVVentas.DataSource = ObjUs.ListarVentas();
     DVVenta = new DataView((DataTable)BGVVentas.DataSource);//Lleno el DVCliente para luego buscar
 }
Example #4
0
        private void button3_Click(object sender, EventArgs e)
        {
            Cls.ClsUs Objus = new Cls.ClsUs();
            //Declaro un objeto de la clase ClsPeliculas y le asigno una película
            Cls.ClsPeliculas ObjP = new Cls.ClsPeliculas();
            int ID;

            ID = int.Parse(TxtID.Text);
            ObjP.SetID(ID);
            Objus.BPelicula(ObjP);                        //Doy de baja la película
            BCDGrid.DataSource = Objus.BuscarPeliculas(); //Realizo otra búsqueda de las películas y con ella actualizo la grilla con los resultados
            LimpiarFormulario();                          //Limpio el formulario de lo ingresado
        }
Example #5
0
 private void FrmVentas_Load(object sender, EventArgs e)
 {
     Cls.ClsUs ObjUS = new Cls.ClsUs();                    //Referencio al usuario
     DTPel      = ObjUS.BuscarPeliculas();                 //Le guardo las películas
     DTClientes = ObjUS.BuscarClientes();
     for (int i = 0; i < DTPel.Rows.Count; i++)            //Inserto tantas películas como haya disponibles para insertar
     {
         CmbPelicula.AddItem(DTPel.Rows[i][1].ToString()); //Inserto específicamente los nombres en el combobox
     }
     for (int i = 0; i < DTClientes.Rows.Count; i++)
     {                                                          //Inserto tantas películas como haya disponibles para insertar
         CmbClientes.AddItem(DTClientes.Rows[i][1].ToString()); //Inserto específicamente los nombres en el combobox
     }
 }
Example #6
0
 private void BttnGuardar_Click(object sender, EventArgs e)
 {
     Cls.ClsUs     ObjUs   = new Cls.ClsUs();
     Cls.ClsVentas ObjVent = new Cls.ClsVentas();
     if (BttnGenerarVenta.Text == "GENERAR VENTA")
     {                            //Si se desea generar una nueva venta trabajo con los datos correspondientes y habilito tanto como muestro los datos correspondientes
         DataRow  Row;
         DateTime DTime;          //Fecha de la venta
         string   ID;
         DTime = DTPFecha.Value;  //La asigo su valor correspondiente
         ObjVent.SetFecha(DTime); //Ingreso los datos en el objeto ObjVent para a posterior insertar la venta
         ObjUs.AVenta(ObjVent);   //Ingreso la venta
         Row = ObjUs.BuscarUltVenta().Rows[0];
         ID  = Row[0].ToString();
         DTPFecha.Enabled      = false;
         BttnGenerarVenta.Text = "Finalizar venta";
         TxtID.Text            = ID;
         LblID.Visible         = true;
         TxtID.Visible         = true;
         this.Size             = new Size(800, this.Size.Height); //Modifico el tamaño del formulario para mostrar la opción de ventas
         this.CenterToScreen();                                   //Centro el formulario
         BttnSalir.Location       = new Point(732, 0);            //Modifico la posición del botón de cierre del formulario
         PnlVenta.Visible         = true;
         PnlVent.Visible          = false;
         CmbClientes.Enabled      = false; //Desactivo el cambio de cliente
         LblCliente.Text         += " " + CmbClientes.selectedValue;
         BttnGenerarVenta.Enabled = false; //Desactivo el botón con el fin de que no se agreguen ventas vacías
         BttnVer.Enabled          = false; //Deshabilito el ver las ventas
     }
     else                                  //Actualizo la venta con su nuevo monto
     {
         int      ID;                      //Datos de la venta
         DateTime Fecha;
         int      Monto;
         ID    = int.Parse(TxtID.Text);//Le agisno los valores correspondientes
         Fecha = DTPFecha.Value;
         Monto = int.Parse(LblPrecio.Text);
         ObjVent.SetID(ID);//Coloco los datos ya extraídos directamente en el objeto ObjVent
         ObjVent.SetFecha(Fecha);
         ObjVent.SetMonto(Monto);
         ObjUs.MVenta(ObjVent);  //Lo envío a modo de actualizar los datos de la venta
         BttnVer.Enabled = true; //Habilito el ver ventas mediante su botón
         Close();                //Cierro el formulario
     }
 }
Example #7
0
        private void Button1_Click(object sender, EventArgs e)
        {
            Cls.ClsUs          ObjUs         = new Cls.ClsUs();
            Cls.ClsPelisVentas ObjPeliVentas = new Cls.ClsPelisVentas();
            int IDPelicula;
            int IDVenta;
            int IDCliente;
            int Ind;                                                           //Ubicación del item del combobox seleccionado
            int IndCliente;                                                    //Ubicación del cliente seleccionado en el comboBox
            int Precio;                                                        //Precio del producto

            Ind        = CmbPelicula.selectedIndex;                            //Le asigno el index
            IndCliente = CmbClientes.selectedIndex;
            IDPelicula = int.Parse(DTPel.Rows[Ind][0].ToString());             //Según la ubicación del item seleccionado busco en el datatable que almacena los datos de las películas
            IDCliente  = int.Parse(DTClientes.Rows[IndCliente][0].ToString()); //Obtengo la ID Del cliente seleccionado
            Precio     = int.Parse(TxtPrec.Text);                              //Guardo el precio
            IDVenta    = int.Parse(TxtID.Text);
            ObjPeliVentas.SetIDPelicula(IDPelicula);                           //Asigno los valores correspondientes al objeto de ClsPelisVentas
            ObjPeliVentas.SetIDVenta(IDVenta);
            ObjPeliVentas.SetIDCliente(IDCliente);
            ObjPeliVentas.SetPrecio(Precio);
            int RowCorrecta = BCDGrid.Rows.Count;

            ObjUs.APeliVenta(ObjPeliVentas);                                      //Agrego la película a la venta(Inserto PelisVentas)
            BCDGrid.Rows.Add(1);                                                  //Agrego una nueva fila al datagridview
            BCDGrid.Rows[RowCorrecta].Cells[1].Value = "$" + TxtPrec.Text;        //Guardo el precio en el datagridview
            BCDGrid.Rows[RowCorrecta].Cells[0].Value = CmbPelicula.selectedValue; //Guardo la película en el datagridview
            if (!BttnGenerarVenta.Enabled)                                        //Si el botón está bloqueado lo habilito
            {
                BttnGenerarVenta.Enabled = true;
            }
            if (LblPrecio.Text == "?")//Si hay un precio ingresado lo sumo, sino le doy el precio ingresado
            {
                LblPrecio.Text = TxtPrec.Text;
            }
            else
            {
                LblPrecio.Text = (int.Parse(LblPrecio.Text) + int.Parse(TxtPrec.Text)).ToString();
            }
        }
Example #8
0
        private void button2_Click_1(object sender, EventArgs e)
        {
            Cls.ClsUs Objus = new Cls.ClsUs();
            //Declaro un objeto de la clase ClsPeliculas y le asigno una película
            Cls.ClsPeliculas ObjP = new Cls.ClsPeliculas();
            int    ID;
            String Titulo, Genero, Ano, Pais;

            ID     = int.Parse(TxtID.Text);
            Titulo = TxtTitulo.Text;
            Genero = TxtGenero.Text;
            Ano    = BAnoCom.selectedValue;
            Pais   = TxtPais.Text;
            ObjP.SetID(ID);
            ObjP.SetTitulo(Titulo);
            ObjP.SetGenero(Genero);
            ObjP.SetAno(Ano);
            ObjP.SetPais(Pais);
            Objus.MPelicula(ObjP);                        //Modifico la película
            BCDGrid.DataSource = Objus.BuscarPeliculas(); //Realizo otra búsqueda de las películas y con ella actualizo la grilla con los resultados
            LimpiarFormulario();                          //Limpio el formulario de lo ingresado
        }
        private void BttnGuardar_Click(object sender, EventArgs e)
        {
            Cls.ClsUs      ObjUs = new Cls.ClsUs();//Preparo los objetos para poder utilizarlos
            Cls.ClsCliente ObjCliente;
            String         Nombre, Telefono, Direccion;

            if (TxtNom.Text != "" & TxtTel.Text != "" & TxtDir.Text != "") //compruebo si se han rellenado los campos del cliente
            {
                Nombre     = TxtNom.Text;                                  //Obtengo los datos del cliente para a posterior guardarlos
                Telefono   = TxtTel.Text;
                Direccion  = TxtDir.Text;
                ObjCliente = new Cls.ClsCliente(Nombre, Telefono, Direccion);     //Creo el objeto mediante su constructor
                ObjUs.ACliente(ObjCliente);                                       //Guardo el cliente
                BCDGrid.DataSource = ObjUs.BuscarClientes();                      //Actualizo la grilla con los clientes almacenados
                DVCliente          = new DataView((DataTable)BCDGrid.DataSource); //LLeno el DVCLiente para buscar los usuarios
                LimpiarFormulario();                                              //Limpio el formulario
            }
            else  //Si no se han ingresado todos los valores lo digo
            {
                LblError.Visible = true;
                LblError.Text    = "ERROR: No deben de haber campos sin ingresar";
            }
        }
 private void FrmCliente_Load(object sender, EventArgs e)
 {
     Cls.ClsUs ObjUsuario = new Cls.ClsUs();
     BCDGrid.DataSource = ObjUsuario.BuscarClientes();
     DVCliente          = new DataView((DataTable)BCDGrid.DataSource);//Lleno el DVCliente para luego buscar
 }
Example #11
0
 private void BttnNormalizar_Click(object sender, EventArgs e)
 {//Reseteo el contenigo de la grilla cargada
     Cls.ClsUs ObjUs = new Cls.ClsUs();
     BGVVentas.DataSource = ObjUs.ListarVentas();
     DVVenta = new DataView((DataTable)BGVVentas.DataSource);//Lleno el DVCliente para luego buscar
 }