Beispiel #1
0
 private void LoadBookOptions()
 {
     if (bookOptions == null)
     {
         bookOptions = new BookOptions(BookOptionsType.Global);
     }
 }
Beispiel #2
0
        private void Confirm_Click(object sender, EventArgs e)
        {
            if ((Author.Text == null))
            {
                MessageBox.Show("Please select the book before confirm order", "Warning");
                BookOptions.Focus();
            }
            else if (!(this.Quantity > 0))
            {
                MessageBox.Show("Please, add title");
                AddTitle.Focus();
            }
            else
            {
                services service  = new services();
                string[] OrderRow = new string[3];
                OrderRow[0] = BookId.ToString();
                OrderRow[1] = this.Quantity.ToString();
                OrderRow[2] = lineTotal.ToString();
                service.InsertOrderDetails(OrderRow);

                string[] row = new string[6];
                row[0] = CustomerId.ToString();
                row[1] = subtotal.ToString();
                row[2] = tax.ToString();
                row[3] = total.ToString();
                service.InsertOrders(row);
            }
        }
Beispiel #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (BookOptions.SelectedItem == null)
            {
                MessageBox.Show("Please select the book before add it in the cart", "Warning");
                BookOptions.Focus();
            }
            else if (int.TryParse(quantity.Text, out int n) == false)
            {
                MessageBox.Show("Quantity should be numeric", "Warning");
                quantity.Focus();
            }
            else if (quantity.Text == null)
            {
                MessageBox.Show("Please, write quantity");
                quantity.Focus();
            }
            else if (int.TryParse(quantity.Text, out int m) && m <= 0)
            {
                MessageBox.Show("Quantity should be more than zero", "Warning");
                quantity.Focus();
            }
            else
            {
                int.TryParse(quantity.Text, out int k);
                this.Quantity = k;
                int.TryParse(Price.Text, out int p);
                this.price = p;
                lineTotal  = this.Quantity * this.price;

                string[] row = new string[] { BookOptions.SelectedItem.ToString(), Price.ToString(), this.Quantity.ToString(), lineTotal.ToString() };
                ChoosenBooks.Rows.Add(row);
                this.subtotal += lineTotal;
                this.tax      += 0.1 * lineTotal;
                this.total     = this.subtotal + this.tax;
                Subtotal.Text  = this.subtotal.ToString();
                Tax.Text       = this.tax.ToString();
                Total.Text     = this.total.ToString();
            }
        }
Beispiel #4
0
 public BookOptionsPopup(BookOptions bookOptions, Game game)
 {
     this.Game = game;
     InitializeComponent();
     this.bookOptions = bookOptions;
 }