Exemple #1
0
        private void bt_delete_Click(object sender, RoutedEventArgs e)
        {
            BikeBasket b = ((BikeBasket)((System.Windows.Controls.Button)e.Source).DataContext);

            Controler.Instance.tempSale.removeBikeBasket(b);

            tot = 0;
            displayDetails();
        }
Exemple #2
0
        private void DisplayCatalogue()
        {
            List <BikeBasket> BikeCatList = new List <BikeBasket>();
            List <CatalogBike.displayInfo> catalogBikesDisplayInfoList = Controler.Instance.getCatalogBikeDisplayInfo();

            foreach (CatalogBike.displayInfo temp in catalogBikesDisplayInfoList)
            {
                List <string> sizeList;
                List <string> colorList;

                (sizeList, colorList) = temp.CurCatBike.getProperties();

                BikeBasket bb = new BikeBasket(temp.name, sizeList, colorList, temp.CurCatBike);
                bb.pic = temp.pic;
                BikeCatList.Add(bb);
            }

            CatalogListView.ItemsSource = BikeCatList;
        }
Exemple #3
0
        private void Add_Bike_Click(object sender, RoutedEventArgs e)
        {
            BikeBasket b = ((BikeBasket)((System.Windows.Controls.Button)e.Source).DataContext);

            if (b.qnt == 1)
            {
                tools.UI.MessageBox.Show("Bike added to basket", "Bike Added");
                Controler.Instance.tempSale.setBikeBasket(b);
            }
            else if (b.qnt == 0)
            {
                tools.UI.MessageBox.Show("Bike quantity is 0", "Error");
            }
            else
            {
                tools.UI.MessageBox.Show("Bikes added to basket", "Bikes Added");
                Controler.Instance.tempSale.setBikeBasket(b);
            }
        }
        private void BT_Add_Click(object sender, RoutedEventArgs e)
        {
            int qnt = Convert.ToInt32(BikeQuantity.Text);

            string      b_name  = ((CatalogBike.displayInfo)BikeCatalog.SelectedItem).name;
            string      b_color = BikeColor.SelectedItem.ToString();
            string      b_size  = BikeSize.SelectedItem.ToString();
            CatalogBike cb      = ((CatalogBike.displayInfo)BikeCatalog.SelectedItem).CurCatBike;

            BikeBasket bb = new BikeBasket(b_name, b_color, b_size, cb, qnt);

            BikeTemplate bt = bb.CreateBikeTemplate();

            if (bt.getId() == -1)
            {
                int id_bt = Controler.Instance.getLastBikeTemplateId() + 1;
                bt.setId(id_bt);
                Controler.Instance.createBikeTemplate(bt);
            }


            for (int i = 0; i < bb.qnt; i++)
            {
                int bikeID = Controler.Instance.getLastBikeId() + 1;

                DateTime constr_date  = TempSale.getConstrDate();
                DateTime planned_date = TempSale.getNextPrevisionDate();

                int poste = Controler.Instance.getAvailablePoste();

                Bike tempB = new Bike(bikeID, 0, -1, poste, bt, planned_date, constr_date);

                Controler.Instance.createBike(tempB);
            }

            this.Close();
        }