示例#1
0
        private void CheckOut_Click(object sender, RoutedEventArgs e)
        {
            Cash             = Cash - SUM;
            CashDisplay.Text = Cash + " €";

            //Receipt

            decimal VAT = (SUM / 100m) * 20m;

            Receipt.Text = " Total Sum : " + SUM + " €" +
                           "\n VAT : " + VAT + " €" + " //  20 % " +
                           "\n" +
                           "\n" +
                           "\n" +
                           "\n" +
                           "\n" +
                           "\n ------------------------------" +
                           "\n Thank you for your purchase";

            //

            SUM = 0;
            ShoppingCart.Clear();
            ShoppingCartListBox.Items.Refresh();
            TotalSum.Clear();
        }
 private void BtnClick(object sender, RoutedEventArgs e)
 {
     if (Convert.ToString((sender as Button).Content) != "Rensa")
     {
         if (!int.TryParse(InputOne.Text, out int i) || !int.TryParse(InputTwo.Text, out int k))
         {
             MessageBox.Show("Använd bara siffror tack.");
             InputOne.Clear();
             InputTwo.Clear();
             TotalSum.Clear();
         }
         else
         {
             string a, b;
             int    c;
             a             = InputOne.Text;
             b             = InputTwo.Text;
             c             = Convert.ToInt32(a) + Convert.ToInt32(b);
             TotalSum.Text = Convert.ToString(c);
         }
     }
     else
     {
         InputOne.Clear();
         InputTwo.Clear();
         TotalSum.Clear();
     }
 }
        public IActionResult Calculate(int totalPrice, int totalDiscount)
        {
            List <ArticleDetails> user = new List <ArticleDetails>(shoppingCart);

            shoppingCart.Clear();
            TotalSum sum = new TotalSum();

            sum.TotalProduct  = user;
            sum.GrandTotal    = totalPrice;
            sum.TotalDiscount = totalDiscount;
            return(View(sum));
        }
示例#4
0
        private void DecodeSpy_Click(object sender, EventArgs e)
        {
            string log;
            int    TotalSum;

            ChangeBox.Text = rsaMethod.Decode(ChangeBox.Text, KeyBox1.Text, KeyBox2.Text, out log, out TotalSum);
            TSBox2.Text    = TotalSum.ToString();

            LogForm form = new LogForm(log);

            form.Show();
        }
示例#5
0
        private void button1_Click(object sender, EventArgs e)
        {
            string key1, key2, log;
            int    TotalSum;

            ChangeBox.Text = rsaMethod.Encode(InputBox.Text, out key1, out key2, out log, out TotalSum);
            KeyBox1.Text   = key1;
            KeyBox2.Text   = key2;
            TSBox1.Text    = TotalSum.ToString();

            LogForm form = new LogForm(log);

            form.Show();
        }
示例#6
0
 //REMOVE A PRODUCT FROM THE CART
 private void RemoveFromCart_Click(object sender, RoutedEventArgs e)
 {
     SUM = 0;
     ShoppingCart.Remove((Product)ShoppingCartListBox.SelectedItem);
     foreach (Product item in ShoppingCart)
     {
         var ItemSum = Int32.Parse(item.Price);
         SUM           = SUM + ItemSum;
         TotalSum.Text = SUM.ToString() + " €";
     }
     if (SUM <= 0)
     {
         TotalSum.Clear();
     }
     ShoppingCartListBox.Items.Refresh();
 }
