Ejemplo n.º 1
0
 private void MainForm_Load(object sender, EventArgs e)
 {
     Books = _database.GetBooks();
     GuiHelpers.RefreshBooksPanel(Books, booksPanelListView);
     Requests = _database.GetRequests();
     GuiHelpers.RefreshRequestsPanel(Requests, requestsPanelListView);
     GuiHelpers.MakePanelActive(booksPanel, ordersPanel, requestsPanel);
     GuiHelpers.MakeBtnActive(booksPanelBtn, ordersPanelBtn, requestsPanelBtn);
     if (CurrUser.IsAdmin)
     {
         userInfoLabel.Text    = "Welcome, Admin " + CurrUser.Username;
         addBookBtn.Visible    = true;
         delRequestBtn.Visible = true;
         Orders = _database.GetOrders();
         GuiHelpers.RefreshOrdersPanel(Orders, ordersPanelListView);
         ordersPanelBtn.Text = "     All Orders";
     }
     else
     {
         userInfoLabel.Text = "Welcome, " + CurrUser.Username;
         Orders             = _database.GetOrdersByUsername(CurrUser.Username);
         GuiHelpers.RefreshOrdersPanel(Orders, ordersPanelListView);
         ordersPanelListView.Columns[1].Width = 0;
         ordersPanelBtn.Text = "     My Orders";
     }
 }
Ejemplo n.º 2
0
        public OrderDetailsForm(List <Book> books)
        {
            InitializeComponent();
            _books = books;

            GuiHelpers.RefreshBooksPanel(_books, listView1);
            double total = books.Sum(b => b.Price);

            orderTotalLabel.Text = "Order Total: " + total.ToString();
        }
Ejemplo n.º 3
0
 public void RefreshAllData()
 {
     if (CurrUser.IsAdmin)
     {
         Orders = _database.GetOrders();
         GuiHelpers.RefreshOrdersPanel(Orders, ordersPanelListView);
     }
     else
     {
         Orders = _database.GetOrdersByUsername(CurrUser.Username);
         GuiHelpers.RefreshOrdersPanel(Orders, ordersPanelListView);
     }
     Books = _database.GetBooks();
     GuiHelpers.RefreshBooksPanel(Books, booksPanelListView);
     Requests = _database.GetRequests();
     GuiHelpers.RefreshRequestsPanel(Requests, requestsPanelListView);
 }