private void Save_Click(object sender, RoutedEventArgs e) { if (comboBoxHotelName.SelectedIndex == -1) { MessageBox.Show("يجب اختيار فندق"); return; } VistsData vistsData = new VistsData(); Hotel ht = hotelsList[comboBoxHotelName.SelectedIndex]; int.TryParse(textBoxPrice.Text, out int price); Vist vist = new Vist() { Name = ht.Name, Hotel_Id = ht.Id, Date = pickerVistDate.SelectedDate ?? DateTime.Now, Price = price, Emplyees = empsIds, Vist_Id = "0", Notes = textBoxNotes.Text }; vistsData.AddVist(vist); MessageBox.Show("تم الحفظ"); }
private void GetAllVists() { VistsData vistsData = new VistsData(); vistsList = vistsData.GetAllVists(); foreach (var item in vistsList) { comboBoxVists.Items.Add(item); } }