/// <summary> /// Данные у директивы обновляются по введенным данным /// </summary> public void ApplyChanges(MaintenanceDirective directive) { textboxTaskNumberCheck.Focus(); directive.ATAChapter = ATAChapter; if (directive.TaskNumberCheck != TaskNumberCheck) { directive.TaskNumberCheck = TaskNumberCheck; string caption = ""; if (directive.ParentBaseComponent != null) { if (directive.ParentBaseComponent.BaseComponentType == BaseComponentType.Frame) { caption = directive.ParentBaseComponent.GetParentAircraftRegNumber(); } else { if (directive.ParentBaseComponent.ParentAircraftId > 0) { caption = directive.ParentBaseComponent.GetParentAircraftRegNumber() + ". " + directive.ParentBaseComponent; } else { caption = directive.ParentBaseComponent.ToString(); } } caption += ". MPD. " + directive.WorkType.CommonName + ". " + directive.TaskNumberCheck; } if (DisplayerRequested != null) { DisplayerRequested(this, new ReferenceEventArgs(null, ReflectionTypes.ChangeTextOfContainingDisplayer, caption)); } } directive.IsApplicability = checkBoxIsApplicability.Checked; directive.IsOperatorTask = checkBoxOperatorTask.Checked; directive.HiddenRemarks = HiddenRemarks; directive.Threshold.EffectiveDate = EffectiveDate; directive.EngineeringOrders = EngOrderNumber; directive.MPDTaskNumber = textBoxMpdTaskNumber.Text; directive.MaintenanceManual = textBoxMaintenanceManual.Text; directive.Zone = textBoxZone.Text; directive.Access = textBoxAccess.Text; directive.TaskCardNumber = textBoxTaskCardNumber.Text; directive.MRB = textBoxMRB.Text; directive.Applicability = Applicability; if (checkBoxIsApplicability.Checked) { directive.Applicability = directive.Applicability.Replace("APL", "").TrimStart(); } else { directive.Applicability = directive.Applicability.Replace("N/A", "").TrimStart(); } directive.Description = Subject; directive.Remarks = Remarks; directive.CriticalSystem = comboBoxCriticalSystem.SelectedItem as CriticalSystemList; directive.Program = comboBoxProgram.SelectedItem as MaintenanceDirectiveProgramType; directive.ProgramIndicator = comboBoxProgramIndicator.SelectedItem as MaintenanceDirectiveProgramIndicator; directive.JobCard = lookupComboboxJobCard.SelectedItem as JobCard; directive.MpdRef = textBoxMpdRef.Text; directive.MpdRevisionNum = textBoxMpdRevNum.Text; directive.ScheduleRef = textBoxScheuleRef.Text; directive.ScheduleRevisionNum = textBoxScheuleRev.Text; directive.ScheduleItem = textBoxScheduleItem.Text; directive.MpdRevisionDate = dateTimePickerRevDate.Value; directive.ScheduleRevisionDate = dateTimePickerScheuleDate.Value; directive.MpdOldTaskCard = textBoxOldTaslCard.Text; directive.Workarea = textBoxWorkArea.Text; directive.Category = comboBoxCategory.SelectedItem as MpdCategory; if (fileControlTaskNumberCheck.GetChangeStatus()) { fileControlTaskNumberCheck.ApplyChanges(); directive.TaskNumberCheckFile = fileControlTaskNumberCheck.AttachedFile; } if (fileControlEO.GetChangeStatus()) { fileControlEO.ApplyChanges(); directive.EngineeringOrderFile = fileControlEO.AttachedFile; } if (fileControlTaskCardNumber.GetChangeStatus()) { fileControlTaskCardNumber.ApplyChanges(); directive.TaskCardNumberFile = fileControlTaskCardNumber.AttachedFile; } if (fileControlMaintenanceManual.GetChangeStatus()) { fileControlMaintenanceManual.ApplyChanges(); directive.MaintenanceManualFile = fileControlMaintenanceManual.AttachedFile; } if (FileControlMRB.GetChangeStatus()) { FileControlMRB.ApplyChanges(); directive.MRBFile = FileControlMRB.AttachedFile; } }
///<summary> ///Возвращает значение, показывающее были ли изменения в данном элементе управления ///</summary> ///<param name="directive">Директива для которой производится проверка</param> ///<returns></returns> public bool GetChangeStatus(MaintenanceDirective directive) { DateTime oldEffDate = directive.Threshold.EffectiveDate; if (directive.ItemId > 0) { return(ATAChapter != directive.ATAChapter || HiddenRemarks != directive.HiddenRemarks || comboBoxCategory.SelectedItem != directive.Category || TaskNumberCheck != directive.TaskNumberCheck || textBoxMpdTaskNumber.Text != directive.MPDTaskNumber || textBoxMaintenanceManual.Text != directive.MaintenanceManual || textBoxZone.Text != directive.Zone || textBoxAccess.Text != directive.Access || textBoxMpdRef.Text != directive.MpdRef || textBoxMpdRevNum.Text != directive.MpdRevisionNum || checkBoxIsApplicability.Checked != directive.IsApplicability || checkBoxOperatorTask.Checked != directive.IsOperatorTask || textBoxScheuleRef.Text != directive.ScheduleRef || textBoxScheuleRev.Text != directive.ScheduleRevisionNum || comboBoxCriticalSystem.SelectedItem != directive.CriticalSystem || comboBoxProgram.SelectedItem != directive.Program || comboBoxProgramIndicator.SelectedItem != directive.ProgramIndicator || textBoxScheduleItem.Text != directive.ScheduleItem || dateTimePickerEffDate.Value != oldEffDate || EngOrderNumber != directive.EngineeringOrders || textBoxTaskCardNumber.Text != directive.TaskCardNumber || textBoxMRB.Text != directive.MRB || EngOrderNumber != directive.EngineeringOrders || Subject != directive.Description || Remarks != directive.Remarks || Applicability != directive.Applicability || directive.JobCard == null && lookupComboboxJobCard.SelectedItemId > 0 || directive.JobCard != null && lookupComboboxJobCard.SelectedItemId != directive.JobCard.ItemId || fileControlEO.GetChangeStatus() || fileControlTaskNumberCheck.GetChangeStatus() || fileControlMaintenanceManual.GetChangeStatus() || fileControlTaskCardNumber.GetChangeStatus() || FileControlMRB.GetChangeStatus()); } return(ATAChapter != null || Paragraph != "" || TaskNumberCheck != "" || textBoxMpdTaskNumber.Text != "" || textBoxMaintenanceManual.Text != "" || textBoxMpdTaskNumber.Text != "" || textBoxTaskCardNumber.Text != "" || textBoxMpdRef.Text != "" || textBoxMpdRevNum.Text != "" || textBoxScheuleRef.Text != "" || textBoxScheuleRev.Text != "" || textBoxZone.Text != "" || textBoxAccess.Text != "" || dateTimePickerEffDate.Value.Date != DateTime.Today || EngOrderNumber != "" || References != "" || Applicability != "" || BiWeeklyReport != "" || Subject != "" || Applicability != "" || Remarks != "" || comboBoxCriticalSystem.SelectedItem != null || comboBoxProgramIndicator.SelectedItem != null || comboBoxProgram.SelectedItem != null || fileControlTaskNumberCheck.GetChangeStatus() || fileControlEO.GetChangeStatus() || fileControlMaintenanceManual.GetChangeStatus() || FileControlMRB.GetChangeStatus() || fileControlTaskCardNumber.GetChangeStatus()); }