Beispiel #1
0
 public Table(int x, int y, string name)
 {
     X        = x;
     Y        = y;
     Name     = name;
     Products = new TableProductsList();
     InUse    = false;
 }
Beispiel #2
0
        private void btnAdd_Click(object sender, System.EventArgs e)
        {
            int index = Convert.ToInt32(
                ((Button)sender).Name.Split()[1]);

            TableProductsList Products = POS.GetTableProducts();

            ProductToSell product = new ProductToSell();

            product.ActualProduct = Products.Get(index).ActualProduct;

            POS.AddTableProduct(product);
            DrawTableProducts();
        }
Beispiel #3
0
        private void DrawTableProducts()
        {
            pnlTableProducts.Controls.Clear();
            this.lblWorker.Text = POS.Employee.Code.ToString("000");

            this.lblTableNumber.Text = POS.Index.ToString();

            TableProductsList products = POS.GetTableProducts();

            for (int i = 1; i <= products.Count; i++)
            {
                ProductToSell actualProduct = products.Get(i);
                //
                // btnSubstract
                //
                Button btnSubstract = new Button();
                btnSubstract.BackColor = System.Drawing.Color.White;
                btnSubstract.FlatAppearance.BorderColor =
                    System.Drawing.Color.Black;
                btnSubstract.FlatStyle =
                    FlatStyle.Popup;
                btnSubstract.Font =
                    new System.Drawing.Font("Microsoft Sans Serif",
                                            15.75F, System.Drawing.FontStyle.Regular,
                                            System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                btnSubstract.Location = new System.Drawing.Point(56, 110);
                btnSubstract.Name     = "btnSubstract " + i;
                btnSubstract.Size     = new System.Drawing.Size(33, 33);
                btnSubstract.TabIndex = 80;
                btnSubstract.Text     = "-";
                btnSubstract.UseVisualStyleBackColor = false;
                btnSubstract.Click +=
                    new System.EventHandler(btnSubstract_Click);
                //
                // btnAdd
                //
                Button btnAdd = new Button();
                btnAdd.BackColor = System.Drawing.Color.White;
                btnAdd.FlatAppearance.BorderColor =
                    System.Drawing.Color.Black;
                btnAdd.FlatStyle = FlatStyle.Popup;
                btnAdd.Font      =
                    new System.Drawing.Font("Microsoft Sans Serif",
                                            15.75F, System.Drawing.FontStyle.Regular,
                                            System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                btnAdd.Location = new System.Drawing.Point(56, 78);
                btnAdd.Name     = "btnAdd " + i;
                btnAdd.Size     = new System.Drawing.Size(33, 33);
                btnAdd.TabIndex = 81;
                btnAdd.Text     = "+";
                btnAdd.UseVisualStyleBackColor = false;
                btnAdd.Click +=
                    new System.EventHandler(btnAdd_Click);
                //
                // lblAmount
                //
                Label lblAmount = new Label();
                lblAmount.BackColor   = System.Drawing.Color.White;
                lblAmount.BorderStyle = BorderStyle.FixedSingle;
                if (actualProduct.Amount > 99)
                {
                    lblAmount.Font =
                        new System.Drawing.Font("Arial",
                                                21.75F, System.Drawing.FontStyle.Regular,
                                                System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                }
                else
                {
                    lblAmount.Font =
                        new System.Drawing.Font("Arial",
                                                27.75F, System.Drawing.FontStyle.Regular,
                                                System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                }
                lblAmount.Location  = new System.Drawing.Point(-9, 78);
                lblAmount.Name      = "label15";
                lblAmount.Size      = new System.Drawing.Size(68, 65);
                lblAmount.TabIndex  = 82;
                lblAmount.Text      = actualProduct.Amount.ToString();
                lblAmount.TextAlign =
                    System.Drawing.ContentAlignment.MiddleRight;
                //
                // btnImage
                //
                Button pbImage = new Button();
                pbImage.BackColor = System.Drawing.Color.White;
                pbImage.Location  = new System.Drawing.Point(-2, -2);
                pbImage.Name      = "pbImage " + i;
                pbImage.Size      = new System.Drawing.Size(100, 80);
                pbImage.TabIndex  = 79;
                pbImage.TabStop   = false;
                try
                {
                    pbImage.BackgroundImage = System.Drawing.Image.FromFile(
                        actualProduct.ActualProduct.ImagePath);
                }
                catch (Exception)
                {
                    pbImage.Text = actualProduct.ActualProduct.Description;
                }
                pbImage.BackgroundImageLayout = ImageLayout.Zoom;
                pbImage.Click +=
                    new System.EventHandler(btnTableProduct_Click);

                //
                //Panel container
                //
                Panel tableProduct = new Panel();
                tableProduct.BorderStyle = BorderStyle.Fixed3D;
                tableProduct.Controls.Add(btnAdd);
                tableProduct.Controls.Add(btnSubstract);
                tableProduct.Controls.Add(lblAmount);
                tableProduct.Controls.Add(pbImage);
                tableProduct.Location =
                    new System.Drawing.Point(0 + ((i - 1) * 90), 0);
                tableProduct.Name     = "pnl " + i;
                tableProduct.Size     = new System.Drawing.Size(90, 145);
                tableProduct.TabIndex = 85;

                pnlTableProducts.Controls.Add(tableProduct);
            }
        }