Example #1
0
 public OrderView(ItemDisc i, Panel p)
 {
     item              = i;
     ParentPanel       = p;
     OrderID.Text      = i.ID.ToString();
     OrderID.Location  = new Point(58, 45 + offset);
     Name.Text         = i.name;
     Name.Location     = new Point(165, 45 + offset);
     Quantity.Text     = i.Quantity.ToString();
     Quantity.Location = new Point(258, 45 + offset);
     if (i.state == DeliveryState.Pending)
     {
         OrderState.Text = "Pending";
     }
     else if (i.state == DeliveryState.InProgress)
     {
         OrderState.Text = "In-Progress";
     }
     else
     {
         OrderState.Text = "Delieverd";
     }
     OrderState.Location = new Point(364, 45 + offset);
     Promote.Text        = "Promote";
     Promote.Location    = new Point(437, 40 + offset);
     Promote.Click      += Promote_Click;
     ParentPanel.Controls.Add(Promote);
     ParentPanel.Controls.Add(OrderState);
     ParentPanel.Controls.Add(Quantity);
     ParentPanel.Controls.Add(Name);
     ParentPanel.Controls.Add(OrderID);
     offset += 27;
 }
Example #2
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);
 }
Example #3
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)
 {
     Item               = i;
     ParentPanel        = p;
     buybutton.Location = new Point(593, 114 + offset);
     buybutton.Text     = "Buy";
     buybutton.Click   += BuyClick;
     price.Location     = new Point(385, 114 + offset);
     price.Text         = i.price.ToString() + "$";
     name.Location      = new Point(203, 114 + offset);
     name.Text          = i.name;
     offset            += 37;
     p.Controls.Add(buybutton);
     p.Controls.Add(name);
     p.Controls.Add(price);
 }
Example #5
0
 public AdminItemView(ItemDisc i, Panel p)
 {
     item              = i;
     ParentPanel       = p;
     Name.Text         = i.name;
     Name.Location     = new Point(29, 15 + offset);
     Price.Text        = i.price.ToString() + "$";
     Price.Location    = new Point(166, 15 + offset);
     Quantity.Text     = i.Quantity.ToString();
     Quantity.Location = new Point(92, 15 + offset);
     offset           += 28;
     p.Controls.Add(Name);
     p.Controls.Add(Price);
     p.Controls.Add(Quantity);
     p.Controls.Add(EditButton);
     p.Controls.Add(RemoveButton);
 }
Example #6
0
        private void button3_Click(object sender, EventArgs e)
        {
            ItemDisc Item = new ItemDisc();

            Item.name     = Name_txt.Text;
            Item.price    = float.Parse(Price_txt.Text);
            Item.Quantity = int.Parse(Quantity_txt.Text);
            Item.Type     = Category_txt.Text;
            Item.image    = File.ReadAllBytes(label4.Text);
            Transmitter.InsertIntoTable(Item);
            Name_txt.Text     = null;
            Price_txt.Text    = null;
            Quantity_txt.Text = null;
            Category_txt.Text = null;
            time.Start();
            EndingLabel.Visible = true;
            label4.Text         = "No Path";
        }
    public void Buy(ItemDisc ordered)
    {
        bool found = false;

        for (int i = 0; i < Items.Count; i++)
        {
            if (Items[i].name == ordered.name)
            {
                ItemDisc C = Items[i];
                C.Quantity += ordered.Quantity;
                Items.RemoveAt(i);
                Items.Add(C);
                found = true;
                break;
            }
        }
        if (!found)
        {
            Items.Add(ordered);
        }
    }
 public bool Remove(ItemDisc ordered)
 {
     for (int i = 0; i < Items.Count; i++)
     {
         if (Items[i].name == ordered.name)
         {
             if (Items[i].Quantity >= ordered.Quantity)
             {
                 ItemDisc C = Items[i];
                 C.Quantity -= ordered.Quantity;
                 Items.RemoveAt(i);
                 if (C.Quantity != 0)
                 {
                     Items.Add(C);
                 }
                 return(true);
             }
             break;
         }
     }
     return(false);
 }
    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;
            }
        }
    }
 public ItemPopUp(ItemDisc i, Admin p)
 {
     item       = i;
     ParentForm = p;
     InitializeComponent();
 }