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"; } }
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); }