private void cancelButton_Click(object sender, RoutedEventArgs e) { Window HostingUnitWindow = new HostWindow(username); HostingUnitWindow.Show(); this.Close(); }
private void Back_Click(object sender, RoutedEventArgs e) { Window hostwin = new HostWindow(username); hostwin.Show(); this.Close(); }
private void backButton_Click(object sender, RoutedEventArgs e) { Window hosttWindow = new HostWindow(username); hosttWindow.Show(); this.Close(); }
private void Submit_Click(object sender, RoutedEventArgs e) { if (txtUsername.Text.Length == 0) { MessageBox.Show("Enter a username"); } else { if (txtPassword.Password.Length == 0) { MessageBox.Show("Enter a password."); } if (txtUsername.Text == "Admin" && txtPassword.Password == "admin") { AdminMainWindow admin = new AdminMainWindow(); admin.Show(); this.Close(); } else { if (!checkInputGuest() && !checkInputHost()) { MessageBox.Show("username or password incorrect, fix or register"); } else { if (checkInputHost()) { HostWindow ho = new HostWindow(txtUsername.Text); ho.Show(); this.Close(); } if (checkInputGuest()) { Welcome welcomeWindow = new Welcome(); welcomeWindow.Show(); this.Close(); } } } } }
private void Button_Click(object sender, RoutedEventArgs e) { int error = 0; try { if (hostingUnitName1TextBox.Text == "" && error == 0)//need to fill out name (we dont care if his name is a number) { MessageBox.Show("need to fill out name"); error++; } else if (commission1TextBox.Text == "" && error == 0) { MessageBox.Show("need to fill out comission"); error++; } if (error == 0) { bl.UpdateHostingUnit(unit); MessageBox.Show("Guest Request updated, Key: " + unit.HostingUnitKey1); Window hWindow = new HostWindow(username); hWindow.Show(); this.Close(); } } catch (FormatException) { MessageBox.Show("Please check your input and try again"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void addButton_Click(object sender, RoutedEventArgs e) { int numberOfCommish; bool numVal = int.TryParse(commission1TextBox.Text, out numberOfCommish); try { unit.Owner1 = new BE.Host(); unit.Owner1 = owner; if (hostingUnitNameTextBox.Text == "") { MessageBox.Show("must enter a HostingUnit name!"); hostingUnitNameTextBox.Clear(); hostingUnitNameTextBox.Focus(); } else if (commission1TextBox.Text == "" || numberOfCommish <= 0 || (numVal == false)) { MessageBox.Show("must enter HostingUnit Commision!"); commission1TextBox.Clear(); commission1TextBox.Focus(); } else if (Area1.Text == "Please Select") { MessageBox.Show("must enter HostingUnit Area!"); Area1.Focus(); } else { string selected1 = Area1.SelectedItem.ToString(); selected1 = selected1.Substring(selected1.IndexOf(' ')); if (selected1 == " North") { unit.AreaOfHostingUnit = BEEnum.Area.North; } else if (selected1 == " South") { unit.AreaOfHostingUnit = BEEnum.Area.South; } else if (selected1 == " Center") { unit.AreaOfHostingUnit = BEEnum.Area.Center; } else if (selected1 == " Jerusalem") { unit.AreaOfHostingUnit = BEEnum.Area.Jerusalem; } bl.AddHostingUnit(unit); MessageBox.Show("Hosting Unit Added, Key:" + unit.HostingUnitKey1); this.DataContext = unit; Window HostingUnitWindow = new HostWindow(username); HostingUnitWindow.Show(); this.Close(); } } catch (FormatException) { MessageBox.Show("Please check your input and try again"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void DeleteButton_Click(object sender, RoutedEventArgs e) { if (this.DeletePrivateNameTextBox.Text != "" && this.DeleteKeyTextBox.Text != "") { MessageBox.Show("please enter only one field, byname or by key."); UpdateKey.Clear(); UpdatePrivateNameTextBox.Clear(); DeleteKeyTextBox.Clear(); DeletePrivateNameTextBox.Clear(); //Window UpdateDeleteByWindow = new updeletebyunit(username); //UpdateDeleteByWindow.Show(); //this.Close(); } else if (this.DeletePrivateNameTextBox.Text != "") { try { unit = bl.GetHostingUnitByName(this.DeletePrivateNameTextBox.Text); long tempkey = unit.HostingUnitKey1; bl.DeleteHostingUnit(unit); MessageBox.Show("Unit deleted, Key: " + tempkey); Window GuestRequestWindow = new HostWindow(username); GuestRequestWindow.Show(); this.Close(); } catch (Exception exx) { if (exx.Message.Contains(':')) { MessageBox.Show("unit does not exist or " + exx.Message.Substring(exx.Message.IndexOf(':'))); } else { MessageBox.Show("unit does not exist or " + exx.Message); } Window GuestRequestWindow = new HostWindow(username); GuestRequestWindow.Show(); this.Close(); } } else if (this.DeleteKeyTextBox.Text != "") { try { unit = bl.GetHostingUnitByKey(long.Parse(this.DeleteKeyTextBox.Text)); long tempkey = unit.HostingUnitKey1; bl.DeleteHostingUnit(unit); MessageBox.Show("unit deleted, Key: " + tempkey); Window hostWindow = new HostWindow(username); hostWindow.Show(); this.Close(); } catch (Exception) { MessageBox.Show("unit does not exist"); Window GuestRequestWindow = new HostWindow(username); GuestRequestWindow.Show(); this.Close(); } } else { MessageBox.Show("unit does not exist, " + "or you entered info into wrong fields"); } }