예제 #1
0
        async private void button2_Click(object sender, EventArgs e)
        {
            if (checkRestaurantFields())
            {
                Restaurant newRestaurant = await db.GetRestaurant(rUsername.Text);

                if (newRestaurant == null)
                {
                    newRestaurant = new Restaurant();
                    newRestaurant.RestaurantID   = rUsername.Text;
                    newRestaurant.RestaurantName = rName.Text;
                    newRestaurant.Password       = rPassword.Text;
                    newRestaurant.OpenTime       = rOpening.Text;
                    newRestaurant.CloseTime      = rClosing.Text;
                    newRestaurant.DeliveryTime   = Convert.ToInt32(rDeliveryTime.Text);

                    Location newLocation = new Location();
                    newLocation.City        = rCity.Text;
                    newLocation.Street      = rStreet.Text;
                    newLocation.HouseNumber = Convert.ToInt32(rHouseNumber.Text);

                    newRestaurant.Address = newLocation;

                    await db.AddRestaurant(newRestaurant);

                    //MessageBox.Show("Sikeres regisztráció!", "Infó");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("A felhasználónév foglalt!", "Infó");
                }
            }
            else
            {
                MessageBox.Show("Kérem tölsön ki minden mezőt!", "Infó");
            }
        }
예제 #2
0
        private async void DiscountButton_Click(object sender, EventArgs e)
        {
            int discount = 0;

            if (listView1.SelectedItems.Count != 0)
            {
                string foodName = listView1.SelectedItems[0].SubItems[0].Text;
                ShowInputDialog(ref discount);
                for (int i = 0; i < linRestaurant.Foods.Count; ++i)
                {
                    if (linRestaurant.Foods[i].Name.Equals(foodName))
                    {
                        linRestaurant.Foods[i].Discount = discount;
                        await db.AddRestaurant(linRestaurant);

                        return;
                    }
                }
            }
            else
            {
                MessageBox.Show("Kérlek válassz ki egy ételt a leárazáshoz!", "Információ");
            }
        }