Esempio n. 1
0
        public void ShowUserInfo()
        {
            //load database information for the logged in user and apply to our data grid
            var db  = new InventoryLoad();
            var inv = new Inventory(db.GetGameInformation(), db.GetOrderInformation(), db.GetNotificationInformation(), AccessLevel, CustomerId);

            ProductList = inv.ProductList;
            OrderList   = inv.OrderList;

            var orderData = new BindingList <Orders>(inv.OrderList);

            dataGridOrders.DataSource = orderData;
            dataGridOrders.ReadOnly   = true;

            dataGridOrders.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
        }
        //load database and get all relevant admin information for gui
        public void AdminSetup()
        {
            var db  = new InventoryLoad();
            var inv = new Inventory(db.GetGameInformation(), db.GetOrderInformation(), db.GetNotificationInformation(), AccessLevel, CustomerId);

            ProductList      = inv.ProductList;
            OrderList        = inv.OrderList;
            NotificationList = inv.NotificationList;

            //setup admins notification table
            foreach (var n in NotificationList)
            {
                //if an admin has not yet dismissed notification or duplicate, then display it
                if (!lbNotifications.Items.Contains(n.Message) && !n.Dismissed)
                {
                    lbNotifications.Items.Add(n.Message);
                }
            }

            int totalNotifications = lbNotifications.Items.Count;

            txtNotification.Text = $"Notification Center: {totalNotifications} new notifications waiting for you as of {DateTime.Now.Date.ToString("D")}";

            //show products on admins inventory table
            var productData = new BindingList <Products>(inv.ProductList);

            dataGridInventory.DataSource = productData;
            dataGridInventory.ReadOnly   = true;
            dataGridInventory.ScrollBars = ScrollBars.Vertical;
        }