Beispiel #1
0
 private void managementTabControl_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (managementTabControl.SelectedTab == categoryTabPage)
     {
         currentForm = categoryForm;
     }
     else if (managementTabControl.SelectedTab == firmTabPage)
     {
         currentForm = firmForm;
     }
     else if (managementTabControl.SelectedTab == workTypeTabPage)
     {
         currentForm = workTypeForm;
     }
     else if (managementTabControl.SelectedTab == employeeTabPage)
     {
         currentForm = employeeForm;
     }
     else if (managementTabControl.SelectedTab == clientTabPage)
     {
         currentForm = clientForm;
     }
     else if (managementTabControl.SelectedTab == componentTabPage)
     {
         currentForm = componentForm;
     }
     else if (managementTabControl.SelectedTab == pcTabPage)
     {
         currentForm = pcForm;
     }
     else if (managementTabControl.SelectedTab == orderTabPage)
     {
         currentForm = orderForm;
     }
     else if (managementTabControl.SelectedTab == orderComponentTabPage)
     {
         currentForm = orderComponentForm;
     }
     else if (managementTabControl.SelectedTab == componentOnFirmTabPage)
     {
         currentForm = componentOnFirmForm;
     }
     else if (managementTabControl.SelectedTab == componentInstallTabPage)
     {
         currentForm = componentInstallForm;
     }
     else if (managementTabControl.SelectedTab == statisticTabPage)
     {
         currentForm = statisticForm;
     }
     currentChecker = currentForm.Checker;
     EnableButton(true, true, true, false, false);
     ReadOnlyControls(true);
     currentForm.Init();
 }
Beispiel #2
0
        public MainForm()
        {
            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            InitializeComponent();
            categoryForm         = new CategoryForm(list, nameCategoryField, descriptionCategoryField);
            firmForm             = new FirmForm(list, cityFirmComboBox, addressFirmField, phoneFirmField);
            workTypeForm         = new WorkTypeForm(list, nameWorkTypeField, priceWorkTypeField);
            employeeForm         = new EmployeeForm(list, firstNameEmployeeField, secondNameEmployeeField, phoneEmployeeField, addressEmployeeField, positionEmployeeField, firmEmployeeField, experienceEmployeeField);
            clientForm           = new ClientForm(list, firstNameClientField, lastNameClientField, phoneClientField, addressClientField, registrationDateClientField);
            componentForm        = new ComponentForm(list, nameComponentField, descriptionComponentField, categoryComponentField, producerComponentField, priceComponentField);
            pcForm               = new PCForm(list, namePCField, descriptionPCField, pcTypePCField, producerPCField);
            orderForm            = new OrderForm(list, clientOrderField, employeeOrderField, pcOrderField, creationDateOrderField, isCompleteOrderField);
            orderComponentForm   = new OrderComponentForm(list, componentOrderComponentField, orderOrderComponentField, countOrderComponentField);
            componentOnFirmForm  = new ComponentOnFirmForm(list, componentComponentOnFirmField, firmComponentOnFirmField, countComponentOnFirmField);
            componentInstallForm = new ComponentInstallForm(list, orderComponentComponentInstallField, componentOnFirmComponentInstallField, employeeComponentInstallField, workTypeComponentInstallField, statusComponentInstallField, endWorkDateComponentInstallField, transmissionDateComponentInstallField, beginDateWarrantyComponentInstallField, durationWarrantyComponentInstallField);
            statisticForm        = new StatisticForm(list, firmCountStatisticField, workTypeCountStatisticField, employeeCountStatisticField, clientCountStatisticField, componentCountStatisticField, componentPriceStatisticField, orderCountStatisticField, orderPriceStatisticField);

            var user = programData.CurrentUser;

            if (!categoryForm.Checker.IsVisible(user))
            {
                categoryTabPage.Dispose();
            }
            if (!firmForm.Checker.IsVisible(user))
            {
                firmTabPage.Dispose();
            }
            if (!workTypeForm.Checker.IsVisible(user))
            {
                workTypeTabPage.Dispose();
            }
            if (!employeeForm.Checker.IsVisible(user))
            {
                employeeTabPage.Dispose();
            }
            if (!clientForm.Checker.IsVisible(user))
            {
                clientTabPage.Dispose();
            }
            if (!componentForm.Checker.IsVisible(user))
            {
                componentTabPage.Dispose();
            }
            if (!pcForm.Checker.IsVisible(user))
            {
                pcTabPage.Dispose();
            }
            if (!orderForm.Checker.IsVisible(user))
            {
                orderTabPage.Dispose();
            }
            if (!orderComponentForm.Checker.IsVisible(user))
            {
                orderComponentTabPage.Dispose();
            }
            if (!componentOnFirmForm.Checker.IsVisible(user))
            {
                componentOnFirmTabPage.Dispose();
            }
            if (!componentInstallForm.Checker.IsVisible(user))
            {
                componentInstallTabPage.Dispose();
            }
            if (!statisticForm.Checker.IsVisible(user))
            {
                statisticTabPage.Dispose();
            }

            tabControl1.SelectedTab = managementTabPage;
            managementTabControl_SelectedIndexChanged(new object(), EventArgs.Empty);
            EnableButton(true, true, true, false, false);
        }