public void notify() { ReserversionsServiceClient client = new ReserversionsServiceClient(); String sessionId = (String)App.Current.Properties[App.sessionPropertyName]; DataGrid reerversionsDataGrid = (DataGrid)App.Current.Properties[App.reservarsionDataGridPropertyName]; reerversionsDataGrid.ItemsSource = client.FindAll(sessionId); }
private void bindCusstomerComboBox() { ReserversionsServiceClient client = new ReserversionsServiceClient(); String sessionId = (String)App.Current.Properties[App.sessionPropertyName]; List <CustomerComboBoxWraper> customers = client.FindAllCustomers(sessionId).Select(customer => new CustomerComboBoxWraper(customer)).ToList(); comboBoxCustomer.ItemsSource = customers; comboBoxCustomer.SelectedValuePath = "Id"; comboBoxCustomer.SelectedItem = customers.FirstOrDefault(); }
private void bindRoomsComboBox() { ReserversionsServiceClient client = new ReserversionsServiceClient(); String sessionId = (String)App.Current.Properties[App.sessionPropertyName]; List <RoomsComboBoxWraper> rooms = client.FindAllRooms(sessionId).Select(room => new RoomsComboBoxWraper(room)).ToList(); comboBoxRoom.ItemsSource = rooms; comboBoxRoom.SelectedValuePath = "Id"; comboBoxRoom.SelectedItem = rooms.FirstOrDefault(); }
private void buttonRefresh_Click(object sender, RoutedEventArgs e) { ReserversionsServiceClient client = new ReserversionsServiceClient(); String sessionId = (String)App.Current.Properties[App.sessionPropertyName]; ReserverionsDataGrid.ItemsSource = client.FindAll(sessionId); int selectedRoom = (int)comboBoxRoom.SelectedValue; comboBoxRoom.ItemsSource = client.FindAllRooms(sessionId).Select(room => new RoomsComboBoxWraper(room)).ToList(); comboBoxRoom.SelectedValue = selectedRoom; int selectedCustomer = (int)comboBoxCustomer.SelectedValue; comboBoxCustomer.ItemsSource = client.FindAllCustomers(sessionId).Select(customer => new CustomerComboBoxWraper(customer)).ToList(); comboBoxCustomer.SelectedValue = selectedCustomer; }
public static bool Valid(ReserversionWraper reserversion) { if (DateTime.Compare(reserversion.From, reserversion.To) > 0) { MessageBox.Show("Data od nie może być poźniejsza od daty do"); return(false); } ReserversionsServiceClient client = new ReserversionsServiceClient(); String sessionId = (String)App.Current.Properties[App.sessionPropertyName]; if (!client.isRoomVacant(sessionId, reserversion)) { MessageBox.Show("Pokój zajęty w tym okresie"); return(false); } return(true); }
public MainWindow() { InitializeComponent(); bindRoomsComboBox(); bindCusstomerComboBox(); datePickerFrom.SelectedDate = DateTime.Today; datePickerTo.SelectedDate = DateTime.Today; ReserversionsServiceClient client = new ReserversionsServiceClient(); String sessionId = (String)App.Current.Properties[App.sessionPropertyName]; ReserverionsDataGrid.ItemsSource = client.FindAll(sessionId); UsersServiceClient usersClient = new UsersServiceClient(); String login = (String)App.Current.Properties[App.loginPropertyName]; if (usersClient.isAdmin(sessionId, login)) { MenuStaff.Visibility = Visibility.Visible; } }
private void FillAndSave(ReserversionWraper reserversion) { reserversion.From = (DateTime)datePickerFrom.SelectedDate; reserversion.To = (DateTime)datePickerTo.SelectedDate; reserversion.Customers = ((CustomerComboBoxWraper)comboBoxCustomer.SelectedItem).customer; reserversion.RoomId = ((RoomsComboBoxWraper)comboBoxRoom.SelectedItem).room.Id; reserversion.Rooms = ((RoomsComboBoxWraper)comboBoxRoom.SelectedItem).room; if (!Validator.Valid(reserversion)) { return; } ReserversionsServiceClient client = new ReserversionsServiceClient(); String sessionId = (String)App.Current.Properties[App.sessionPropertyName]; int savedCustomersQuantity = client.Save(sessionId, reserversion); if (savedCustomersQuantity > 0) { ReserverionsDataGrid.ItemsSource = client.FindAll(sessionId); } }