コード例 #1
0
ファイル: Calendar.xaml.cs プロジェクト: PawWaw/Room-Renting
        private void CancelRentButton_Click(object sender, RoutedEventArgs e)
        {
            if (DataGridBox.SelectedItem != null)
            {
                Warning warn = new Warning("Are you sure?");
                warn.ShowDialog();

                if (isRemoved)
                {
                    WSCalendar temp = (WSCalendar)DataGridBox.SelectedItem;
                    calendarService.deleteRent(temp.id);
                }
            }

            DataGridBox.ClearValue(ItemsControl.ItemsSourceProperty);
            DataGridBox.Items.Clear();
            if (RenterToggle.IsChecked == true)
            {
                RenterCombobox.IsEnabled = true;
                loadLandlordColumns();
            }
            else
            {
                RenterCombobox.IsEnabled = false;
                loadTenantColumns();
            }
        }
コード例 #2
0
ファイル: Calendar.xaml.cs プロジェクト: PawWaw/Room-Renting
        private void loadLandlordColumns()
        {
            RenterCombobox.IsEnabled = true;

            List <Addresses> userAddresses = calendarService.getUserAddresses(LoginService.userId);
            List <long>      addressIds    = userAddresses.Select(c => c.id).ToList();

            rents = calendarService.getRenterFutureRents(addressIds);

            for (int i = 0; i < userAddresses.Count; i++)
            {
                RenterCombobox.Items.Add(userAddresses[i].street);
                DateTime date = new DateTime(2020, 10, 10);
            }

            List <WSCalendar> calendarList = new List <WSCalendar>();

            for (int i = 0; i < rents.Count; i++)
            {
                WSCalendar temp = new WSCalendar();
                temp.id        = rents[i].id;
                temp.startDate = rents[i].startDate.ToShortDateString();
                temp.endDate   = rents[i].endDate.ToShortDateString();
                temp.address   = calendarService.getAddress(rents[i].address_id);
                temp.client    = calendarService.getPerson(rents[i].user_id);
                calendarList.Add(temp);
            }
            LoadGrid(calendarList);
        }
コード例 #3
0
ファイル: Calendar.xaml.cs プロジェクト: PawWaw/Room-Renting
        private void loadTenantColumns()
        {
            RenterCombobox.IsEnabled = false;

            rents = calendarService.getUserFutureRents(LoginService.userId);
            List <WSCalendar> calendarList = new List <WSCalendar>();

            for (int i = 0; i < rents.Count; i++)
            {
                WSCalendar temp = new WSCalendar();
                temp.id        = rents[i].id;
                temp.startDate = rents[i].startDate.ToShortDateString();
                temp.endDate   = rents[i].endDate.ToShortDateString();
                temp.address   = calendarService.getAddress(rents[i].address_id);
                temp.client    = calendarService.getPerson(rents[i].user_id);
                calendarList.Add(temp);
            }

            LoadGrid(calendarList);
        }