private void buttonAddData_Click(object sender, EventArgs e)
        {
            int[] arrayOfRoomsPrice = new int[3] {
                300000, 500000, 1000000
            };
            double totalPrice = arrayOfRoomsPrice[comboBoxRoomType.SelectedIndex] * int.Parse(textBoxLengthStay.Text);

            listBoxDetailAddData.Items.Add($"Mr./Mrs.: {textBoxName.Text}");
            listBoxDetailAddData.Items.Add("Thank you for choosing Luxury Hotel as your place to stay");
            listBoxDetailAddData.Items.Add($"You chose {comboBoxRoomType.SelectedItem} room to stay for {textBoxLengthStay.Text} days");
            listBoxDetailAddData.Items.Add($"Price per night is Rp. {arrayOfRoomsPrice[comboBoxRoomType.SelectedIndex]}");
            listBoxDetailAddData.Items.Add($"Total Price Rp. {totalPrice}");

            if (radioButtonMemberTrue.Checked)
            {
                listBoxDetailAddData.Items.Add($"Discount 10%: Rp. {0.1 * totalPrice}");
                totalPrice -= (0.1 * totalPrice);
            }
            else
            {
                listBoxDetailAddData.Items.Add($"Discount : Rp.0");
            }
            listBoxDetailAddData.Items.Add($"Total price must be paid: Rp. {totalPrice}");
            listBoxDetailAddData.Items.Add("");
            finalTransaction = $"Mr./Mrs.: {textBoxName.Text}.........................Rp.{totalPrice}";
            finalPrice       = (int)totalPrice;

            FormMainMenu formMainMenu = (FormMainMenu)this.Owner;

            formMainMenu.listOfHistorySaleData.Add(finalTransaction);
            formMainMenu.listOfHistoryPriceSaleData.Add(finalPrice);
            formMainMenu.ShowData();
            cleanField();
            MessageBox.Show("Data successfully added");
        }
Beispiel #2
0
        private void FormShowAllData_Load(object sender, EventArgs e)
        {
            FormMainMenu formMainMenu = (FormMainMenu)this.Owner;

            for (int i = 0; i < formMainMenu.listOfHistorySaleData.Count; i++)
            {
                listBoxShowAllData.Items.Add(formMainMenu.listOfHistorySaleData[i]);
            }
        }