private void SetRightsToControls() { bool temp = DetailCollection.HasAccess(Users.CurrentUser.Role, DataEvent.Create); buttonAddDetail.Enabled = temp; toolStripMenuItemAdd.Enabled = temp; headerControl1.ActionControl.ShowEditButton = DetailCollection.HasAccess(Users.CurrentUser.Role, DataEvent.Update); }
///<summary> /// Создаёт элемент управления для отображения списка рабочих пакетов ///</summary> ///<param name="currentAircraft">ВС, которому принадлежат рабочие пакеты</param> public WorkPackagesListScreen(Aircraft currentAircraft) { if (currentAircraft == null) { throw new ArgumentNullException("currentAircraft"); } this.currentAircraft = currentAircraft; permissionForCreate = DetailCollection.HasAccess(Users.CurrentUser.Role, DataEvent.Create); permissionForDelete = DetailCollection.HasAccess(Users.CurrentUser.Role, DataEvent.Remove); permissionForUpdate = DetailCollection.HasAccess(Users.CurrentUser.Role, DataEvent.Update); ((DispatcheredWorkPackagesListScreen)this).InitComplition += WorkPackagesListScreen_InitComplition; currentAircraft.WorkPackageRemoved += CurrentAircraft_WorkPackageRemoved; currentAircraft.WorkPackageAdded += CurrentAircraft_WorkPackageAdded; InitializeComponent(); UpdateElements(); }
private void SetContextMenuParameters(int count) { bool temp = DirectiveCollection.HasAccess(Users.CurrentUser.Role, DataEvent.Create) && (count == 1); toolStripMenuItemInspection.Enabled = temp; toolStripMenuItemHotSectionInspection.Enabled = temp; toolStripMenuItemOverhaul.Enabled = temp; toolStripMenuItemShopVisit.Enabled = temp; toolStripMenuItemTitle.Enabled = count > 0; headerControl1.ActionControl.ButtonEdit.Enabled = (count == 1); buttonDeleteSelected.Enabled = DetailCollection.HasAccess(Users.CurrentUser.Role, DataEvent.Remove) && (count > 0); toolStripMenuItemDelete.Enabled = buttonDeleteSelected.Enabled; }
private ContextMenuStrip CreateContextMenuToLandingGear(TemplateGearAssembly gearAssembly) { ContextMenuStrip contextMenuStrip = new ContextMenuStrip(); ToolStripMenuItem titleToolStripMenuItem = new ToolStripMenuItem(); ToolStripMenuItem addComponentToolStripMenuItem1 = new ToolStripMenuItem(); ToolStripMenuItem deleteToolStripMenuItem = new ToolStripMenuItem(); ToolStripSeparator toolStripSeparator1 = new ToolStripSeparator(); // // titleToolStripMenuItem // titleToolStripMenuItem.Text = gearAssembly.ToString(); titleToolStripMenuItem.Click += titleToolStripMenuItem_Click; // // addComponentToolStripMenuItem1 // addComponentToolStripMenuItem1.Text = "Add component"; addComponentToolStripMenuItem1.Click += addComponentToolStripMenuItem1_Click; // // deleteToolStripMenuItem // deleteToolStripMenuItem.Text = "Delete"; deleteToolStripMenuItem.Click += deleteToolStripMenuItem_Click; // // LandingGearsButtonsControl // addComponentToolStripMenuItem1.Enabled = DetailCollection.HasAccess(Users.CurrentUser.Role, DataEvent.Create); deleteToolStripMenuItem.Enabled = BaseDetailCollection.HasAccess(Users.CurrentUser.Role, DataEvent.Remove); contextMenuStrip.Items.AddRange(new ToolStripItem[] { titleToolStripMenuItem, toolStripSeparator1, addComponentToolStripMenuItem1, deleteToolStripMenuItem }); return(contextMenuStrip); }
private void InitializeComponent() { splitContainer = new SplitContainer(); contentPanel = new BaseDetailLinksFlowLayoutPanel(currentBaseDetail); contextMenuStrip1 = new ContextMenuStrip(); titleToolStripMenuItem = new ToolStripMenuItem(); registerToolStripMenuItem = new ToolStripMenuItem(); overhaulToolStripMenuItem = new ToolStripMenuItem(); inspectionToolStripMenuItem = new ToolStripMenuItem(); shopVisitToolStripMenuItem = new ToolStripMenuItem(); hotSectionInspectionToolStripMenuItem = new ToolStripMenuItem(); logBookToolStripMenuItem = new ToolStripMenuItem(); addComponentToolStripMenuItem1 = new ToolStripMenuItem(); aDStatusToolStripMenuItem = new ToolStripMenuItem(); ToolStripMenuItemLLPDiskSheet = new ToolStripMenuItem(); deleteToolStripMenuItem = new ToolStripMenuItem(); discrepanciesToolStripMenuItem = new ToolStripMenuItem(); sBStatusToolStripMenuItem = new ToolStripMenuItem(); engeneeringOrdersToolStripMenuItem = new ToolStripMenuItem(); toolStripMenuItemMoveToStore = new ToolStripMenuItem(); toolStripSeparator1 = new ToolStripSeparator(); toolStripSeparator2 = new ToolStripSeparator(); toolStripSeparator3 = new ToolStripSeparator(); toolStripSeparator4 = new ToolStripSeparator(); // // titleToolStripMenuItem // titleToolStripMenuItem.Text = "[Title]"; titleToolStripMenuItem.Click += titleToolStripMenuItem_Click; // // registerToolStripMenuItem // registerToolStripMenuItem.Text = "Register"; // // overhaulToolStripMenuItem // overhaulToolStripMenuItem.Text = "Overhaul"; overhaulToolStripMenuItem.Click += overhaulToolStripMenuItem_Click; // // inspectionToolStripMenuItem // inspectionToolStripMenuItem.Text = "Inspection"; inspectionToolStripMenuItem.Click += inspectionToolStripMenuItem_Click; // // shopVisitToolStripMenuItem // shopVisitToolStripMenuItem.Text = "Shop visit"; shopVisitToolStripMenuItem.Click += shopVisitToolStripMenuItem_Click; // // hotSectionInspectionToolStripMenuItem // hotSectionInspectionToolStripMenuItem.Text = "Hot section inspection"; hotSectionInspectionToolStripMenuItem.Click += hotSectionInspectionToolStripMenuItem_Click; // // logBookToolStripMenuItem // logBookToolStripMenuItem.Text = "Log book"; logBookToolStripMenuItem.Click += logBookToolStripMenuItem_Click; // // addComponentToolStripMenuItem1 // addComponentToolStripMenuItem1.Text = "Add component"; addComponentToolStripMenuItem1.Click += addComponentToolStripMenuItem1_Click; // // aDStatusToolStripMenuItem // aDStatusToolStripMenuItem.Text = "AD Status"; aDStatusToolStripMenuItem.Click += aDStatusToolStripMenuItem_Click; // // ToolStripMenuItemLLPDiskSheet // ToolStripMenuItemLLPDiskSheet.Text = "LLP Disk Sheet Status"; ToolStripMenuItemLLPDiskSheet.Click += toolStripMenuItemLLPDiskSheet_Click; // // deleteToolStripMenuItem // deleteToolStripMenuItem.Text = "Delete"; deleteToolStripMenuItem.Click += deleteToolStripMenuItem_Click; // // discrepanciesToolStripMenuItem // discrepanciesToolStripMenuItem.Text = "Discrepancies"; discrepanciesToolStripMenuItem.Click += discrepanciesToolStripMenuItem_Click; // // sBStatusToolStripMenuItem // sBStatusToolStripMenuItem.Text = "SB Status"; sBStatusToolStripMenuItem.Click += sBStatusToolStripMenuItem_Click; // // engeneeringOrdersToolStripMenuItem // engeneeringOrdersToolStripMenuItem.Text = "Engineering Orders Status"; engeneeringOrdersToolStripMenuItem.Click += engeneeringOrdersToolStripMenuItem_Click; // // engeneeringOrdersToolStripMenuItem // toolStripMenuItemMoveToStore.Text = "Move to Store"; toolStripMenuItemMoveToStore.Click += toolStripMenuItemMoveToStore_Click; // // baseDetailButton // baseDetailButton.ActiveColor = Css.BaseDetailInfoControl.Colors.InactiveTopColorHovered; baseDetailButton.ExtendedColor = Css.BaseDetailInfoControl.Colors.InactiveBottomColor; baseDetailButton.Font = Css.BaseDetailInfoControl.Fonts.PrimaryFont; baseDetailButton.ForeColor = Css.BaseDetailInfoControl.Colors.PrimaryForeColor; baseDetailButton.Icon = new Icons().GrayArrow; baseDetailButton.MouseDownColor = Css.BaseDetailInfoControl.Colors.InactiveTopColorPressed; baseDetailButton.NormalColor = Css.BaseDetailInfoControl.Colors.InactiveTopColor; baseDetailButton.ReflectionType = ReflectionTypes.DisplayInNew; baseDetailButton.SecondFont = Css.BaseDetailInfoControl.Fonts.SecondaryFont; baseDetailButton.SecondForeColor = Css.BaseDetailInfoControl.Colors.SecondaryForeColor; baseDetailButton.SecondTextAlign = ContentAlignment.TopLeft; baseDetailButton.SecondTextPadding = new Padding(10, 0, 0, 0); baseDetailButton.Size = new Size(235, 90); baseDetailButton.TextAlign = ContentAlignment.TopLeft; baseDetailButton.TextPadding = new Padding(0, 6, 0, 0); baseDetailButton.SecondaryTextPosition = 44; baseDetailButton.DisplayerRequested += aircraftButton_DisplayerRequested; baseDetailButton.ContextMenuStrip = contextMenuStrip1; // // splitter // splitContainer.Dock = DockStyle.Fill; splitContainer.Location = new Point(0, 0); splitContainer.Name = "splitter"; splitContainer.IsSplitterFixed = true; splitContainer.SplitterDistance = 230; // // paddingPanel // paddingPanel = new Panel(); paddingPanel.Size = new Size(0, 0); paddingPanel.Dock = DockStyle.Top; paddingPanel.BringToFront(); // // splitter.Panel1 // splitContainer.Panel1.Controls.Add(baseDetailButton); splitContainer.Panel2.BackColor = Color.Transparent; // // splitter.Panel2 // splitContainer.Panel2.Controls.Add(contentPanel); splitContainer.Panel2.Controls.Add(paddingPanel); splitContainer.Panel2.BackColor = Color.Transparent; //this.splitContainer.Size = new System.Drawing.Size(641, 100); splitContainer.TabIndex = 0; // // contentPanel // contentPanel.AutoSize = true; contentPanel.Dock = DockStyle.Top; contentPanel.Location = new Point(0, 0); contentPanel.Name = "contentPanel"; contentPanel.TabIndex = 0; contentPanel.SizeChanged += contentPanel_SizeChanged; // // BaseDetailControl // Controls.Add(splitContainer); Size = defaultSize; registerToolStripMenuItem.Enabled = DirectiveCollection.HasAccess(Users.CurrentUser.Role, DataEvent.Create); addComponentToolStripMenuItem1.Enabled = DetailCollection.HasAccess(Users.CurrentUser.Role, DataEvent.Create); deleteToolStripMenuItem.Enabled = BaseDetailCollection.HasAccess(Users.CurrentUser.Role, DataEvent.Remove); // // BaseDetailControl // registerToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { overhaulToolStripMenuItem, inspectionToolStripMenuItem, shopVisitToolStripMenuItem, hotSectionInspectionToolStripMenuItem }); contextMenuStrip1.Items.AddRange(new ToolStripItem[] { titleToolStripMenuItem, toolStripSeparator1, logBookToolStripMenuItem, registerToolStripMenuItem, toolStripSeparator3, aDStatusToolStripMenuItem, discrepanciesToolStripMenuItem, engeneeringOrdersToolStripMenuItem, ToolStripMenuItemLLPDiskSheet, sBStatusToolStripMenuItem, toolStripSeparator2, toolStripMenuItemMoveToStore, toolStripSeparator4, addComponentToolStripMenuItem1, deleteToolStripMenuItem }); baseDetailButton.ContextMenuStrip = contextMenuStrip1; if (currentBaseDetail is Engine) { baseDetailButton.Text = currentBaseDetail.DetailType.ShortName + " " + currentBaseDetail.PositionNumber; } else { hotSectionInspectionToolStripMenuItem.Visible = false; ToolStripMenuItemLLPDiskSheet.Visible = false; baseDetailButton.Text = currentBaseDetail.DetailType.ShortName; if (currentBaseDetail is AircraftFrame) { toolStripSeparator4.Visible = false; toolStripMenuItemMoveToStore.Visible = false; } } }
private void CheckPermission() { permissionForCreate = DetailCollection.HasAccess(Users.CurrentUser.Role, DataEvent.Create); permissionForDelete = DetailCollection.HasAccess(Users.CurrentUser.Role, DataEvent.Remove); permissionForUpdate = DetailCollection.HasAccess(Users.CurrentUser.Role, DataEvent.Update); }
private ContextMenuStrip CreateContextMenuToLandingGear(GearAssembly gearAssembly) { ContextMenuStrip contextMenuStrip = new ContextMenuStrip(); ToolStripMenuItem titleToolStripMenuItem = new ToolStripMenuItem(); ToolStripMenuItem registerToolStripMenuItem = new ToolStripMenuItem(); ToolStripMenuItem inspectionToolStripMenuItem = new ToolStripMenuItem(); ToolStripMenuItem logBookToolStripMenuItem = new ToolStripMenuItem(); ToolStripMenuItem addComponentToolStripMenuItem1 = new ToolStripMenuItem(); ToolStripMenuItem deleteToolStripMenuItem = new ToolStripMenuItem(); ToolStripMenuItem toolStripMenuItemMoveToStore = new ToolStripMenuItem(); ToolStripSeparator toolStripSeparator1 = new ToolStripSeparator(); ToolStripSeparator toolStripSeparator2 = new ToolStripSeparator(); ToolStripSeparator toolStripSeparator3 = new ToolStripSeparator(); // // titleToolStripMenuItem // titleToolStripMenuItem.Text = gearAssembly.ToString(); titleToolStripMenuItem.Click += titleToolStripMenuItem_Click; // // registerToolStripMenuItem // registerToolStripMenuItem.Text = "Register"; // // inspectionToolStripMenuItem // inspectionToolStripMenuItem.Text = "Inspection"; inspectionToolStripMenuItem.Tag = gearAssembly; inspectionToolStripMenuItem.Click += inspectionToolStripMenuItem_Click; // // logBookToolStripMenuItem // logBookToolStripMenuItem.Text = "Log book"; logBookToolStripMenuItem.Click += logBookToolStripMenuItem_Click; // // addComponentToolStripMenuItem1 // addComponentToolStripMenuItem1.Text = "Add component"; addComponentToolStripMenuItem1.Click += addComponentToolStripMenuItem1_Click; // // deleteToolStripMenuItem // deleteToolStripMenuItem.Text = "Delete"; deleteToolStripMenuItem.Click += deleteToolStripMenuItem_Click; // // engeneeringOrdersToolStripMenuItem // toolStripMenuItemMoveToStore.Text = "Move to Store"; toolStripMenuItemMoveToStore.Click += toolStripMenuItemMoveToStore_Click; // // LandingGearsButtonsControl // registerToolStripMenuItem.Enabled = DirectiveCollection.HasAccess(Users.CurrentUser.Role, DataEvent.Create); addComponentToolStripMenuItem1.Enabled = DetailCollection.HasAccess(Users.CurrentUser.Role, DataEvent.Create); deleteToolStripMenuItem.Enabled = BaseDetailCollection.HasAccess(Users.CurrentUser.Role, DataEvent.Remove); registerToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { inspectionToolStripMenuItem, }); contextMenuStrip.Items.AddRange(new ToolStripItem[] { titleToolStripMenuItem, toolStripSeparator1, logBookToolStripMenuItem, registerToolStripMenuItem, toolStripSeparator2, toolStripMenuItemMoveToStore, toolStripSeparator3, addComponentToolStripMenuItem1, deleteToolStripMenuItem }); return(contextMenuStrip); }