Esempio n. 1
0
 private void addButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         bl.AddPrayer(prayer);
         prayer            = new BE.Prayer();
         Grid1.DataContext = prayer;
         prayersWindow.PrayerDataGrid.ItemsSource       = null;
         prayersWindow.PrayerDataGrid.ItemsSource       = bl.GetAllPrayers();
         prayersWindow.ChoosePrayerComboBox.ItemsSource = null;
         prayersWindow.ChoosePrayerComboBox.ItemsSource = bl.GetAllPrayers();
         string message = prayer.FirstName + " " + prayer.LastName + "נוסף לרשימת המתפללים";
         MessageBox.Show(message, "המתפלל נוסף לקהילה", MessageBoxButton.OK, MessageBoxImage.Information,
                         MessageBoxResult.OK, MessageBoxOptions.RightAlign);
         prayer            = new BE.Prayer();
         Grid1.DataContext = prayer;
         BMparashaComboBox.SelectedIndex        = -1;
         LastAliyaParashaComboBox.SelectedIndex = -1;
         TribeComboBox.SelectedIndex            = 2;
         FirstNameTextBox.Focus();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "אזהרה!", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Esempio n. 2
0
 private void deleteButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         prayer    = (BE.Prayer)PrayerGrid.DataContext;
         prayer.Id = GetSelectedPrayer().Id;
         MessageBoxResult check = MessageBox.Show(".אתה בטוח שברצונך למחוק??? לא תוכל לשחזר מתפלל זה",
                                                  "אישור מחיקה", MessageBoxButton.YesNo, MessageBoxImage.Hand, MessageBoxResult.No,
                                                  MessageBoxOptions.RightAlign);
         if (check == MessageBoxResult.Yes)
         {
             bl.RemovePrayer(prayer.Id);
             PrayerDataGrid.ItemsSource       = null;
             PrayerDataGrid.ItemsSource       = bl.GetAllPrayers();
             ChoosePrayerComboBox.ItemsSource = null;
             ChoosePrayerComboBox.ItemsSource = bl.GetAllPrayers();
             prayer = new BE.Prayer();
             PrayerGrid.DataContext = prayer;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "אזהרה!", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Esempio n. 3
0
 private void updateButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         prayer    = (BE.Prayer)PrayerGrid.DataContext;
         prayer.Id = GetSelectedPrayer().Id;
         bl.UpdatePrayer(prayer);
         PrayerDataGrid.ItemsSource = null;
         if (!bl.Empty(prayer))
         {
             PrayerDataGrid.ItemsSource = bl.GetAllPrayers();
         }
         ChoosePrayerComboBox.ItemsSource = null;
         ChoosePrayerComboBox.ItemsSource = bl.GetAllPrayers();
         prayer = new BE.Prayer();
         PrayerGrid.DataContext = prayer;
         //this.NavigationService.GoBack();
         MessageBox.Show("פרטי המתפלל עודכנו", "עדכון בוצע", MessageBoxButton.OK, MessageBoxImage.Information,
                         MessageBoxResult.OK, MessageBoxOptions.RightAlign);
         main.restart = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "אזהרה!", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Esempio n. 4
0
 private void prayerDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     prayer = PrayerDataGrid.SelectedItem as BE.Prayer;
     PrayerGrid.DataContext = prayer;
     PrayerGrid.IsEnabled   = true;
     IdTextBox.IsEnabled    = false;
 }
Esempio n. 5
0
        private BE.Prayer GetSelectedPrayer()
        {
            object t = ChoosePrayerComboBox.SelectedItem;

            BE.Prayer choice = (BE.Prayer)t;
            return(choice);
        }
Esempio n. 6
0
 private void choosePrayerComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     prayer = GetSelectedPrayer();
     PrayerGrid.DataContext = prayer;
     PrayerGrid.IsEnabled   = true;
     IdTextBox.IsEnabled    = false;
     PrayerDataGrid.Focus();
 }
Esempio n. 7
0
        public AddPrayerWindow()
        {
            InitializeComponent();
            bl                = BL.FactoryBl.getBL();
            prayer            = new BE.Prayer();
            Grid1.DataContext = prayer;


            BMparashaComboBox.CustomSource        = Enum.GetValues(typeof(BE.Parashot));
            LastAliyaParashaComboBox.CustomSource = Enum.GetValues(typeof(BE.Parashot));
            TribeComboBox.ItemsSource             = Enum.GetValues(typeof(BE.Lineage));

            BMparashaComboBox.SelectedIndex        = -1;
            LastAliyaParashaComboBox.SelectedIndex = -1;
            TribeComboBox.SelectedIndex            = 2;
            FirstNameTextBox.Focus();
        }
Esempio n. 8
0
        public PrayersWindow()
        {
            InitializeComponent();
            //addLabel.Content = "הוספת" + Environment.NewLine + "מתפלל";
            bl       = BL.FactoryBl.getBL();
            prayer   = new BE.Prayer();
            mainBlur = new System.Windows.Media.Effects.BlurEffect();

            BMparashaComboBox.CustomSource        = Enum.GetValues(typeof(BE.Parashot));
            LastAliyaParashaComboBox.CustomSource = Enum.GetValues(typeof(BE.Parashot));
            TribeComboBox.ItemsSource             = Enum.GetValues(typeof(BE.Lineage));

            PrayerDataGrid.ItemsSource             = bl.GetAllPrayers();
            ChoosePrayerComboBox.ItemsSource       = bl.SortByLastName(bl.GetAllPrayers());
            ChoosePrayerComboBox.DisplayMemberPath = "LastName";
            ChoosePrayerComboBox.SelectedValuePath = "Id";
            PrayerDataGrid.SelectedValuePath       = "Id";
        }