Ejemplo n.º 1
0
        private void DemoErstellen()
        {
            // Kategorie (kurze Syntax)
            DAL.Kategorie kategorie1 = new DAL.Kategorie {
                Name = "Kategorie 1"
            };
            Int64 kategorie1Id = BLL.Kategorie.Erstellen(kategorie1);

            Debug.Print("Kategorie erstellt mit Id:" + kategorie1Id);
            DAL.Kategorie kategorie2 = new DAL.Kategorie {
                Name = "Kategorie 2"
            };
            Int64 kategorie2Id = BLL.Kategorie.Erstellen(kategorie2);

            Debug.Print("Kategorie erstellt mit Id:" + kategorie2Id);
            // Passwort (detaillierte Syntax)
            DAL.Passwort passwort1 = new DAL.Passwort();
            passwort1.Login        = "******";
            passwort1.PSW          = "gibbiX12345";
            passwort1.Eingabedatum = DateTime.Today;
            passwort1.Ablaufdatum  = DateTime.Today.AddMonths(1);
            passwort1.Kategorie    = kategorie1;
            Int64 passwort1Id = BLL.Passwort.Erstellen(passwort1);

            Debug.Print("Passwort erstellt mit Id:" + passwort1Id);
        }
 public UC_PasswordListView(MainWindow parent, DAL.Kategorie kategorie)
 {
     InitializeComponent();
     this.parent          = parent;
     this.currentCategory = kategorie;
     LoadView(kategorie);
     initialize();
 }
Ejemplo n.º 3
0
        public void setKategorie(long kategorieId)
        {
            kategorie = BLL.Kategorie.LesenID(kategorieId);

            name.Text = kategorie.Name;

            delete_button.Visibility = Visibility.Visible;
        }
 private void LoadView(DAL.Kategorie kategorie)
 {
     ListPasswords.CanUserAddRows      = false;
     ListPasswords.IsReadOnly          = true;
     ListPasswords.CanUserSortColumns  = true;
     ListPasswords.SelectionMode       = DataGridSelectionMode.Single;
     ListPasswords.AutoGenerateColumns = false;
     ListPasswords.ItemsSource         = BLL.Passwort.LesenFremdschluesselGleich(kategorie);
 }
Ejemplo n.º 5
0
 public UC_Category(MainWindow parent, DAL.Kategorie category, WorkingStatus workingStatus)
 {
     this.parent        = parent;
     this.category      = category;
     this.workingStatus = category == null ? WorkingStatus.NEW : workingStatus;
     this.entityStatus  = category == null ? EntityStatus.UNCHANGED : EntityStatus.MODIFIED;
     PreName            = category.Name;
     InitializeComponent();
     Initalize();
 }
Ejemplo n.º 6
0
        public Kategorie(long kategorieId)
        {
            InitializeComponent();

            kategorie = BLL.Kategorie.LesenID(kategorieId);

            var passwoerterData = BLL.Passwort.LesenFremdschluesselGleich(kategorie);

            passwoerter.ItemsSource = passwoerterData;
        }
Ejemplo n.º 7
0
 private void BTNSave_Click(object sender, RoutedEventArgs e)
 {
     if (category.Name == PreName)
     {
         MessageBox.Show("No changes", "Unchanged", MessageBoxButton.OK, MessageBoxImage.Information);
     }
     else if (IsSelectionValid())
     {
         if (!BLL.Kategorie.Existiert(TXTName.Text))
         {
             if (entityStatus == EntityStatus.UNATTACHED)
             {
                 var id = BLL.Kategorie.Erstellen(category);
                 if (id > 0)
                 {
                     MessageBox.Show("Category has been created", "Created", MessageBoxButton.OK, MessageBoxImage.Information);
                     category = BLL.Kategorie.LesenID(id);
                     parent.UpdateCategoryList();
                     parent.LoadPasswordListView(category);
                     entityStatus  = EntityStatus.MODIFIED;
                     workingStatus = WorkingStatus.LOADED;
                 }
                 else
                 {
                     MessageBox.Show("Some error occurred while creating the category", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                 }
             }
             else if (entityStatus == EntityStatus.MODIFIED)
             {
                 BLL.Kategorie.Aktualisieren(category);
                 var entity = BLL.Kategorie.LesenID(category.KategorieId);
                 category = entity;
                 PreName  = category.Name;
                 LoadValues(category);
                 parent.UpdateCategoryList();
                 parent.MainTitle.Content = category.Name;
                 MessageBox.Show("The category has been updated", "Update", MessageBoxButton.OK, MessageBoxImage.Information);
             }
         }
         else
         {
             MessageBox.Show("The name of the category is already taken", "Exists", MessageBoxButton.OK, MessageBoxImage.Warning);
         }
     }
     else
     {
         MessageBox.Show("The cateory already exists or the content is invalid", "Invalid", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Ejemplo n.º 8
0
 private void BTNDelete_Click(object sender, RoutedEventArgs e)
 {
     if (entityStatus == EntityStatus.MODIFIED)
     {
         MessageBoxResult mbr = MessageBox.Show("Do you realy want to delete the password", "Delete", MessageBoxButton.YesNo, MessageBoxImage.Warning);
         if (mbr == MessageBoxResult.Yes)
         {
             BLL.Kategorie.LoeschenById(category.KategorieId);
             MessageBox.Show("Password has been deleted", "Deleted", MessageBoxButton.OK, MessageBoxImage.Information);
             parent.LoadView(new UC_Password(parent, Additonal.WorkingStatus.NEW), "New password");
         }
     }
     else
     {
         category = EmptyCategory();
         LoadValues(category);
         MessageBox.Show("Content has been cleared", "Cleared", MessageBoxButton.OK, MessageBoxImage.Information);
     }
 }
Ejemplo n.º 9
0
        private void save_button_Click(object sender, RoutedEventArgs e)
        {
            if (kategorie == null)
            {
                kategorie = new DAL.Kategorie
                {
                    Name = name.Text
                };
                BLL.Kategorie.Erstellen(kategorie);
            }
            else
            {
                kategorie.Name = name.Text;
                BLL.Kategorie.Aktualisieren(kategorie);
            }
            MainWindow parentWindow = (MainWindow)Window.GetWindow(this);

            parentWindow.showDefault();
            parentWindow.updateKategorienButtons();
        }
Ejemplo n.º 10
0
 private void LoadValues(DAL.Kategorie kategorie)
 {
     TXTName.Text = kategorie.Name;
 }
Ejemplo n.º 11
0
 private void InitializeNewStatus()
 {
     this.category = EmptyCategory();
     LoadValues(category);
 }
 private void ListKategorie_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     category = (DAL.Kategorie)(((DataGrid)sender).SelectedItem);
 }
 private void ListKategorie_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     DAL.Kategorie kategorie = (DAL.Kategorie)(((DataGrid)sender).SelectedItem);
     parent.LoadPasswordListView(kategorie);
 }
Ejemplo n.º 14
0
 public void LoadPasswordListView(DAL.Kategorie kategorie)
 {
     MainTitle.Content = kategorie.Name;
     this.mainShowPlace.Children.Clear();
     this.mainShowPlace.Children.Add(new UC_PasswordListView(this, kategorie));
 }