Exemplo n.º 1
0
        private void ValidateAllocation()
        {
            int errorCount;

            TaskAllocationController.ValidateAllocations(ConfigurationController, ValdationsController);
            errorCount = ValdationsController.ErrorValidationManager.Errors.Count;

            if (errorCount != 0)
            {
                RenderedErrorText = ErrorDisplay.DisplayText(ValdationsController.ErrorValidationManager);
                errorsToolStripMenuItem.Enabled = true;
            }

            allocationToolStripMenuItem.Enabled = false;
            validateButton.Enabled = false;

            // Display a summary of validations and a set of allocations
            RenderedMainDisplayText  = "";
            RenderedMainDisplayText += ValidationSummaryDisplay.ValidAllocationFile(TaffFilename, ValidTaskAllocation);
            RenderedMainDisplayText += ValidationSummaryDisplay.ValidConfigurationFile(CffFilename, ValidConfiguration);
            RenderedMainDisplayText += ValidationSummaryDisplay.ValidAllocations(errorCount);
            RenderedMainDisplayText += AllocationsDisplay.Display(TaskAllocationController.AllocationDisplays, ConfigurationController);

            mainWebBrowser.DocumentText = RenderedMainDisplayText;
        }
Exemplo n.º 2
0
        private void OpenToolStripMenuItemClick(object sender, EventArgs e)
        {
            int errorCount;

            // Reset
            ValdationsController     = new Validations();
            TaskAllocationController = new TaskAllocation();
            ConfigurationController  = new Configuration();

            errorsToolStripMenuItem.Enabled     = false;
            allocationToolStripMenuItem.Enabled = false;
            validateButton.Enabled  = false;
            RenderedMainDisplayText = "";

            DialogResult dialogResult = openFileDialog.ShowDialog();

            if (dialogResult == DialogResult.OK)
            {
                TaffFilename    = openFileDialog.FileName;
                urlTextBox.Text = TaffFilename;

                // Validate task allocation file and configuration file
                ValidTaskAllocation = TaskAllocationController.ValidateFile(TaffFilename, ValdationsController);
                CffFilename         = TaskAllocationController.CffFilename;
                ValidConfiguration  = ConfigurationController.ValidateFile(CffFilename, ValdationsController);
                TaskAllocationController.CalculateAllocationValues(ConfigurationController);
                errorCount = ValdationsController.ErrorValidationManager.Errors.Count;

                if (ValidTaskAllocation && ValidConfiguration)
                {
                    allocationToolStripMenuItem.Enabled = true;
                    validateButton.Enabled = true;
                }
                else
                {
                    TaskAllocationController.AllocationDisplays = AllocationsDisplay.DisplayInvalidAllocations(TaskAllocationController.AllocationDisplays, TaskAllocationController.AllocationInFileCount);
                }

                if (errorCount != 0)
                {
                    RenderedErrorText = ErrorDisplay.DisplayText(ValdationsController.ErrorValidationManager);
                    errorsToolStripMenuItem.Enabled = true;
                }

                // Display a summary of validations and a set of allocations
                RenderedMainDisplayText += ValidationSummaryDisplay.ValidAllocationFile(TaffFilename, ValidTaskAllocation);
                RenderedMainDisplayText += ValidationSummaryDisplay.ValidConfigurationFile(CffFilename, ValidConfiguration);
                RenderedMainDisplayText += AllocationsDisplay.Display(TaskAllocationController.AllocationDisplays, ConfigurationController);

                mainWebBrowser.DocumentText = RenderedMainDisplayText;
            }
        }