private async void btnOrder_Click(object sender, EventArgs e) { if (LoginForm.RoomId != 1) { if (cbTowels.Text != "" || cbCleening.Checked != false) { using (var db = new HotelWinFormsDbContext()) { ServRoomOrder servRoom = new ServRoomOrder(); servRoom.Cleening = cbCleening.Checked; servRoom.Towels = cbTowels.Text; servRoom.RoomId = LoginForm.RoomId; this.Close(); MainForm form = new MainForm(LoginForm.LoginedRole); form.openChildForm(new ResultTrue()); db.ServiceRoom.Add(servRoom); await db.SaveChangesAsync(); } } else { MessageBox.Show("Choose something", "Order cannot be null", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("You loginned as guest"); } }
private async void btnOrder_Click(object sender, EventArgs e) { if (LoginForm.RoomId != 0) { if (cbBurger.Text != "" || cbCake.Text != "" || cbPizza.Text != "") { using (var db = new HotelWinFormsDbContext()) { ServFoodOrder servFood = new ServFoodOrder(); servFood.Burger = cbBurger.Text; servFood.Cake = cbCake.Text; servFood.Pizza = cbPizza.Text; servFood.RoomId = LoginForm.RoomId; MainForm form = new MainForm(LoginForm.LoginedRole); form.openChildForm(new ResultTrue()); db.ServiceFood.Add(servFood); await db.SaveChangesAsync(); } } else { MessageBox.Show("Choose something", "Order cannot be null", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("You loginned as guest"); } }