Пример #1
0
        public static void getClearedModels(FrmParentScreen parentForm)
        {
            sl = parentForm.SlideMenu1;
            My.MyProject.Forms.FrmEmployeeManagementHP.firstLoad = false;
            userID = My.MyProject.Forms.FrmLoginWindow._userID;
            {
                SlideMenu withBlock = (SlideMenu)sl;
                foreach (DataRow model in db.getClearance(userID, "Main_Menu_Clearance").Rows)
                {
                    if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(model["Home_Page"], true, false)))
                    {
                        withBlock.AddMainMenuOption("Home", "Home", parentForm.MainMenuIconsImageList.Images[0]);
                    }

                    if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(model["Bookings"], true, false)))
                    {
                        withBlock.AddMainMenuOption("Bookings", "Bookings", parentForm.MainMenuIconsImageList.Images[6]);
                        SetBookingModels();
                    }

                    if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(model["Containers"], true, false)))
                    {
                        withBlock.AddMainMenuOption("Containers", "Containers", parentForm.MainMenuIconsImageList.Images[1]);
                        setContainersAllowedModels();
                    }

                    if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(model["Contacts"], true, false)))
                    {
                        withBlock.AddMainMenuOption("Contacts", "Contacts", parentForm.MainMenuIconsImageList.Images[3]);
                        setContactsAllowedModels();
                    }

                    if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(model["Human_Resources"], true, false)))
                    {
                        withBlock.AddMainMenuOption("Human Resources", "HR", parentForm.MainMenuIconsImageList.Images[4]);
                        setHRAllowedModels();
                    }

                    if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(model["Inbound_Cargo"], true, false)))
                    {
                        withBlock.AddMainMenuOption("Inbound Cargo", "Inbound Cargo", parentForm.MainMenuIconsImageList.Images[5]);
                    }

                    if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(model["Truck_Dispatch"], true, false)))
                    {
                        withBlock.AddMainMenuOption("Truck Dispatch", "Dispatch", parentForm.MainMenuIconsImageList.Images[8]);
                        setDispatchAllowedModels();
                    }

                    if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(model["Billing"], true, false)))
                    {
                        withBlock.AddMainMenuOption("Billing", "Billing", parentForm.MainMenuIconsImageList.Images[7]);
                        setBillingModels();
                    }

                    if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(model["Miscellaneous"], true, false)))
                    {
                        withBlock.AddMainMenuOption("Miscellaneous", "Miscellaneous", parentForm.MainMenuIconsImageList.Images[9]);
                        setMiscellaneousAllowedModels();
                    }

                    if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(model["Inventory_Management"], true, false)))
                    {
                        withBlock.AddMainMenuOption("Inventory Management", "Inventory Management", parentForm.MainMenuIconsImageList.Images[11]);
                        SetInventoryMngAllowedModules();
                    }

                    if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(model["Time_Tracker"], true, false)))
                    {
                        withBlock.AddMainMenuOption("Clock In/Out", "Clock In/Out", parentForm.MainMenuIconsImageList.Images[10]);
                    }

                    if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(model["Notifications"], false, false)))
                    {
                        NotificationCenter1.Hide();
                        canSeeNotificationas = false;
                    }
                    else
                    {
                        My.MyProject.Forms.FrmHomePage.actionComboBox1.SelectedIndex = 0;
                        My.MyProject.Forms.FrmHomePage.typeComboBox.SelectedIndex    = 0;
                        getNotifications(Conversions.ToString(My.MyProject.Forms.FrmHomePage.actionComboBox1.SelectedItem), Conversions.ToString(My.MyProject.Forms.FrmHomePage.typeComboBox.SelectedItem), My.MyProject.Forms.FrmHomePage);
                        firstLoad            = false;
                        canSeeNotificationas = true;
                    }
                }

                withBlock.PublishSlideMenu();
            }
        }