Esempio n. 1
0
        // return the items
        private void Return_ItemBtr(object sender, RoutedEventArgs e)
        {
            double a    = double.Parse(EditionTxt.Text);
            string name = NameTxt.Text;

            BookLib.ItemCollection collection = libraryManager.GetItemCollection();
            // we compre the the name and the edition of the item to check if he valid
            AbstractItem item  = collection[a];
            AbstractItem item2 = collection[name];

            // if this 2 itmes founded are the same obj so the input is valid

            if (item == item2 && item != null && item2 != null)
            {
                if (libraryManager.ReturnItemFromRent(user, item))
                {
                    //the return succes
                    System.Windows.Forms.MessageBox.Show("Book returned!", "Sucess");
                }
                else
                {
                    //the return faild
                    System.Windows.Forms.MessageBox.Show("Book was not found!", "Error");
                }
            }
            else
            {
                // input wrong!
                System.Windows.Forms.MessageBox.Show("Incorrect information!", "Error");
            }
        }
Esempio n. 2
0
 public LibraryManager()
 {
     item = new BookLib.ItemCollection();
     if (BookLib.ItemCollection.abstractItems.Count < 2)//hardcoded items.
     {
         Book book = new Book("Hey", 1, 1, Theme.GoodNEvil, Categories.Kids, 11);
         //double b = book.getDiscountPrice();
         Journal journal = new Journal("Ofri", 3, 2, Theme.Heroism, Categories.Kids, 11);
     }
 }
        private void Search_Item(object sender, RoutedEventArgs e)
        {
            //we check 2 thing's the name and the edition they qunic, and if they valid we can to the add and remove
            BookLib.ItemCollection collection = libraryManager.GetItemCollection();
            item  = collection[double.Parse(EditionTxt.Text)];
            item2 = collection[NameTxtt.Text];
            if (item == item2 && item != null)
            {
                ItemNameblock.Text = "Item was Found";
                addbt.IsEnabled    = true;
                removebt.IsEnabled = true;
            }

            else
            {
                ItemNameblock.Text = "Item was Not Found";
                item            = null;
                item2           = null;
                EditionTxt.Text = "";
                NameTxtt.Text   = "";
            }
        }
Esempio n. 4
0
        private static BookLib.ItemCollection items;//(because has same name of class in ui)
        static MainPage()
        {
            //The static fields are intilaized once, in the first time which this page is called
            //and throuhout the runtime of app, the fields are changed by the user
            users = new ManagerUsers();
            items = new BookLib.ItemCollection();
            users.AddUser(new User("mushky", "kkk", "0586191191", "lod", "02/02/1997", CodeOccupation.Customer));
            users.AddUser(new User("mushky2", "kkk", "0586191191", "lod", "02/02/1997", CodeOccupation.Librarian));
            users.AddUser(new User("mushky5", "kkk", "0586191191", "lod", "02/02/1997", CodeOccupation.DiscounManager));
            users.AddUser(new User("mushky4", "kkk", "0586191191", "lod", "02/02/1997", CodeOccupation.LibraryManager));
            List <Genre> genres = new List <Genre>();

            genres.Add(0);
            items.AddItem(new Book("marko", 3, "sfarim", 56, 2018, "ari", 1, genres));
            items.AddItem(new Book("marko", 3, "sfarim", 56, 2018, "ari", 1, genres));
            items.AddItem(new Book("marko", 3, "sfarim", 56, 2018, "ari", 1, genres));
            items.AddItem(new Book("marko", 3, "sfarim", 56, 2018, "ari", 1, genres));
            items.AddItem(new Journal("marko", 3, "sfarim", 56, "04/07/2010", "lll", 0));
            items.AddItem(new Journal("marko", 3, "sfarim", 56, "04/07/2010", "lll", 0));
            items.AddItem(new Journal("marko", 3, "sfarim", 56, "04/07/2010", "lll", 0));
            items.AddItem(new Journal("marko", 3, "sfarim", 56, "04/07/2010", "lll", 0));
            items.AddItem(new Journal("marko", 3, "sfarim", 56, "04/07/2010", "lll", 0));
        }
Esempio n. 5
0
 public Journal(string name, double edition, int copies, Theme theme, Categories category, double price) : base(name, edition, copies, theme, category, price)
 {
     ItemCollection.AddToLibrary(this);
 }