Beispiel #1
0
 //Creating new product
 public CreateProduct(StorageController storageController)
 {
     Initialize(storageController);
     output_ProductID.Text                = Product.GetNextID().ToString();
     output_ServiceProductID.Text         = ServiceProduct.GetNextID().ToString();
     btn_disableProduct.Visibility        = Visibility.Hidden;
     btn_disableServiceProduct.Visibility = Visibility.Hidden;
     this.Title = "Opret Produkt";
 }
Beispiel #2
0
 private void AddServiceProduct()
 {
     _storageController.CreateServiceProduct(ServiceProduct.GetNextID(),
                                             Decimal.Parse(textbox_ServiceSalePrice.Text),
                                             Decimal.Parse(textbox_ServiceGroupPrice.Text),
                                             Int32.Parse(textbox_ServiceGroupLimit.Text),
                                             textbox_ServiceName.Text,
                                             _storageController.GroupDictionary.First(X => X.Value.Name == comboBox_ServiceGroup.Text).Key);
 }
Beispiel #3
0
        public void GetServiceProductNextIDTest()
        {
            int     old_id   = ServiceProduct.GetNextID();
            Product TestProd = new Product(11);

            TestProd.UploadToDatabase();
            int new_id = ServiceProduct.GetNextID();

            Assert.IsTrue(new_id > old_id);
        }
Beispiel #4
0
        public void CreateServiceProductTest1()
        {
            int            old_id   = ServiceProduct.GetNextID();
            ServiceProduct TestProd = new ServiceProduct(0, 20m, 20m, 20, "TestServiceProd", 1);

            TestProd.UploadToDatabase();
            int new_id = ServiceProduct.GetNextID();

            Assert.IsTrue(new_id > old_id);
        }
Beispiel #5
0
        /// <summary>
        /// Creates Icecream as a serviceproduct, then uploads it to the database, if not already in the system.
        /// </summary>
        /// <returns></returns>
        public void MakeSureIcecreamExists()
        {
            int IcecreamProductID;

            if (!ServiceProductDictionary.Values.Any(x => x.Name == "Is"))
            {
                IcecreamProductID = ServiceProduct.GetNextID();
                var IcecreamProduct = new ServiceProduct(IcecreamProductID, 0, 0, 1000, "Is", Properties.Settings.Default.IcecreamID);
                ServiceProductDictionary.TryAdd(IcecreamProductID, IcecreamProduct);
                AllProductsDictionary.TryAdd(IcecreamProductID, IcecreamProduct);
                IcecreamProduct.UploadToDatabase();
            }
            else
            {
                IcecreamProductID = ServiceProductDictionary.Values.Where(x => x.Name == "Is").First().ID;
            }

            Properties.Settings.Default.IcecreamProductID = IcecreamProductID;
            Properties.Settings.Default.Save();
        }