Esempio n. 1
0
        private void buttonBuy_Click(object sender, EventArgs e)
        {
            int rabate = 0;

            if (ValidateForm())
            {
                MessageBox.Show("uspjesno");
                //dodati u bazu pod.
                //poslati email
            }


            User = CheckUser(User);
            if (User.GetType == 0)
            {
                rabate = 0;
            }
            else if (User.GetType == 1)
            {
                rabate = 10;
            }
            else
            {
                rabate = 20;
            }

            Bill = sql.AddBill(Store, User, DateTime.Now, Car, rabate);
            if (radioButtonDelivery.Checked)
            {
                Order = sql.AddOrder(Bill, TypeOfDelivery.DELIVERY);
            }
            else
            {
                Order = sql.AddOrder(Bill, TypeOfDelivery.STORE);
            }

            textBoxFirstName.Text   = "";
            textBoxLastName.Text    = "";
            textBoxAddress.Text     = "";
            textBoxEmail.Text       = "";
            textBoxPhoneNumber.Text = "";

            //sendEmail(User, Car);


            sql.deleteCar(Car);
            this.Hide();

            if (logIn)
            {
                Form form = new EmployeeForm(this);
                form.Show();
            }
            else
            {
                Form form = new StartingForm();
                form.Show();
            }
        }