Ejemplo n.º 1
0
        public void Reload_Form()
        {
            books = SqliteDataAccess.LoadBooks();
            bunifuCustomDataGrid1.DataSource         = books;
            bunifuCustomDataGrid1.Columns[0].Visible = false;
            bunifuCustomDataGrid1.Columns[5].Visible = false;
            bunifuCustomDataGrid1.Size = new Size(910, 450);

            if (currCustomer == null)
            {
                logoutBtn.Visible            = false;
                panel1.Visible               = true;
                loginBtn.Visible             = true;
                helloLabel.Visible           = false;
                adminAddBookGroupBox.Visible = false;
                addToBusketGroupBox.Visible  = false;

                hello2Label.Text = "Вітаю! Будь ласка авторизуйтесь";
            }
            else
            {
                logoutBtn.Visible  = true;
                panel1.Visible     = false;
                loginBtn.Visible   = false;
                helloLabel.Visible = true;

                helloLabel.Text  = "Привіт, " + currCustomer.Name;
                hello2Label.Text = "Привіт, " + currCustomer.Name;

                if (currCustomer.Login.Equals("admin"))
                {
                    adminAddBookGroupBox.Visible = true;
                    addToBusketGroupBox.Visible  = false;
                    tabPage3.Text = "Замовлення";

                    ordersKek = SqliteDataAccess.LoadOrders();
                    ordersDataGrid.DataSource = ordersKek;

                    orderBookModels = SqliteDataAccess.LoadInfoAboutOrdered();
                    orderBookBataGrid.DataSource = orderBookModels;

                    busketGroupBox.Visible = false;
                    ordersGroupBox.Visible = true;

                    bunifuCustomDataGrid1.Columns[0].Visible = true;
                    bunifuCustomDataGrid1.Columns[5].Visible = true;

                    bunifuCustomDataGrid1.Size = new Size(910, 330);
                }
                else
                {
                    busketGroupBox.Visible = true;
                    ordersGroupBox.Visible = false;
                    tabPage3.Text          = "Кошик";


                    adminAddBookGroupBox.Visible = false;
                    addToBusketGroupBox.Visible  = true;
                    bunifuCustomDataGrid1.Size   = new Size(910, 350);
                }
            }
        }