Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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();
        }
Exemplo n.º 3
0
        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();
        }
Exemplo n.º 4
0
        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;
        }
Exemplo n.º 5
0
            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);
            }
Exemplo n.º 6
0
        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;
            }
        }
Exemplo n.º 7
0
        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);
            }
        }