Example #1
0
        //Search for Copies of the Item by relevant parameters
        //Excluding the ISBN, which is unique for each Item
        private void btnQuantity_Click(object sender, RoutedEventArgs e)
        {
            //Get the Item to search for from the DataGrid
            AbstractItem item = (AbstractItem)dataLib.SelectedItem;

            //Show the result of the Message Box
            GuiMsgs.Info($"The quantity of this {item.ItemType} is {mainLibrary.ItemQuantity(item)}");
        }
Example #2
0
        /// <summary>
        /// Check if User from DataGrid is the current User
        /// </summary>
        /// <returns>If the User is current - true, opposite - false</returns>
        private bool IsCurrentUser()
        {
            //if the user is current - prevent deletion or editing
            if (MainWindow.mainLibrary.LibraryUsers.CurrentUser.Name == ((User)dataUsers.SelectedItem).Name)
            {
                GuiMsgs.Info("Deletion or Editing of Current user is\nFORBIDDEN!");
                return(true);
            }

            //if the user is main user - also prevent deletion or editing
            if (((User)dataUsers.SelectedItem).Name == "BigBoss")
            {
                GuiMsgs.Info("Deletion or Editing of the 'Big Boss' is\nFORBIDDEN!\nThis is the Main User,\nSo It's Impossible to Delete him");
                return(true);
            }

            else
            {
                return(false);
            }
        }