private async void setCustomerAndRestaurantFields() { customer = await db.GetCustomer(order.CustomerID); Restaurant restaurant = await db.GetRestaurant(order.RestaurantID); if (customer == null) { nameLabel.Text = order.CustomerID; } else { nameLabel.Text = customer.Name; } estimatedDeliveryButton.Value = restaurant.DeliveryTime; order.EstimatedDeliveryTime = restaurant.DeliveryTime; }
async private void customerLogin() { Customer passChecker = new Customer(); passChecker = await loginer.GetCustomer(lUsernameTextBox.Text); if (passChecker != null && passChecker.Password == lPasswordTextBox.Text) { //MessageBox.Show("Sikeres bejelentkezés!", "Infó"); this.Hide(); CustomerMain main = new CustomerMain(ref passChecker); main.Show(); // TODO: Átvitel fő felületre } else { restaurantLogin(); } }
async private void cRegistrationButton_Click(object sender, EventArgs e) { if (checkCustomerFields()) { Customer newCustomer = await db.GetCustomer(cUsername.Text); if (newCustomer == null) { newCustomer = new Customer(); newCustomer.CustomerID = cUsername.Text; newCustomer.Name = cName.Text; newCustomer.Password = cPassword.Text; newCustomer.PhoneNumber = cNumber.Text; Location newLocation = new Location(); newLocation.City = cCity.Text; newLocation.Street = cStreet.Text; newLocation.HouseNumber = Convert.ToInt32(cHouseNumber.Text); newCustomer.Address = newLocation; await db.AddCustomer(newCustomer); //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ó"); } }