Esempio n. 1
0
 private void Add_ItemEvent(object sender, RoutedEventArgs e)
 {
     // run all the check's
     if (!Checks.IsNotEmptyNullOrWhite(NameTxt.Text) || !Checks.isTextDouble(EditionTxt.Text) || !Checks.isTextInt(CopiesTxt.Text) || !Checks.isTextDouble(PriceTxt.Text))
     {
         System.Windows.Forms.MessageBox.Show("Please enter valid information", "Error!");
         return;
     }
     // after that all the input are valid's we can to all the input casting
     // we check if the book allrady in our system
     if (BookRadio.IsChecked == true && LibraryManager.CheckIfBookNotExisted(NameTxt.Text))
     {
         new Book(NameTxt.Text, double.Parse(EditionTxt.Text), int.Parse(CopiesTxt.Text), (Theme)Enum.Parse(typeof(Theme), ThemeCombo.SelectedValue.ToString()), (Categories)Enum.Parse(typeof(Categories), CategoryCombo.SelectedValue.ToString()), double.Parse(PriceTxt.Text));
         System.Windows.Forms.MessageBox.Show("Item was added!");
         this.Close();
     }
     else if (JournalRadion.IsChecked == true && LibraryManager.CheckIfBookNotExisted(NameTxt.Text))
     {
         new Journal(NameTxt.Text, double.Parse(EditionTxt.Text), int.Parse(CopiesTxt.Text), (Theme)Enum.Parse(typeof(Theme), ThemeCombo.SelectedValue.ToString()), (Categories)Enum.Parse(typeof(Categories), CategoryCombo.SelectedValue.ToString()), double.Parse(PriceTxt.Text));
         System.Windows.Forms.MessageBox.Show("Item was added!");
         this.Close();
     }
 }
 public EmployeePanel()
 {
     libraryManager = new LibraryManager();
     InitializeComponent();
     RemoveBtn.IsEnabled = false;
 }
 private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     // print the user the detail's of the item that he choose
     InfoTxt.Text = LibraryManager.getInfo(BookListCombo);
 }