Esempio n. 1
0
        // Až po vytvoření datové struktury a inicializaci LINQ to SQL
        private static void FillDatabase()
        {
            // Sekce management

            Authentification.NewRole("manažer");
            Authentification.NewRole("skladník");
            Authentification.NewRole("pokladní");

            Authentification.NewUser("manažer", "manažer", "manažer");
            Authentification.NewUser("pokladní", "pokladní", "pokladní");
            Authentification.NewUser("skladník", "skladník", "skladník");

            // VAT (Value Added Tax) = DPH
            StorageSetup.AddVATs();

            // Sekce sklad
            StorageSetup.AddDemoProducts();

            //Company
            PASS.Management.CompanyInfo.InsertCompanyInfo("Večerka Na Rohu", "Hvězdova 1500", "Pankrác", 14000, "+420 732 251 420", "www.vecerkanarohu.cz");
            PASS.Management.BillInfo.InsertBillInfo("Děkujeme Vám za nákup. Veškeré dotazy zasílejte na adresu [email protected].");
        }
Esempio n. 2
0
        private void SetupStorage(AutoMocker mocker)
        {
            var setup = new StorageSetup(mocker);

            SetupStorage(setup);
        }
Esempio n. 3
0
 protected virtual void SetupStorage(StorageSetup setup)
 {
 }
Esempio n. 4
0
        /// <summary>
        /// Tlačítko pro potvrzení zvoleného výrobku a jeho množství.
        /// </summary>
        private void btnEnter_Click(object sender, RoutedEventArgs e)
        {
            if (ShoppingSession.CurrentProduct == null)
            {
                int code = 0;
                try
                {
                    code = Convert.ToInt32(tbProductCode.Text);
                }
                catch
                {
                    tbProductCode.Background = Brushes.LightPink;
                    return;
                }


                Product p = StorageSetup.GetProduct(code);
                ShoppingSession.CurrentProduct = p;

                if (p == null)
                {
                    tbProductCode.Background = Brushes.LightPink;
                    return;
                }
                else
                {
                    tbProductCode.ClearValue(TextBox.BackgroundProperty);

                    if (!ShoppingSession.CurrentProduct.priceForUnit)
                    {
                        tbProductCode.Text += " - " + StorageSetup.GetProductFullName(ShoppingSession.CurrentProduct);
                    }
                    else
                    {
                        tbProductCode.Text += " - " + ShoppingSession.CurrentProduct.name.Trim();
                    }
                }
            }


            if (!_quantityFill)
            {
                tbQuantity.IsEnabled    = true;
                tbProductCode.IsEnabled = false;
                tbQuantity.Focus();
                _quantityFill = true;

                if (ShoppingSession.CurrentProduct.priceForUnit)
                {
                    lblQuantity.Content = "Množství (" + StorageSetup.GetProductUnitName(ShoppingSession.CurrentProduct) + ")";
                }
                else
                {
                    lblQuantity.Content = "Množství";
                }
            }
            else
            {
                decimal quantity = 0;
                try
                {
                    // Při účtování za kus není možné zadat desetinné číslo
                    if (!ShoppingSession.CurrentProduct.priceForUnit && !HelperClass.IsInteger(tbQuantity.Text))
                    {
                        throw new NotImplementedException();
                    }


                    quantity = Convert.ToDecimal(tbQuantity.Text);

                    // Nenulovost a nezápornost množství
                    if (quantity <= 0)
                    {
                        throw new NotImplementedException();
                    }


                    tbQuantity.ClearValue(TextBox.BackgroundProperty);
                }
                catch
                {
                    tbQuantity.Background = Brushes.LightPink;
                    return;
                }



                decimal?price = quantity * ShoppingSession.CurrentProduct.price;
                ShoppingSession.Sum += price;

                string productDesc = null;
                if (ShoppingSession.CurrentProduct.priceForUnit)
                {
                    productDesc = ShoppingSession.CurrentProduct.name.Trim() + " " + quantity.ToString() + StorageSetup.GetProductUnitName(ShoppingSession.CurrentProduct) + " - " + ShoppingSession.CurrentProduct.price + " Kč/" + StorageSetup.GetProductUnitName(ShoppingSession.CurrentProduct) + " [Celkem: " + price.ToString() + " Kč]";
                }
                else
                {
                    productDesc = StorageSetup.GetProductFullName(ShoppingSession.CurrentProduct) + " - " + ShoppingSession.CurrentProduct.price + " Kč/Kus " + "(" + tbQuantity.Text + "x)" + " [Celkem: " + price.ToString() + " Kč]";
                }
                lbProducts.Items.Add(productDesc);

                ScrollToBottom(lbProducts);

                ShoppingSession.AddItemToShoppingCart(ShoppingSession.CurrentProduct, quantity, productDesc, lbProducts.Items.Count - 1, price, StorageSetup.GetProductUnitName(ShoppingSession.CurrentProduct));


                tbProductCode.Text             = "";
                tbQuantity.Text                = "";
                ShoppingSession.CurrentProduct = null;
                _quantityFill = false;

                tbQuantity.IsEnabled    = false;
                tbProductCode.IsEnabled = true;
                tbProductCode.Focus();
                tbPrice.Text        = ShoppingSession.SumString;
                lblQuantity.Content = "Množství";
            }



            SetStornoButton();
        }
Esempio n. 5
0
 protected override void SetupStorage(StorageSetup setup)
 {
     setup.WithInsert(_entity).WithGet(_allEntities);
 }