示例#7
0
        private void CheckButton_Click(object sender, EventArgs e)
        {
            string log;
            int    TotalSum;

            OutputBox.Text = rsaMethod.Decode(OutputBox.Text, KeyBox1.Text, KeyBox2.Text, out log, out TotalSum);
            TSBox2.Text    = TotalSum.ToString();

            LogForm form = new LogForm(log);

            form.Show();

            if (TSBox1.Text == TSBox2.Text)
            {
                MessageBox.Show("Сообщение не изменилось");
            }
            else
            {
                MessageBox.Show("Сообщение изменилось");
            }
        }
        private void SorokFeldolgozasa()
        {
            Sorhiba = false;
            t       = sor.Split(';');
            if (t[0].ToString() == string.Empty)
            {
                MessageBox.Show("Adóazonosító jel hiányzik! (" + rownum + ". sor)"); bFeldolg.Enabled = false; return;
            }

            Tag ujtag = new Tag();

            ujtag.adoazon    = t[0].ToString();
            ujtag.tag_pnr_id = TagEll(ujtag.adoazon);
            if (ujtag.tag_pnr_id == 0)
            {
                // visszagörgetés
                if (TranID != 0)
                {
                    TransactionRollback();
                }
                // alaphelyzet
                openFileDialog1.FileName = string.Empty;
                bFeldolg.Enabled         = false;
                // leáll
                return;
            }

            try
            {
                ujtag.sajat      = int.Parse(t[1].ToString());
                SajatSum        += ujtag.sajat;
                txSajatSumC.Text = SajatSum.ToString();

                ujtag.mh        = int.Parse(t[2].ToString());
                MunkSum        += ujtag.mh;
                txMunkSumC.Text = MunkSum.ToString();

                ujtag.egyszeri      = int.Parse(t[3].ToString());
                EgyszeriSum        += ujtag.egyszeri;
                TxEgyszeriSumC.Text = EgyszeriSum.ToString();

                ujtag.rendszeres  = int.Parse(t[4].ToString());
                RendszSum        += ujtag.rendszeres;
                txRendszSumC.Text = RendszSum.ToString();
            }
            catch
            {
                MessageBox.Show("Hibás összeg: " + rownum + ". sor!");
                // visszagörgetés
                if (TranID != 0)
                {
                    TransactionRollback();
                }
                // alaphelyzet
                openFileDialog1.FileName = string.Empty;
                bFeldolg.Enabled         = false;
                // leáll
                return;
            }

            TotalSum      = SajatSum + MunkSum + EgyszeriSum + RendszSum;
            TxTotalC.Text = TotalSum.ToString();

            tagok.Add(ujtag);
            txTagokSumC.Text = tagok.Count.ToString();

            // db insert
            int forgid = InsertSor(ujtag);

            if (forgid == 0)
            {
                MessageBox.Show("Sor rögzítése sikertelen: " + rownum + ". sor!");
                // visszagörgetés
                if (TranID != 0)
                {
                    TransactionRollback();
                }
                // alaphelyzet
                openFileDialog1.FileName = string.Empty;
                bFeldolg.Enabled         = false;
                // leáll
                return;
            }

            RowVerification(ujtag, forgid);

            // szerződési feltételek ellenőrzése
            //munkáltatói hj
            if (ujtag.mh > 0)
            {
                mhEll(ujtag, forgid);
                //
            }
            // támogatás
            if (ujtag.rendszeres > 0)
            {
                mhEll(ujtag, forgid);
                //
            }
            if (Sorhiba)
            {
                ujtag.ervenyes = "N";
                UpdateSor(ujtag, forgid);
            }
        }
示例#9
0
        private void SubscribeToChanges(ProductInOrder newProductInOrder)
        {
            int previousSelectedQuantity = 0;

            newProductInOrder.WhenAnyValue(x => x.SelectedDiscount, x => x.SelectedQuantity)
            .Subscribe(a =>
            {
                float newSelectedDiscount = a.Item1;
                int newSelectedQuantity   = a.Item2;

                //Value(price) that will be added(or removed) to(from) TotalPrice
                decimal newValue = (decimal)newProductInOrder.UnitPrice * (newSelectedQuantity - previousSelectedQuantity);

                //-1% or +1% discount
                decimal percentageOff = (decimal)(newSelectedDiscount - newProductInOrder.PreviousSelectedDiscount) / 100;

                //Executing when the SelectedDiscount has changed
                if (percentageOff != 0)
                {
                    newProductInOrder.Sum -= newProductInOrder.SelectedQuantity * (decimal)newProductInOrder.UnitPrice * percentageOff;
                    TotalSum -= newProductInOrder.SelectedQuantity * (decimal)newProductInOrder.UnitPrice * percentageOff;
                }
                //Executing when the SelectedQuantity has changed and the SelectedDiscount is greater than zero.
                else if (newSelectedDiscount != 0)
                {
                    decimal sumOff   = ((decimal)newProductInOrder.PreviousSelectedDiscount / 100) * newProductInOrder.SelectedQuantity * (decimal)newProductInOrder.UnitPrice;
                    decimal sumToAdd = sumOff - newProductInOrder.Sum;

                    newProductInOrder.Sum = sumOff;
                    TotalSum += sumToAdd;

                    TotalSumString = TotalSum.ToString("C2");

                    return;
                }

                newProductInOrder.PreviousSelectedDiscount = newSelectedDiscount;

                newProductInOrder.Sum += newValue;
                TotalSum += newValue;

                TotalSumString = TotalSum.ToString("C2");
            });

            newProductInOrder.WhenAnyValue(x => x.SelectedQuantity)
            .Select(newSelectedQuantity =>
            {
                if (newSelectedQuantity == 0)
                {
                    return(0);
                }
                int deltaQuantity = newSelectedQuantity - previousSelectedQuantity;     //Quantity of products that will be added or removed(in case of negative value) from the stock of the current product

                previousSelectedQuantity = newSelectedQuantity;

                return(deltaQuantity);
            })
            .Subscribe(newValue =>
            {
                newProductInOrder.SourceProductOnStore.UnitsInStock -= (short)newValue;

                Product productToReplace = productsList.First(x => x.ProductID == newProductInOrder.ProductID);

                productToReplace.UnitsInStock -= (short)newValue;
            });
        }