示例#1
0
        private void resizeMainPanel(Panel panel)
        {
            Reposition.setControl(panel, BUTTON_PANEL_WIDTH, .95, .1, .95);
            //fetches method for seting up the panel from dictionary
            setupDelegate setupMethod;

            setupPanels.TryGetValue(panel, out setupMethod);
            setupMethod();
        }
示例#2
0
        public void setupAdminPnl()
        {
            //fill the data tables with info
            if (isFirstSetup)
            {
                try
                {
                    admin1Data.DataSource = EmployeesTable.getAll();
                    admin1Data.Columns["password"].Visible = false;
                    admin1Data.Columns["deleted"].Visible  = false;

                    admin2Data.DataSource = CustomersTable.getAll();
                    admin2Data.Columns["deleted"].Visible = false;

                    admin3Data.DataSource = MoviesTable.getAll();
                    admin3Data.Columns["deleted"].Visible = false;
                    sortBy(admin3Data, 1, true);

                    admin4Data.DataSource = CopiesTable.getAll();
                    admin4Data.Columns["deleted"].Visible = false;
                    sortBy(admin4Data, 0, true);
                }catch
                {
                    EmployeesTable.adapter.Dispose();
                    CustomersTable.adapter.Dispose();
                    MoviesTable.adapter.Dispose();
                    CopiesTable.adapter.Dispose();
                    Prompt.dbError();
                }
            }

            Reposition.setControl(adminTitleLbl, .4, .7, 0, .1);

            Reposition.setControl(adminTab, .1, .9, .1, .9);

            Reposition.setNestedControlPosition(admin1Data, .05, .95, 0, .8);
            Reposition.setNestedControlPosition(admin2Data, .05, .95, 0, .8);
            Reposition.setNestedControlPosition(admin3Data, .05, .95, 0, .8);
            Reposition.setNestedControlPosition(admin4Data, .05, .95, 0, .8);

            //user Buttons
            Reposition.setNestedControlLocation(admin1Btn, .1, .85);
            Reposition.setNestedControlLocation(adminPasswordBtn, .4, .85);
            Reposition.setNestedControlLocation(admin2Btn, .7, .85);

            //customer buttons
            Reposition.setNestedControlLocation(admin3Btn, .3, .85);
            Reposition.setNestedControlLocation(admin4Btn, .6, .85);

            //movie buttons
            Reposition.setNestedControlLocation(admin5Btn, .3, .85);
            Reposition.setNestedControlLocation(admin6Btn, .6, .85);

            //upc buttons
            Reposition.setNestedControlLocation(admin7Btn, .3, .85);
            Reposition.setNestedControlLocation(admin8Btn, .6, .85);
        }
示例#3
0
        public void setupReportsPnl()
        {
            if (isFirstSetup)
            {
                try
                {
                    reports1Data.DataSource = MoviesTable.getAll();
                    reports1Data.Columns["deleted"].Visible = false;
                    sortBy(reports1Data, 5, false);

                    reports2Data.DataSource = CustomersTable.getAll();
                    reports2Data.Columns["deleted"].Visible = false;
                    sortBy(reports2Data, 7, false);

                    reports3Data.DataSource = MoviesTable.getAll();
                    reports3Data.Columns["deleted"].Visible = false;
                    sortBy(reports3Data, 1, true);

                    reports4Data.DataSource = RentalsTable.getNotReturned();
                    reports4Data.Columns["returned"].Visible = false;
                    sortBy(reports4Data, 4, true);

                    reports5Data.DataSource = RentalsTable.getLateMovies();
                    reports5Data.Columns["returned"].Visible = false;
                    sortBy(reports5Data, 4, true);

                    reports6Data.DataSource = CopiesTable.getAll();
                    reports6Data.Columns["deleted"].Visible = false;
                    sortBy(reports6Data, 0, true);
                }catch
                {
                    CustomersTable.adapter.Dispose();
                    MoviesTable.adapter.Dispose();
                    RentalsTable.adapter.Dispose();
                    CopiesTable.adapter.Dispose();
                    Prompt.dbError();
                }
            }

            Reposition.setControl(reportsTitleLbl, .4, .7, 0, .1);

            Reposition.setControl(reportsTab, .1, .9, .1, .9);

            Reposition.setNestedControlPosition(reports1Data, .05, .95, 0, 1);
            Reposition.setNestedControlPosition(reports2Data, .05, .95, 0, 1);
            Reposition.setNestedControlPosition(reports3Data, .05, .95, 0, 1);
            Reposition.setNestedControlPosition(reports4Data, .05, .95, 0, 1);
            Reposition.setNestedControlPosition(reports5Data, .05, .95, 0, 1);
            Reposition.setNestedControlPosition(reports6Data, .05, .95, 0, 1);
        }
示例#4
0
        public void setupReturnPnl()
        {
            Panel  panel = returnPnl;
            double endOfText;
            double endOfLabels;

            setEnterKey(return1Btn);

            Reposition.setControl(returnTitleLbl, .4, .7, 0, .1);

            endOfLabels = Reposition.setLabels(0.2, return1Lbl);
            endOfText   = Reposition.setTextBoxes(0.2, return1Txt);

            Reposition.setControlLocation(return1Btn, .4, endOfText);
        }
示例#5
0
        /// <summary>
        /// Sets the position of all components within the form based on percent relative locations
        /// </summary>
        private void resizePage()
        {
            Reposition.setControl(mainButtonPnl, 0, BUTTON_PANEL_WIDTH, .1, .95);

            resizeMainPanel(currentMainPanel);

            if (currentUser.isAdmin())
            {
                Button[] mainButtons = { rentBtn, returnBtn, reportsBtn, adminBtn };
                Reposition.setVertically(mainButtons, mainButtonPnl);
            }
            else
            {
                Button[] mainButtons = { rentBtn, returnBtn, reportsBtn, newCustomerBtn };
                Reposition.setVertically(mainButtons, mainButtonPnl);
            }
        }