private void Button_Click(object sender, RoutedEventArgs e) { var restSharpHandler = new RestSharpHandler(); if (FirstName.Text != "" && SecondName.Text != "" && BirthDate.SelectedDate != null && PeselNumber.Text != "") { restSharpHandler.CreateClient(FirstName.Text, SecondName.Text, BirthDate.SelectedDate, Int32.Parse(PeselNumber.Text)); } }
private void DeleteClient(object sender, RoutedEventArgs e) { RestSharpHandler handler = new RestSharpHandler(); if (IDToRemove.Text != "") { handler.RemoveClient(int.Parse(IDToRemove.Text)); items.Clear(); displayClients(); IDToRemove.Clear(); } }
private void displayClients() { RestSharpHandler handler = new RestSharpHandler(); Client tempClient = new Client(); for (int i = 32; i < 60; i++) { tempClient = handler.GetClient(i); if (tempClient != null) { items.Add(tempClient); } } clientsList.ItemsSource = items; CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(clientsList.ItemsSource); view.SortDescriptions.Add(new System.ComponentModel.SortDescription("SecondName", ListSortDirection.Ascending)); }
private void Modify_Click(object sender, RoutedEventArgs e) { RestSharpHandler handler = new RestSharpHandler(); if (ModifyFirstName.Text != "" && ModifySecondName.Text != "" && ModifyBirthDate.SelectedDate != null && ModifyPeselNumber.Text != "") { handler.ModifyClient(int.Parse(IDToModify.Text), new Client() { FirstName = ModifyFirstName.Text, SecondName = ModifySecondName.Text, ClientData = null }); items.Clear(); displayClients(); ModifyFirstName.Clear(); ModifyPeselNumber.Clear(); ModifySecondName.Clear(); IDToModify.Clear(); ModifyBirthDate.SelectedDate = null; } }