private void DeleteButton_Click(object sender, RoutedEventArgs e) { if (this.DeleteFamilyNameTextBox.Text != "" && this.DeletePrivateNameTextBox.Text != "" && this.DeleteKeyTextBox.Text != "") { MessageBox.Show("please enter only one field, byname or by key."); Window UpdateDeleteByWindow = new UpdateDeleteBy(); UpdateDeleteByWindow.Show(); this.Close(); } //not sure we can do delete by name /*else if (this.DeleteFamilyNameTextBox.Text != "" && this.DeletePrivateNameTextBox.Text != "") * { * try * { * guest = bl.GetallGuestRequestByName(this.DeletePrivateNameTextBox.Text, this.DeleteFamilyNameTextBox.Text); * long tempkey = guest.GuestRequestKey1; * bl.DeleteGuestRequest(guest); * MessageBox.Show("Guest Request deleted, Key: " + tempkey); * Window GuestRequestWindow = new GuestRequest(); * GuestRequestWindow.Show(); * this.Close(); * } * catch(Exception) * { * MessageBox.Show("Guest Request does not exist"); * Window GuestRequestWindow = new GuestRequest(); * GuestRequestWindow.Show(); * this.Close(); * } * * }*/ else if (this.DeleteKeyTextBox.Text != "") { try { guest = bl.GetGuestRequestByKey(long.Parse(this.DeleteKeyTextBox.Text)); long tempkey = guest.GuestRequestKey1; bl.DeleteGuestRequest(guest); MessageBox.Show("Guest Request deleted, Key: " + tempkey); Window GuestRequestWindow = new GuestRequest(); GuestRequestWindow.Show(); this.Close(); } catch (Exception) { MessageBox.Show("Guest Request does not exist"); Window GuestRequestWindow = new GuestRequest(); GuestRequestWindow.Show(); this.Close(); } } else { MessageBox.Show("Guest Request does not exist, " + "or you entered info into wrong fields"); } }
private void updateRequestButton_Click(object sender, RoutedEventArgs e) { Window UpdateBYWindow = new UpdateDeleteBy(); UpdateBYWindow.Show(); //Window updateRequestWindow = new UpdateGuestRequest(); //updateRequestWindow.Show(); this.Close(); }
private void DeleteButton_Click(object sender, RoutedEventArgs e) { if (this.DeleteFamilyNameTextBox.Text != "" && this.DeletePrivateNameTextBox.Text != "" && this.DeleteKeyTextBox.Text != "") { MessageBox.Show("please enter only one field, byname or by key."); Window UpdateDeleteByWindow = new UpdateDeleteBy(); UpdateDeleteByWindow.Show(); this.Close(); } else if (this.DeleteFamilyNameTextBox.Text != "" && this.DeletePrivateNameTextBox.Text != "") { try { //sends to a window with a scroll box and then the user deletes the gs he wants to update Window deleteby = new deletByNameChoose(this.DeletePrivateNameTextBox.Text, this.DeleteFamilyNameTextBox.Text); deleteby.Show(); this.Close(); } catch (Exception) { MessageBox.Show("Guest Requests for this user don't exist"); } } else if (this.DeleteKeyTextBox.Text != "") { try { guest = bl.GetGuestRequestByKey(long.Parse(this.DeleteKeyTextBox.Text)); long tempkey = guest.GuestRequestKey1; bl.DeleteGuestRequest(guest); MessageBox.Show("Guest Request deleted, Key: " + tempkey); Window GuestRequestWindow = new GuestRequest(); GuestRequestWindow.Show(); this.Close(); } catch (Exception) { MessageBox.Show("Guest Request does not exist"); Window GuestRequestWindow = new GuestRequest(); GuestRequestWindow.Show(); this.Close(); } } else { MessageBox.Show("Guest Request does not exist, " + "or you entered info into wrong fields"); } }
private void UpdateButton_Click(object sender, RoutedEventArgs e) { if ((this.UpdatePrivateNameTextBox.Text != "" || this.UpdatefamilyNameTextBox.Text != "") && this.UpdateKey.Text != "") { MessageBox.Show("please enter only one field, byname or by key."); Window UpdateDeleteByWindow = new UpdateDeleteBy(); UpdateDeleteByWindow.Show(); this.Close(); } else if (this.UpdatefamilyNameTextBox.Text != "" && this.UpdatePrivateNameTextBox.Text != "") { try { //sends to a window with a scroll box and then the user updates the gs he wants to update Window UpdateByNameChooseWindow = new UpdateByNameChoose(this.UpdatePrivateNameTextBox.Text, this.UpdatefamilyNameTextBox.Text); UpdateByNameChooseWindow.Show(); this.Close(); } catch (Exception) { MessageBox.Show("Guest Requests for this user don't exist"); } } else if (this.UpdateKey.Text != "") { try { Window updateRequestWindow = new UpdateGuestRequest(long.Parse(this.UpdateKey.Text)); updateRequestWindow.Show(); this.Close(); } catch (Exception) { MessageBox.Show("Guest Request does not exist"); } } else { MessageBox.Show("Guest Request does not exist, " + "or you entered info into wrong fields"); } }