public Form1(Ver padre, int numero)
 {
     this.padre = padre;
     InitializeComponent();
     editor.plantilla = numero;
     editor.Focus();
 }
        public Edicion(Ver padre, int numero)
        {
            InitializeComponent();
            conexion       = new Conexion();
            this.padre     = padre;
            this.plantilla = numero;
            this.recargar();

            cantidad = 0;

            actualizarEventos();
        }
Example #3
0
 public void darPadre(Ver ver)
 {
     this.padre = ver;
 }
        /// <summary>
        /// carga las mesas en un form
        /// </summary>
        /// <param name="ver"></param>
        /// <param name="plantilla"></param>
        internal void cargarMesas(Ver ver, int plantilla)
        {
            conectar();
            String        consulta = "select * from mesa where dia = " + plantilla;
            SQLiteCommand command  = new SQLiteCommand(consulta, connection);

            try
            {
                SQLiteDataReader lector = command.ExecuteReader();

                while (lector.Read())
                {
                    int    numero  = lector.GetInt32(0);
                    int    dia     = lector.GetInt32(1);
                    int    y       = lector.GetInt32(2);
                    int    x       = lector.GetInt32(3);
                    int    alto    = lector.GetInt32(4);
                    int    ancho   = lector.GetInt32(5);
                    string tag     = lector.GetString(6);
                    bool   ocupado = bool.Parse(lector.GetString(7));
                    int    estado  = lector.GetInt32(10);

                    DateTime dateTime;

                    if (!lector.GetString(8).Equals(""))
                    {
                        dateTime = DateTime.Parse(lector.GetString(8));
                    }
                    else
                    {
                        dateTime = new DateTime();
                    }

                    Item item = new Item();
                    item.darIndex(numero);
                    item.Llegada  = dateTime;
                    item.Location = new Point(x, y);
                    item.Size     = new Size(ancho, alto);
                    item.Tag      = tag;
                    item.estaOcupado(ocupado);
                    item.BackColor = SystemColors.ActiveCaption;
                    item.darEstado(estado);
                    item.Show();


                    switch (tag)
                    {
                    case "Mesa Blanca 4":
                        item.Image       = Resources.mesa_de_madera_4_;
                        item.SizeMode    = PictureBoxSizeMode.StretchImage;
                        item.Click      += ver.item_DoubleClick;
                        item.MouseHover += ver.Mouse_hover;
                        item.MouseLeave += ver.Mouse_Leave;

                        break;

                    case "Mesa Roja 4":
                        item.Image    = Resources.mesa_roja_4;
                        item.SizeMode = PictureBoxSizeMode.Zoom;

                        break;

                    case "Mesa Negra 4":
                        item.Image       = Resources.mesa_negra_4;
                        item.SizeMode    = PictureBoxSizeMode.Zoom;
                        item.Click      += ver.item_DoubleClick;
                        item.MouseHover += ver.Mouse_hover;
                        item.MouseLeave += ver.Mouse_Leave;
                        break;



                    case "Mesa Negra 6":
                        item.Image       = Resources.mesa_negra_6;
                        item.SizeMode    = PictureBoxSizeMode.Zoom;
                        item.Click      += ver.item_DoubleClick;
                        item.MouseHover += ver.Mouse_hover;
                        item.MouseLeave += ver.Mouse_Leave;
                        break;

                    case "Mesa Blanca 6":
                        item.Image       = Resources.mesa_blanca_6_personas;
                        item.SizeMode    = PictureBoxSizeMode.Zoom;
                        item.Click      += ver.item_DoubleClick;
                        item.MouseHover += ver.Mouse_hover;
                        item.MouseLeave += ver.Mouse_Leave;
                        break;

                    case "Pared":
                        item.Image       = Resources.pared_roja;
                        item.SizeMode    = PictureBoxSizeMode.StretchImage;
                        item.MouseHover += ver.Mouse_hover;
                        item.MouseLeave += ver.Mouse_Leave;
                        break;

                    case "Tabla Bar":
                        item.Image    = Resources.tabla_bar;
                        item.SizeMode = PictureBoxSizeMode.StretchImage;
                        break;
                    }


                    //rota la imagen
                    if (item.getEstado() == 2)
                    {
                        item.Image.RotateFlip(RotateFlipType.Rotate90FlipNone);
                    }
                    else if (item.getEstado() == 3)
                    {
                        item.Image.RotateFlip(RotateFlipType.Rotate90FlipNone);
                        item.Image.RotateFlip(RotateFlipType.Rotate90FlipNone);
                    }
                    else if (item.getEstado() == 4)
                    {
                        item.Image.RotateFlip(RotateFlipType.Rotate90FlipNone);
                        item.Image.RotateFlip(RotateFlipType.Rotate90FlipNone);
                        item.Image.RotateFlip(RotateFlipType.Rotate90FlipNone);
                    }
                    ver.planoVer.Controls.Add(item);
                }
                ver.planoVer.SendToBack();
                lector.Close();
                command.Connection.Close();
            }
            catch (Exception e)
            {
                command.Connection.Close();
                throw new Exception("no se pudo realizar la coneccion: " + e);
            }
            finally
            {
                command.Connection.Close();
            }
        }