/// <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> /// Данные у директивы обновляются по введенным данным /// </summary> /// <param name="destinationDirective">Директива</param> /// <param name="changePageName">Менять ли название вкладки</param> public bool SaveData(BaseDetailDirective destinationDirective, bool changePageName) { textboxDescription.Focus(); if (destinationDirective == null) { throw new ArgumentNullException("destinationDirective"); } if (destinationDirective.Title != textboxTitle.Text) { destinationDirective.Title = textboxTitle.Text; } if (destinationDirective.DamageType != DamageType) { destinationDirective.DamageType = DamageType; } if (destinationDirective.Description != Description) { destinationDirective.Description = Description; } if (destinationDirective.References != InitialDocuments) { destinationDirective.References = InitialDocuments; } if (destinationDirective.Boundery != RequiredInspection) { destinationDirective.Boundery = RequiredInspection; } lifelengthViewerSinceNew.SaveData(destinationDirective.FirstPerformSinceNew); lifelengthViewerRepeatInterval.SaveData(destinationDirective.RepeatPerform); lifelengthViewerNotifyBefore.SaveData(destinationDirective.Notification); //destinationDirective.FirstPerformSinceNew = new Lifelength(RepeatInterval); destinationDirective.RepeatedlyPerform = destinationDirective.RepeatPerform != Lifelength.NullLifelength; if (destinationDirective.Remarks != Remarks) { destinationDirective.Remarks = Remarks; } if (destinationDirective.HiddenRemarks != HiddenRemarks) { destinationDirective.HiddenRemarks = HiddenRemarks; } return(true); }
/// <summary> /// Данные у директивы обновляются по введенным данным /// </summary> /// <param name="destinationDirective">Директива</param> /// <param name="changePageName">Менять ли название вкладки</param> public void SaveData(BaseDetailDirective destinationDirective, bool changePageName) { textboxReqirement.Focus(); if (destinationDirective == null) { throw new ArgumentNullException("destinationDirective"); } if (destinationDirective.Title != Title) { destinationDirective.Title = Title; if (changePageName) { string caption = ""; //if (destinationDirective.Parent.Parent is Aircraft) if (destinationDirective.Parent is BaseDetail) { BaseDetail baseDetail = (BaseDetail)destinationDirective.Parent; if (baseDetail is AircraftFrame) { caption = baseDetail.ParentAircraft.RegistrationNumber + ". " + destinationDirective.DirectiveType.CommonName + ". " + ((destinationDirective.Title.Length > 20) ? destinationDirective.Title.Substring(0, 20) : destinationDirective.Title); } else { caption = baseDetail.ParentAircraft.RegistrationNumber + ". " + baseDetail + ". " + destinationDirective.DirectiveType.CommonName + ". " + ((destinationDirective.Title.Length > 20) ? destinationDirective.Title.Substring(0, 20) : destinationDirective.Title); } } if (DisplayerRequested != null) { DisplayerRequested(this, new ReferenceEventArgs(null, ReflectionTypes.ChangeTextOfContainingDisplayer, caption)); } } } if (destinationDirective.Description != Requirement) { destinationDirective.Description = Requirement; } if (destinationDirective.References != References) { destinationDirective.References = References; } if (destinationDirective.Applicability != TLPNo) { destinationDirective.Applicability = TLPNo; } if (destinationDirective.Remarks != Remarks) { destinationDirective.Remarks = Remarks; } if (destinationDirective.HiddenRemarks != HiddenRemarks) { destinationDirective.HiddenRemarks = HiddenRemarks; } if (destinationDirective.JobCardNo != JobCardNo) { destinationDirective.JobCardNo = JobCardNo; } if (destinationDirective.EngeneeringOrders != EngOrderNo) { destinationDirective.EngeneeringOrders = EngOrderNo; } lifelengthViewerNotifyBefore.SaveData(destinationDirective.Notification); lifelengthViewerFrequency.SaveData(destinationDirective.RepeatPerform); destinationDirective.FirstPerformSinceNew = new Lifelength(lifelengthViewerFrequency.Lifelength); }