示例#1
0
        public void ClientPanel()
        {
            FillInterface fill    = new FillLibrary(30);
            ILibrary      library = new Library();

            library.fillBooks(fill);
            UserPanel   userPanel   = new UserPanel(library);
            Client      tomek       = new Client(0, "tomek", "elo", "warszawa");
            Book        LOTR        = new Book(31, "J.R.R", "LOTR", DateTime.Now);
            Book        starwars    = new Book(32, "J.L.", "Star wars", DateTime.Now);
            Book        LOTR2       = new Book(33, "J.R.R2", "LOTR2", DateTime.Now);
            Book        starwars2   = new Book(34, "J.K.", "Star wars2", DateTime.Now);
            WorkerPanel workerPanel = new WorkerPanel(library);

            workerPanel.addClient(tomek);
            workerPanel.addBook(LOTR);
            workerPanel.addBook(LOTR2);
            workerPanel.addBook(starwars);
            workerPanel.addBook(starwars2);
            Assert.AreEqual(true, userPanel.rentaBook(LOTR, tomek));
            Assert.AreEqual(true, userPanel.rentaBook(LOTR2, tomek));
            Assert.AreEqual(true, userPanel.rentaBook(starwars, tomek));
            Assert.AreEqual(false, userPanel.rentaBook(starwars2, tomek));
            Assert.AreEqual(true, userPanel.giveBackBook(LOTR, tomek));
            Assert.AreEqual(false, userPanel.giveBackBook(LOTR, tomek));
        }
示例#2
0
        public void LibraryBookMenagment()
        {
            FillInterface fill    = new FillLibrary(30);
            ILibrary      library = new Library();

            library.fillBooks(fill);
            WorkerPanel workerPanel = new WorkerPanel(library);
            Book        LOTR        = new Book(31, "J.R.R", "LOTR", DateTime.Now);
            Book        starwars    = new Book(32, "J.L.", "Star wars", DateTime.Now);

            Assert.AreEqual(true, workerPanel.addBook(LOTR));
            Assert.AreEqual(false, workerPanel.deleteBook(starwars));
            Assert.AreEqual(true, workerPanel.deleteBook(LOTR));
            workerPanel.showCurrentStateBooks();
        }
示例#3
0
        public void LibraryClientMenagment()
        {
            FillInterface fill    = new FillLibrary(30);
            ILibrary      library = new Library();

            library.fillBooks(fill);
            Client      tomek       = new Client(0, "Tomek", "One", "warszawa");
            Client      romek       = new Client(1, "Romek", "Two", "warszawa");
            Client      atomek      = new Client(2, "Atomek", "Three", "warszawa");
            WorkerPanel workerPanel = new WorkerPanel(library);

            Assert.AreEqual(true, workerPanel.addClient(tomek));
            Assert.AreEqual(true, workerPanel.addClient(romek));
            Assert.AreEqual(true, workerPanel.deleteClient(romek));
            Assert.AreEqual(false, workerPanel.deleteClient(atomek));
        }
示例#4
0
        private async Task LoadWorkersToStackPanel()
        {
            SpWorkers.Children.Clear();

            List <Worker> workers = await workerApi.GetWorkers(owner.Id);

            if (workers.Count > 0)
            {
                foreach (Worker worker in workers)
                {
                    LblNoWorkers.Visibility = Visibility.Hidden;

                    WorkerPanel workerPanel = new WorkerPanel(worker);
                    SpWorkers.Children.Add(workerPanel);
                }
            }
            else
            {
                LblNoWorkers.Visibility = Visibility.Visible;
            }
        }
        private void button4_Click(object sender, EventArgs e)
        {
            var result = SQL.CheckLog(textBox1.Text.ToString(), textBox2.Text.ToString());

            if (result.Any())
            {
                this.Controls.Clear();

                if (result.First().role.ToString() == "Admin")
                {
                    //MessageBox.Show("Login and password correct");
                    this.Hide();
                    AdminPanel a1 = new AdminPanel();
                    a1.ShowDialog();
                    //this.Controls.Add(new AdminPanel());
                }
                if (result.First().role.ToString() == "Manager")
                {
                    //MessageBox.Show("Login and password correct");
                    this.Hide();
                    MainManager a1 = new MainManager();
                    a1.textBox1.Text = result.First().id_personel.ToString();
                    a1.ShowDialog();
                }
                if (result.First().role.ToString() == "Worker")
                {
                    //MessageBox.Show("Login and password correct");
                    this.Hide();
                    WorkerPanel a1 = new WorkerPanel();
                    a1.textBox1.Text = result.First().id_personel.ToString();
                    //SQLworker.SetWorkerActive(result.First().id_personel.ToString());
                    a1.ShowDialog();
                }
            }
            else
            {
                MessageBox.Show("Login and password incorrect");
            }
        }