/// <summary> /// Создает форму для редактирования Consumable Part / Kit /// </summary> /// <param name="detail">Агрегат</param> public ConsumablePartAndKitForm(AbstractDetail detail) { currentDetail = detail; mode = ScreenMode.Edit; InitializeComponent(); UpdateInformation(); }
/// <summary> /// Возвращает название группы в списке агрегатов текущего склада, согласно тому, какого типа элемент /// </summary> /// <param name="item"></param> /// <returns></returns> public string GetGroupNameInStoreDetailList(object item) { string groupName; if (item is Engine) { groupName = enginesGroupName; } else if (item is APU) { groupName = apuGroupName; } else if (item is GearAssembly) { groupName = landingGearsGroupName; } else { AbstractDetail detail = (AbstractDetail)item; if (detail.DetailPattern == DetailPattern.ConsumablePart) { groupName = consumablePartsGroupName; } else if (detail.DetailPattern == DetailPattern.Kit) { groupName = kitsGroupName; } else { groupName = detail.AtaChapter.ShortName + " " + detail.AtaChapter.FullName; } } return(groupName); }
/// <summary> /// Сохранаяет данные заданного агрегата /// </summary> /// <param name="detail">Агрегат</param> public void SaveData(AbstractDetail detail) { if (CurrentStore.ID != parentStore.ID) { parentStore = CurrentStore; } if (currentDetail != null) { ((Detail)currentDetail).MoveDetail(parentStore, new TransferRecord()); } else { parentStore.Add(detail); } if (textBoxShelfLife.Text != detail.ShelfLife) { detail.ShelfLife = textBoxShelfLife.Text; } if (textBoxLocation.Text != detail.Location) { detail.Location = textBoxLocation.Text; } if (dateTimePickerExpirationDate.Value != detail.ExpirationDate) { detail.ExpirationDate = dateTimePickerExpirationDate.Value; } if (dateTimePickerNotificationDate.Value != detail.NotificationDate) { detail.NotificationDate = dateTimePickerNotificationDate.Value; } }
private void UpdateListOfStoresOfDetail(AbstractDetail detail) { List <Store> stores; if (detail is BaseDetail) { stores = ((Operator)detail.Parent.Parent).Stores; } else { stores = ((Operator)detail.Parent.Parent.Parent).Stores; } comboBoxBaseDetailContainer.Items.Clear(); TransferRecord transferRecord = detail.GetPreLastTransferRecord(); int storeID = transferRecord != null ? transferRecord.TransferContainer != null ? transferRecord.TransferContainer.Id : -1 : -1; int selectedIndex = 0; for (int i = 0; i < stores.Count; i++) { if (currentContainer == null || stores[i].ID != currentContainer.ID) { comboBoxBaseDetailContainer.Items.Add(stores[i]); } if (stores[i].ID == storeID) { selectedIndex = i; } } if (comboBoxBaseDetailContainer.Items.Count > 0) { comboBoxBaseDetailContainer.SelectedIndex = selectedIndex; } }
private void UpdateListOfAircraftsOfDetail(AbstractDetail detail) { List <Aircraft> aircrafts; if (detail is BaseDetail) { aircrafts = ((Operator)detail.Parent.Parent).Aircrafts; } else { aircrafts = ((Operator)detail.Parent.Parent.Parent).Aircrafts; } comboBoxBaseDetailContainer.Items.Clear(); TransferRecord transferRecord = detail.GetPreLastTransferRecord(); int aircraftID = transferRecord != null ? transferRecord.TransferContainer != null ? transferRecord.TransferContainer.Id : -1 : -1; int selectedIndex = 0; for (int i = 0; i < aircrafts.Count; i++) { comboBoxBaseDetailContainer.Items.Add(aircrafts[i]); if (aircrafts[i].ID == aircraftID) { selectedIndex = i; } } if (comboBoxBaseDetailContainer.Items.Count > 0) { comboBoxBaseDetailContainer.SelectedIndex = selectedIndex; } }
/// <summary> /// Добавляет элемент с указанием группы в которой он находится /// </summary> /// <param name="item">Добавляемый элемент</param> protected override ListViewItem AddItem(AbstractDetail item) { string[] itemsString = GetItemString(item); ListViewItem listViewItem = new ListViewItem(itemsString); int hashCode = item.ConditionState.GetHashCode(); listViewItem.BackColor = item.Highlight.Color; if (hashCode == 2 || item.ExpirationDate < DateTime.Now) { listViewItem.BackColor = COLORS[2]; } else if (hashCode == 1 || item.NotificationDate < DateTime.Today) { listViewItem.BackColor = COLORS[1]; } else { listViewItem.BackColor = COLORS[0]; } listViewItem.Tag = item; ItemsHash.Add(item, listViewItem); ListViewItemList.Add(listViewItem); return(listViewItem); }
private void MoveDetailToBaseDetail(AbstractDetail detail) { TransferRecord transferRecord = new TransferRecord(); transferRecord.Description = textBoxRemarks.Text; transferRecord.RecordDate = dateTimePickerDate.Value; transferRecord.Position = textBoxPosition.Text; transferRecord.Reference = textBoxReference.Text; //transferRecord.AttachedFile = fileControl.AttachedFile; if (detail is Detail) { ((Detail)detail).MoveDetail((BaseDetail)comboBoxBaseDetails.SelectedItem, transferRecord); } if (detail is BaseDetail) { ((BaseDetail)detail).MoveBaseDetail(checkedBaseDetailContainer, transferRecord); } if (fileControl.AttachedFile != null) { transferRecord.AttachedFile.FileData = fileControl.AttachedFile.FileData; transferRecord.AttachedFile.FileName = fileControl.AttachedFile.FileName; transferRecord.Save(true); } }
/// <summary> /// Создает форму для добавления ActualStateRecord /// </summary> /// <param name="detail">Агрегат, к которому добавляется запись</param> public ActualStateRecordForm(AbstractDetail detail) { mode = ScreenMode.Add; parentDetail = detail; currentRecord = new ActualStateRecord(); InitializeComponent(); }
/// <summary> /// Сохранаяет данные заданного агрегата /// </summary> /// <param name="detail">Агрегат</param> public void SaveData(AbstractDetail detail) { if (detail == null) { throw new ArgumentNullException("detail"); } if (radioButtonExpires.Checked) { detail.Warranty.Calendar = new TimeSpan(dateTimePickerExpires.Value.Ticks - detail.ManufactureDate.Ticks); /* detail.Warranty.IsCalendarApplicable = true; * detail.Warranty.IsHoursApplicable = false; * detail.Warranty.IsCyclesApplicable = false; * detail.LifelengthDataChanged();*/ } else if (radioButtonOperationalTime.Checked) { lifelengthViewerWarranty.SaveData(detail.Warranty); lifelengthViewerRemains.SaveData(detail.WarrantyRemains); /* detail.Warranty.IsHoursApplicable = true; * detail.Warranty.IsCyclesApplicable = true; * detail.Warranty.IsCalendarApplicable = true; * detail.LifelengthDataChanged();*/ } /* else * { * detail.Warranty.IsHoursApplicable = false; * detail.Warranty.IsCyclesApplicable = false; * detail.Warranty.IsCalendarApplicable = false; * detail.LifelengthDataChanged(); * }*/ }
/// <summary> /// Создает форму для редактирования записи Compliance агрегата /// </summary> /// <param name="detail">Агрегат</param> /// <param name="detailRecord">Transfer Record</param> public TransferRecordForm(AbstractDetail detail, TransferRecord detailRecord) { currentDetail = detail; currentRecord = detailRecord; InitializeComponent(); UpdateInformation(); }
/// <summary> /// Возвращает значение, показывающее были ли изменения в данном элементе управления /// </summary> /// <returns></returns> public bool GetChangeStatus(AbstractDetail detail) { return((CurrentStore.ID != parentStore.ID) || (ShelfLife != detail.ShelfLife) || (Location != detail.Location) || (detail == currentDetail && (ExpirationDate != detail.ExpirationDate || NotificationDate != detail.NotificationDate)) || (detail != currentDetail && (ExpirationDate != initialDateTimeValue || NotificationDate != initialDateTimeValue))); }
/// <summary> /// Создает форму для редактирования ActualStateRecord /// </summary> /// <param name="detailRecord">Актуальное состояние агрегата</param> public ActualStateRecordForm(ActualStateRecord detailRecord) { mode = ScreenMode.Edit; parentDetail = (AbstractDetail)detailRecord.Parent; currentRecord = detailRecord; InitializeComponent(); UpdateInformation(); }
/// <summary> /// Создает форму для отображения информации о <see cref="JobCard"/> /// </summary> /// <param name="detail"></param> public MaintenanceJobCardForm(AbstractDetail detail) { this.detail = detail; mode = ScreenMode.Edit; jobCardControl = new JobCardTabPageControl(detail); InitializeComponent(); UpdateInformation(); }
///<summary> /// Создается элемент отображения агрегата ///</summary> /// <param name="detail">Деталь для отображения</param> public DispatcheredDetailScreen(AbstractDetail detail) : base(detail) { if (detail == null) { throw new ArgumentNullException("detail"); } this.detail = detail; }
/// <summary> /// Создает форму для добавления записи Compliance работе агрегата /// </summary> /// <param name="detail">Агрегат</param> public ComplianceForm(AbstractDetail detail) { currentDetail = detail; currentRecord = new DirectiveRecord(); mode = ScreenMode.Add; InitializeComponent(); UpdateDetailDirectiveList(); UpdateInformation(); }
/// <summary> /// Создает форму для добавления Consumable Part / Kit /// </summary> /// <param name="parentStore">Склад, куда добавляется Consumable Part / Kit</param> public ConsumablePartAndKitForm(Store parentStore) { this.parentStore = parentStore; currentDetail = new DetailReal(); currentDetail.DetailPattern = DetailPattern.ConsumablePart; mode = ScreenMode.Add; InitializeComponent(); UpdateInformation(); }
/// <summary> /// Создает вкладку для привязывания Abstartct Detail к рабочей карте /// </summary> /// <param name="detail"></param> public JobCardTabPageControl(AbstractDetail detail) { this.detail = detail; currentJobCard = new JobCard(); currentJobCard.Date = DateTime.Today; mode = ScreenMode.Add; InitializeComponent(); UpdateInformation(); }
/// <summary> /// Создает элемент управления отображающий listview по заданому массиву технических записей (AbstractRecord) /// </summary> /// <param name="currentDetail">Агрегат, которому принадлежат записи</param> public DetailComplianceListView(AbstractDetail currentDetail) { this.currentDetail = currentDetail; ItemsListView.ForeColor = Css.OrdinaryText.Colors.DarkForeColor; ItemsListView.ColumnClick += ItemsListView_ColumnClick; ItemsListView.MouseDoubleClick += ItemsListView_MouseDoubleClick; ItemsListView.SelectedIndexChanged += ItemsListView_SelectedIndexChanged; ItemsListView.KeyDown += ItemsListView_KeyDown; oldColumnIndex = 0; SetHeaders(); //UpdateItems(); }
/// <summary> /// Создает форму для установки агрегата на ВС /// </summary> public MoveDetailForm(AbstractDetail currentDetail, MoveDetailFormMode mode, Aircraft currentContainer) { this.mode = mode; this.currentContainer = currentContainer; this.currentDetail = currentDetail; if (currentDetail is BaseDetail) { moveBaseDetails = true; } InitializeComponent(); FillComboBoxes(); }
/// <summary> /// Создает элемент управления, использующийся для редактирования Compliance/Performance /// </summary> public DetailCompliancePerformanceListControl(AbstractDetail detail) { currentDetail = detail; if (detail is BaseDetail) { currentAircraft = ((BaseDetail)detail).ParentAircraft; } else { currentAircraft = (Aircraft)detail.Parent.Parent; } InitializeComponent(); UpdateInformation(); }
public EASAControl(AbstractDetail detail, string filter, string description1, string description2, Image icon) { currentDetail = detail; AttachedFile attachedFile = new AttachedFile(); attachedFile.FileData = currentDetail.EASAdata; attachedFile.FileName = "EASA Form 8330.pdf"; AttachedFile = attachedFile; this.filter = filter; this.description1 = description1; this.description2 = description2; this.icon = icon; InitializeComponent(); UpdateInformation(); }
/// <summary> /// Метод возвращает массив агрегатов /// </summary> /// <returns>Массив агрегатов</returns> public override AbstractDetail[] GetItemsArray() { int count = ListViewItemList.Count; AbstractDetail[] returnDetailArray = new AbstractDetail[0]; if (count > 0) { returnDetailArray = new AbstractDetail[count]; for (int i = 0; i < count; i++) { returnDetailArray[i] = (AbstractDetail)ListViewItemList[i].Tag; } } return(returnDetailArray); }
/// <summary> /// Создает элемент управления для отображения информации по складу /// </summary> /// <param name="currentDetail">Агрегат</param> public DetailStoreControl(AbstractDetail currentDetail) { if (null == currentDetail) { throw new ArgumentNullException("currentDetail", "Argument cannot be null"); } this.currentDetail = currentDetail; if (currentDetail is BaseDetail) { parentStore = (Aircraft)currentDetail.Parent; } else { parentStore = (Aircraft)currentDetail.Parent.Parent; } InitializeComponent(); }
/// <summary> /// Создает форму для редактирования записи Compliance директивы /// </summary> /// <param name="directiveRecord">Запись Compliance</param> public ComplianceForm(DirectiveRecord directiveRecord) { mode = ScreenMode.Edit; currentRecord = directiveRecord; if (directiveRecord.Parent is BaseDetailDirective) { currentDirective = (BaseDetailDirective)directiveRecord.Parent; InitializeComponent(); UpdateWorkTypes(); } else { currentDetail = (AbstractDetail)directiveRecord.Parent.Parent; InitializeComponent(); UpdateDetailDirectiveList(); } UpdateInformation(); }
/// <summary> /// Сохранаяет данные заданного агрегата /// </summary> /// <param name="detail">Агрегат</param> public bool SaveData(AbstractDetail detail) { for (int i = 0; i < existPrformances.Count; i++) { if (!existPrformances[i].SaveData()) { return(false); } } for (int i = 0; i < addedPerformances.Count; i++) { if (addedPerformances[i].Interval != Lifelength.NullLifelength) { DetailDirective detailDirective = addedPerformances[i].GetDetailDirective(); detail.AddDetailDirective(detailDirective); if (addedPerformances[i].AddActualStateRecordToDetail) { ActualStateRecord record = new ActualStateRecord(addedPerformances[i].ComponentLastPerformance); record.RecordDate = addedPerformances[i].RecordDate; detail.AddRecord(record); } if (addedPerformances[i].AddActualStateRecordToAircraft) { ActualStateRecord record = new ActualStateRecord(addedPerformances[i].AircraftLastPerformance); record.RecordDate = addedPerformances[i].RecordDate; if (detail is BaseDetail) { ((BaseDetail)detail).ParentAircraft.AddRecord(record); } else { ((Aircraft)detail.Parent.Parent).AddRecord(record); } } } } if (currentDetail != null) { UpdateInformation(); } return(true); }
private void UpdateListOfBaseDetailsOfDetail(AbstractDetail detail) { comboBoxBaseDetails.Items.Clear(); TransferRecord transferRecord = detail.GetPreLastTransferRecord(); int baseDetailID = transferRecord != null ? transferRecord.TransferContainer != null ? transferRecord.TransferContainerId : -1: -1; int selectedIndex = 0; for (int i = 0; i < checkedBaseDetailContainer.BaseDetails.Length; i++) { comboBoxBaseDetails.Items.Add(checkedBaseDetailContainer.BaseDetails[i]); if (checkedBaseDetailContainer.BaseDetails[i].ID == baseDetailID) { selectedIndex = i; } } if (comboBoxBaseDetails.Items.Count > 0) { comboBoxBaseDetails.SelectedIndex = selectedIndex; } }
public override void EditItem(AbstractDetail oldItem, AbstractDetail modifiedItem) { string[] itemsString = GetItemString(modifiedItem); AbstractDetail detail = GetDetailReferenceByDetailID(oldItem.ID); if (detail == null) { return; } ListViewItem listViewItem = ItemsHash[detail]; listViewItem.SubItems.Clear(); listViewItem.Text = itemsString[0]; for (int i = 1; i < itemsString.Length; i++) { listViewItem.SubItems.Add(itemsString[i]); } int hashCode = 1;// modifiedItem.LimitationCondition.GetHashCode(); todo listViewItem.BackColor = modifiedItem.Highlight.Color; if (hashCode == 2 || modifiedItem.ExpirationDate < DateTime.Now) { listViewItem.BackColor = COLORS[2]; } else if (hashCode == 1 || modifiedItem.NotificationDate < DateTime.Today) { listViewItem.BackColor = COLORS[1]; } else { listViewItem.BackColor = COLORS[0]; } listViewItem.Tag = modifiedItem; ItemsHash.Remove(oldItem); ItemsHash.Add(modifiedItem, listViewItem); ItemsListView.Refresh(); SetTotalText(); }
/// <summary> /// Заполняет поля для редактирования агрегата /// </summary> public void UpdateInformation(AbstractDetail detail) { if (detail == null) { throw new ArgumentNullException("detail"); } UpdateRadioButtonsStores(); CurrentStore = parentStore; ShelfLife = detail.ShelfLife; Location = detail.Location; ExpirationDate = currentDetail.ExpirationDate; NotificationDate = detail.NotificationDate; bool permission = (detail.HasPermission(Users.CurrentUser, DataEvent.Update)); for (int i = 0; i < radioButtonsStores.Count; i++) { radioButtonsStores[i].Enabled = permission; } textBoxShelfLife.ReadOnly = !permission; textBoxLocation.ReadOnly = !permission; dateTimePickerExpirationDate.Enabled = permission; dateTimePickerNotificationDate.Enabled = permission; }
/// <summary> /// Сохранаяет данные заданного агрегата /// </summary> /// <param name="detail">Агрегат</param> public void SaveData(AbstractDetail detail) { try { Program.Presenters.DetailsPresenter.SaveGeneralInformationDataWhenDetailAdding( detail, MPDItem, ATAChapter, Description, PartNumber, SerialNumber, Remarks, LifelimitEnabled, LifeLimit); } catch (CoreTypeNullException ex) { Program.Provider.Logger.Log(String.Format("{0} is null", ex.ParamName), ex); } catch (ArgumentException argumentException) { MessageBox.Show( String.Format("{0}", argumentException.Message), new GlobalTermsProvider()["SystemName"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { Program.Provider.Logger.Log("Error while saving data", ex); } }
/// <summary> /// —оздает элемент управлени¤ дл¤ отображени¤ статуса агрегата и ссылок на отчеты /// </summary> public BaseDetailHeaderControl(AbstractDetail detail) { currentDetail = detail; statusLinkLabel = new StatusImageLinkLabel(); checkBoxServiceable = new CheckBox(); if (detail is BaseDetail) { flowLayoutPanelLinks = new BaseDetailLinksFlowLayoutPanel((BaseDetail)detail); } else { flowLayoutPanelLinks = new BaseDetailLinksFlowLayoutPanel(null); } buttonDeleteDetail = new RichReferenceButton(); // // statusLinkLabel // statusLinkLabel.ActiveLinkColor = Color.Black; statusLinkLabel.Enabled = false; statusLinkLabel.HoveredLinkColor = Color.Black; statusLinkLabel.ImageBackColor = Color.Transparent; statusLinkLabel.ImageLayout = ImageLayout.Center; statusLinkLabel.LinkColor = Color.DimGray; statusLinkLabel.LinkMouseCapturedColor = Color.Empty; statusLinkLabel.Size = new Size(350, 27); statusLinkLabel.TextAlign = ContentAlignment.MiddleLeft; statusLinkLabel.TextFont = Css.OrdinaryText.Fonts.RegularFont; // // checkBoxServiceable // checkBoxServiceable.Cursor = Cursors.Hand; checkBoxServiceable.FlatStyle = FlatStyle.Flat; checkBoxServiceable.Font = Css.SimpleLink.Fonts.Font; checkBoxServiceable.ForeColor = Css.SimpleLink.Colors.LinkColor; checkBoxServiceable.Location = new Point(MARGIN, statusLinkLabel.Bottom + HEIGHT_INTERVAL); checkBoxServiceable.Size = new Size(LABEL_WIDTH, LABEL_HEIGHT); checkBoxServiceable.Text = "Serviceable"; // // flowLayoutPanelLinks // flowLayoutPanelLinks.Location = new Point(statusLinkLabel.Right, 0); flowLayoutPanelLinks.Size = new Size(500, 100); // // buttonDeleteDetail // buttonDeleteDetail.Anchor = AnchorStyles.Right | AnchorStyles.Top; buttonDeleteDetail.BackColor = Color.Transparent; buttonDeleteDetail.FontMain = Css.HeaderControl.Fonts.PrimaryFont; buttonDeleteDetail.FontSecondary = Css.HeaderControl.Fonts.PrimaryFont; buttonDeleteDetail.ForeColorMain = Css.HeaderControl.Colors.PrimaryColor; buttonDeleteDetail.ForeColorSecondary = Css.HeaderControl.Colors.PrimaryColor; buttonDeleteDetail.Icon = icons.Delete; buttonDeleteDetail.IconNotEnabled = icons.DeleteGray; buttonDeleteDetail.IconLayout = ImageLayout.Center; buttonDeleteDetail.Name = "buttonDeleteDetail"; buttonDeleteDetail.NormalBackgroundImage = null; buttonDeleteDetail.PaddingMain = new Padding(3, 0, 0, 0); buttonDeleteDetail.ReflectionType = ReflectionTypes.CloseSelected; buttonDeleteDetail.Size = new Size(160, 50); buttonDeleteDetail.TabIndex = 16; buttonDeleteDetail.TextAlignMain = ContentAlignment.MiddleLeft; buttonDeleteDetail.TextAlignSecondary = ContentAlignment.TopLeft; buttonDeleteDetail.TextMain = "Delete"; buttonDeleteDetail.TextSecondary = "component"; buttonDeleteDetail.DisplayerRequested += buttonDeleteDetail_DisplayerRequested; BackColor = Css.CommonAppearance.Colors.BackColor; Controls.Add(statusLinkLabel); Controls.Add(checkBoxServiceable); if (detail is BaseDetail) { Size = new Size(1250, 100); Controls.Add(flowLayoutPanelLinks); } else { Size = new Size(1250, 50); } if (!(detail is AircraftFrame)) { Controls.Add(buttonDeleteDetail); } }