protected bool AddNewDetail(bool changePageName) { string message = ""; if (addnewcomponentControl.BaseDetailAddTo == null) { message += "Please choose base component"; } if (generalInformationControl.PartNumber == "") { GetMessage(ref message, "Part Number"); } if (generalInformationControl.SerialNumber == "") { GetMessage(ref message, "Serial Number"); } if (generalInformationControl.ATAChapter == null) { GetMessage(ref message, "ATA Chapter"); } if (message != "") { MessageBox.Show(message, new TermsProvider()["SystemName"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } generalInformationControl.SaveData(addedDetail); warrantyControl.SaveData(addedDetail); if (isStore) { storeControl.SaveData(addedDetail); if (generalInformationControl.ComponentTSNCSN != Lifelength.NullLifelength) { ActualStateRecord record = new ActualStateRecord(); record.RecordDate = generalInformationControl.DateAsOf; record.Lifelength = generalInformationControl.ComponentTSNCSN; addedDetail.AddRecord(record); } } else { parentBaseDetail = addnewcomponentControl.BaseDetailAddTo; parentBaseDetail.Add(addedDetail, "", generalInformationControl.InstallationDate);//todo if (generalInformationControl.ComponentTSNCSN != Lifelength.NullLifelength) { ActualStateRecord record = new ActualStateRecord(); record.RecordDate = generalInformationControl.InstallationDate; record.Lifelength = generalInformationControl.ComponentTSNCSN; addedDetail.AddRecord(record); } if (generalInformationControl.SetActualDataToAircraft) { ActualStateRecord record = new ActualStateRecord(); record.RecordDate = generalInformationControl.InstallationDate; record.Lifelength = generalInformationControl.AircraftTSNCSN; parentBaseDetail.ParentAircraft.AddRecord(record); } if (generalInformationControl.SetCurrentComponentTSNCSN) { ActualStateRecord record = new ActualStateRecord(); record.RecordDate = generalInformationControl.DateAsOf; record.Lifelength = generalInformationControl.AircraftTSNCSN + (generalInformationControl.ComponentCurrentTSNCSN - generalInformationControl.ComponentTSNCSN); parentBaseDetail.ParentAircraft.AddRecord(record); } compliancePerformanceListControl.SaveData(addedDetail); if (addedDetail.GetDetailDirectives().Length > 0 || addedDetail.LifeLimit != Lifelength.NullLifelength) { addedDetail.MaintenanceType = MaintenanceTypeCollection.Instance.HardTimeType; } else { addedDetail.MaintenanceType = MaintenanceTypeCollection.Instance.OnConditionType; } addedDetail.Save(); } return(true); }