Esempio n. 1
0
        public void primerPrecio(Precio inserta)
        {
            string query = "SELECT * FROM Precio";

            //open connection
            abreConexion();

            //create command and assign the query and connection from the constructor
            MySqlCommand cmd = new MySqlCommand(query, connection);

            //Execute command
            reader = cmd.ExecuteReader();

            if (!reader.HasRows)
            {
                query = "INSERT INTO Precio (fechaPrecio,precioBase,miercoles,gafas,especial,iva,tresD,digital) VALUES('"
                        + DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day + "', '" + inserta.PrecioBase + "','" +
                        inserta.Miercoles + "','" + inserta.Gafas + "','" + inserta.Especial +
                        "','" + 100 * inserta.Iva + "','" + inserta.TresD + "','" + inserta.Vd + "')";
                reader.Close();
                cierraConexion();
                abreConexion();
                cmd = new MySqlCommand(query, connection);
                //Execute command
                cmd.ExecuteNonQuery();
            }

            cierraConexion();
        }
Esempio n. 2
0
 public Main()
 {
     try
     {
         IconoBueno   = new Icon(Path.Combine(Application.StartupPath + "\\" + Application.ProductName, @"..\Datos\IconoLibre.ico"));
         IconoRegular = new Icon(Path.Combine(Application.StartupPath + "\\" + Application.ProductName, @"..\Datos\IconoElegido.ico"));
         IconoMalo    = new Icon(Path.Combine(Application.StartupPath + "\\" + Application.ProductName, @"..\Datos\IconoVendido.ico"));
     }
     catch { }
     InitializeComponent();
     if (Login.Usuario() != "admin")
     {
         tabControl1.TabPages.Remove(tabPage2);
         tabControl1.TabPages.Remove(tabPage3);
         tabControl1.TabPages.Remove(tabPage4);
     }
     else
     {
         if (tabControl1.TabPages.Count == 1)
         {
             tabControl1.TabPages.Add(tabPage2);
             tabControl1.TabPages.Add(tabPage3);
             tabControl1.TabPages.Add(tabPage4);
         }
     }
     basedatos        = new BaseDatos();
     lbEmpleado.Text  = Login.Usuario();
     tablilla         = new int[filas, butacas];
     tickets          = new Ticketss();
     misPeliculas     = new Peliculas();
     pelicula         = new Pelicula();
     precio           = new Precio(-1, -1, 1, 2, 0.5f, 0.18f, 4.25f);
     precios          = new ArrayList();
     comp             = new Compra();
     empleados        = new Empleados();
     individualIVA    = precio.PrecioBase + (precio.PrecioBase * precio.Iva);
     individual       = individualIVA;
     grafico          = tabPage1.CreateGraphics();
     esquinaInferiorX = ox + (tamaño * butacas) + tamaño;
     esquinaInferiorY = oy + (tamaño * filas) + tamaño;
 }
Esempio n. 3
0
 private void btActualizaPrecios_Click(object sender, EventArgs e)
 {
     try
     {
         float f = Math.Abs(float.Parse(tbPrecioIva.Text));
         if (f > 1)
         {
             f = f / 100;
         }
         precio = new Precio(-Math.Abs(float.Parse(tbPrecioMiercoles.Text)), -Math.Abs(float.Parse(tbPrecioEspecial.Text)), Math.Abs(float.Parse(tbPrecioDigital.Text)),
                             Math.Abs(float.Parse(tbPrecio3D.Text)), Math.Abs(float.Parse(tbPrecioGafas.Text)),
                             f, Math.Abs(float.Parse(tbPrecioBase.Text)));
         basedatos.Inserta(precio);
         actualizaPrecios();
         MessageBox.Show("Los precios han sido actualizados");
     }
     catch
     {
         MessageBox.Show("No has rellenado correctamente los precios");
     }
 }
Esempio n. 4
0
        public void Inserta(object inserta)
        {
            bool echo = false;

            try
            {
                string query = "";
                if (compruebaTipo(inserta, "Ticket"))
                {
                    Ticket t = (Ticket)inserta;
                    query = "INSERT INTO Ticket (fechaExpedicion,tipoExpedicion,tipoCobro,fechaSesion,horaSesion,idPelicula,salaProyeccion,fila,butaca,precioTotal,comprobado,loginFichar,compra)" +
                            "VALUES('" + t.fechaExpedicionToString() + "','taquilla','" + "cash" + "','" + t.fechaSesionToString() +
                            "','" + t.horaSesionToString() + "','" + t.IdPelicula + "','" + t.SalaProyeccion + "','" +
                            t.Fila + "','" + t.Columna + "','" + t.PrecioTotal + "','" + falsoVerdadero(true) + "','" + t.LoginFichar + "','" + t.Compra + "')";
                }
                else if (compruebaTipo(inserta, "Empleado"))
                {
                    Empleado e = (Empleado)inserta;
                    if (!compruebaEmpleado(e.Dni))
                    {
                        query = "INSERT INTO Empleado (login,clave,nombre,apellidos,dni) VALUES('" + e.Login + "', '" + e.Clave + "','" +
                                e.Nombre + "','" + e.Apellidos + "','" + e.Dni + "')";
                    }
                    else
                    {
                        echo = Actualiza(e);
                    }
                }
                else if (compruebaTipo(inserta, "Pelicula"))
                {
                    Pelicula p = (Pelicula)inserta;
                    if (!compruebaPeli(p.Sala, p.IdPelicula))
                    {
                        query = "INSERT INTO Pelicula (nombrePelicula,descripcion,foto,cartel,genero,director,interpretes,calificacion,trailler,duracion,tresD,vo,vos,vd,treintaycincomm,digital,fechaInicio,fechaFin,salaProyeccion)" +
                                "VALUES('" + p.Nombre + "','" +
                                p.Descripcion + "','" + p.RutaFoto + "','" + p.RutaCartel +
                                "','" + p.generoToString() + "','" + p.Director + "','" + p.Interpretes + "','" +
                                p.Calificacion + "','" + p.Trailer + "','" + p.Duracion + "','" + falsoVerdadero(p.TresD) + "','" + falsoVerdadero(p.Vo) +
                                "','" + falsoVerdadero(p.Vos) + "','" + falsoVerdadero(p.Vd) + "','" + falsoVerdadero(p.TreintaYCincoMm) + "','" + falsoVerdadero(p.Digital) + "','" + p.proyeccionToString() +
                                "','" + p.finProyeccionToString() + "','" + p.Sala + "')";
                        // subeFotos(p.Fotos, p.Nombre, "foto");
                        //subeFotos(p.Cartel, p.Nombre, "cartel");
                    }
                    else
                    {
                        echo = true;
                    }
                }
                else if (compruebaTipo(inserta, "Precio"))
                {
                    Precio p = ((Precio)inserta);
                    query = "UPDATE Precio SET fechaPrecio='" + DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day + "', precioBase='" + p.PrecioBase + "',miercoles='" +
                            p.Miercoles + "',gafas='" + p.Gafas + "',especial='" + p.Especial +
                            "',iva='" + 100 * p.Iva + "',tresD='" + p.TresD + "',digital='" + p.Vd + "'";
                }
                if (!echo)
                {
                    //open connection
                    abreConexion();

                    //create command and assign the query and connection from the constructor
                    MySqlCommand cmd = new MySqlCommand(query, connection);

                    //Execute command
                    cmd.ExecuteNonQuery();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            cierraConexion();
        }