Exemplo n.º 1
0
 public AdminView(ItemDisc i, Panel p, Admin f)
 {
     item                  = i;
     ParentPanel           = p;
     ParentForm            = f;
     pic.Size              = new Size(100, 100);
     pic.Location          = new Point(0, 27 + offset);
     pic.Image             = i.GetImage();
     name.Text             = i.name;
     name.Location         = new Point(103, 27 + offset);
     Price.Text            = i.price.ToString() + "$";
     Price.Location        = new Point(195, 27 + offset);
     Quantity.Text         = i.Quantity.ToString();
     Quantity.Location     = new Point(278, 27 + offset);
     Type.Text             = i.Type;
     Type.Location         = new Point(367, 27 + offset);
     RemoveButton.Text     = "Edit";
     RemoveButton.Location = new Point(469, 22 + offset);
     RemoveButton.Click   += RemoveButton_Click;
     offset               += 107;
     ParentPanel.Controls.Add(RemoveButton);
     ParentPanel.Controls.Add(Type);
     ParentPanel.Controls.Add(Quantity);
     ParentPanel.Controls.Add(Price);
     ParentPanel.Controls.Add(name);
     ParentPanel.Controls.Add(pic);
 }
Exemplo n.º 2
0
        public void show_Product(ItemDisc item) //showing product panel
        {
            if (LastPanel == Product_Panel)
            {
                return;
            }
            Product_Panel.Visible = true;
            LastPanel.Visible     = false;
            LastPanel             = Product_Panel;

            Product_Name.Text   = item.name;
            Product_Price.Text  = item.price.ToString();
            Product_Image.Image = item.GetImage();
            ActiveItem          = item;
        }
    public ItemView(ItemDisc i, Panel p, Panel p2, Form2 f)
    {
        IsCancelButton = IsOrder;
        form           = f;
        if (i.Quantity > 0)
        {
            if ((itemNum % 4 == 0 && itemNum != 0))
            {
                x_offset  = 0;   // item will be first in the new row
                y_offset += 180; //vertical distance between each row
            }
            Item          = i;
            ParentPanel   = p;
            productsPanel = p2;

            //Product picture proprties
            if (!IsOrder)
            {
                pic.BackgroundImage = i.GetImage();
                pic.Location        = new Point(38 + x_offset, 70 + y_offset);
                pic.Size            = new Size(100, 100);
            }

            //product name label proprties
            if (IsOrder)
            {
                name.Location = new Point(38, 58 + y_offset);
            }
            else
            {
                name.Location = new Point(38 + x_offset, 158 + y_offset);
            }
            name.Text      = i.name;
            name.Font      = new Font("Britannic Bold", 12);
            name.ForeColor = Color.RoyalBlue;
            name.BackColor = Color.Transparent;
            //product price label proprties
            if (IsOrder)
            {
                price.Location = new Point(150, 58 + y_offset);
                price.Text     = i.Quantity.ToString() + " Items each cost " + i.price.ToString() + "$";
                price.Size     = new Size(200, 20);
            }
            else
            {
                price.Location = new Point(38 + x_offset, 180 + y_offset);
                price.Text     = i.price.ToString() + "$";
            }
            price.ForeColor = Color.Green;

            //product buy button proprties
            if (IsOrder)
            {
                buybutton.Location = new Point(350, 58 + y_offset);
                buybutton.Text     = "Cancel";
            }
            else
            {
                buybutton.Location = new Point(38 + x_offset, 200 + y_offset);
                buybutton.Text     = "Buy";
            }
            buybutton.MouseEnter += button_MouseEnter;
            buybutton.MouseLeave += button_MouseLeave;
            buybutton.Click      += BuyClick;
            if (IsOrder)
            {
                State.Location = new Point(450, 58 + y_offset);
                State.Font     = new Font("Britannic Bold", 12);
                if (Item.state == DeliveryState.Pending)
                {
                    State.Text = "Pending"; State.ForeColor = Color.Red;
                }
                if (Item.state == DeliveryState.InProgress)
                {
                    State.Text = "InProgress"; State.ForeColor = Color.Orange;
                }
                if (Item.state == DeliveryState.Delieverd)
                {
                    State.Text = "Delieverd"; State.ForeColor = Color.Green; buybutton.Text = "Delete";
                }
            }

            x_offset += 200;//horizontal distance between products

            //adding products to home panel
            if (IsOrder)
            {
                p.Controls.Add(State);
            }
            p.Controls.Add(buybutton);
            p.Controls.Add(name);
            p.Controls.Add(price);
            if (!IsOrder)
            {
                p.Controls.Add(pic);
                itemNum++;
            }
            else
            {
                y_offset += 27;
            }
        }
    }