private void MenuItem_Checked_Area(object sender, RoutedEventArgs e) { var AreaMenuItem = (sender as MenuItem).Parent as MenuItem; foreach (MenuItem item in AreaMenuItem.Items) { if (item.Header != (sender as MenuItem).Header) { item.IsChecked = false; } } if (((string)(sender as MenuItem).Header) == "הכל") { MainListBox.ItemsSource = Requests; return; } BO.Location selectedLocation = (BO.Location)MyDictionary.TranslatStringeToEnum((string)(sender as MenuItem).Header); MainListBox.ItemsSource = from Group in bl.GuestRequestGroupedBySpecificArea() where Group.Key == selectedLocation select Group into items from guestRequest in items where guestRequest.ClientID != hostID select guestRequest; }
private void AddPersonButton_Click(object sender, RoutedEventArgs e) { foreach (var item in AddPerson.Children) { if (item is TextBox || item is PasswordBox) { if ((item as Control).Background == Brushes.Red || (item as Control).Background == Brushes.WhiteSmoke) { MessageBox.Show("לא כל השדות מלאו כנדרש"); return; } } } BO.Person person = new BO.Person(); person.FirstName = this.FirstNameTextBox.Text; person.LastName = this.LastNameTextBox.Text; person.Id = int.Parse(this.IdTextBox.Text); person.MailAddress = this.MailAddressTextBox.Text; person.Password = this.PasswordTextBox.Password; person.PhoneNumber = int.Parse(this.PhoneNumberTextBox.Text); person.Status = BO.Status.ACTIVE; person.IdType = (BO.ID)MyDictionary.TranslatStringeToEnum(IdTypeComboBox.SelectedItem.ToString()); try { bl.AddPerson(person); } catch (DuplicateWaitObjectException exp) { MessageBox.Show(exp.Message, "שגיאה", MessageBoxButton.OK, MessageBoxImage.Error); return; } NavigationService.Navigate((new MainWindowPage(bl, person))); }
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return(MyDictionary.TranslatStringeToEnum((string)value));//return enum }