Beispiel #1
0
        private void pbCharger_Click(object sender, EventArgs e)
        {
            List <string> temp = new List <string>();

            lb_Receipt_info.Items.Add("Charger - " + dataHelper.GetPrdouctPrice("Charger") + "€");
            foreach (string item in lb_Receipt_info.Items)
            {
                temp.Add(item);
            }
            temp.Sort();
            lb_Receipt_info.Items.Clear();
            foreach (string item in temp)
            {
                lb_Receipt_info.Items.Add(item);
            }

            total_Price += dataHelper.GetPrdouctPrice("Charger");
            lbPrice.Text = total_Price.ToString() + "€";
            charger_quantity--;
            lbchargrQuan.Text = charger_quantity + "LEFT";
        }
Beispiel #2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            pbBicycle.Show();
            pbCap.Show();
            pbCharger.Show();
            pbCamera.Show();

            dataHelper = new Mysql();

            lbCameraPrice.Text  = dataHelper.GetPrdouctPrice("Camera").ToString() + "€";
            lbBicyclePrice.Text = dataHelper.GetPrdouctPrice("Bicycle").ToString() + "€";
            lbChargerPrice.Text = dataHelper.GetPrdouctPrice("Charger").ToString() + "€";
            lbGogglesPrice.Text = dataHelper.GetPrdouctPrice("Googgles").ToString() + "€";

            lbCameraPrice.Show();
            lbBicyclePrice.Show();
            lbChargerPrice.Show();
            lbGogglesPrice.Show();

            bicycle_quantity = dataHelper.GetStockQuantityOfBicycle();
            camera_quantity  = dataHelper.GetStockQuantityOfCamera();
            googles_quantiy  = dataHelper.GetStockQuantityOfGooggles();
            charger_quantity = dataHelper.GetStockQuantityOfCharger();


            if (bicycle_quantity < 1)
            {
                lbBicycleQuantity.Text = " Currently out of the stock";
                bicycle_quantity       = 0;
            }
            else
            {
                lbchargrQuan.Text = bicycle_quantity + "LEFT";
            }

            if (camera_quantity < 1)
            {
                lbCameraQuantity.Text = " Currently out od the stock";
                camera_quantity       = 0;
            }
            else
            {
                lbCameraQuantity.Text = camera_quantity + " LEFT";
            }

            if (googles_quantiy < 1)
            {
                lbGogglesQuantity.Text = " Currently out of the stock";
                googles_quantiy        = 0;
            }
            else
            {
                lbGogglesQuantity.Text = googles_quantiy + " LEFT";
            }

            if (charger_quantity < 1)
            {
                lbchargrQuan.Text = " Currently out of the stock";
                charger_quantity  = 0;
            }
            else
            {
                lbBicycleQuantity.Text = charger_quantity + " LEFT";
            }
            timer.Stop();
        }
Beispiel #3
0
 private void btnRemove_Click(object sender, EventArgs e)
 {
     try
     {
         dataHelper = new Mysql();
         if (lb_Receipt_info.SelectedItem.ToString() == "Bicycle - 20€")
         {
             lb_Receipt_info.Items.Remove(lb_Receipt_info.SelectedItem);
             if (bicycle_quantity < 0)
             {
                 bicycle_quantity = 1;
             }
             else
             {
                 bicycle_quantity++;
             }
             lbBicycleQuantity.Text = bicycle_quantity + "LEFT";
             total_Price           -= dataHelper.GetPrdouctPrice("Bicycle");
             lbPrice.Text           = total_Price.ToString() + "€";
         }
         else if (lb_Receipt_info.SelectedItem.ToString() == "Googgles - 10€")
         {
             lb_Receipt_info.Items.Remove(lb_Receipt_info.SelectedItem);
             if (googles_quantiy < 0)
             {
                 googles_quantiy = 1;
             }
             else
             {
                 googles_quantiy++;
             }
             lbGogglesQuantity.Text = googles_quantiy + "LEFT";
             total_Price           -= dataHelper.GetPrdouctPrice("Googgles");
             lbPrice.Text           = total_Price.ToString() + "€";
         }
         else if (lb_Receipt_info.SelectedItem.ToString() == "Camera - 20€")
         {
             lb_Receipt_info.Items.Remove(lb_Receipt_info.SelectedItem);
             if (camera_quantity < 0)
             {
                 camera_quantity = 1;
             }
             else
             {
                 camera_quantity++;
             }
             lbCameraQuantity.Text = camera_quantity + "LEFT";
             total_Price          -= dataHelper.GetPrdouctPrice("Camera");
             lbPrice.Text          = total_Price.ToString() + "€";
         }
         else if (lb_Receipt_info.SelectedItem.ToString() == "Charger - 5€")
         {
             lb_Receipt_info.Items.Remove(lb_Receipt_info.SelectedItem);
             if (charger_quantity < 0)
             {
                 charger_quantity = 1;
             }
             else
             {
                 charger_quantity++;
             }
             lbchargrQuan.Text = charger_quantity + "LEFT";
             total_Price      -= dataHelper.GetPrdouctPrice("Charger");
             lbPrice.Text      = total_Price.ToString() + "€";
         }
     }
     catch (NullReferenceException)
     {
         lbLoan_Status.Text      = "Please first select the item you want to remove !";
         lbLoan_Status.ForeColor = Color.Red;
     }
 }