protected override List <CustomCell> GetListViewSubItems(Directive item) { var subItems = new List <CustomCell>(); var author = GlobalObjects.CasEnvironment.GetCorrector(item); ////////////////////////////////////////////////////////////////////////////////////// // Определение последнего выполнения директивы и KitRequiered // ////////////////////////////////////////////////////////////////////////////////////// var lastComplianceDate = DateTimeExtend.GetCASMinDateTime(); var nextComplianceDate = DateTimeExtend.GetCASMinDateTime(); var lastComplianceLifeLength = Lifelength.Zero; var nextComplianceRemain = Lifelength.Null; string lastPerformanceString, firstPerformanceString = "N/A"; DirectiveStatus status = item.Status; //Последнее выполнение if (item.LastPerformance != null && item.LastPerformance.RecordDate > lastComplianceDate) { lastComplianceDate = item.LastPerformance.RecordDate; lastComplianceLifeLength = item.LastPerformance.OnLifelength; } var nextComplianceLifeLength = item.NextPerformanceSource; if (item.NextPerformanceDate != null) { nextComplianceDate = (DateTime)item.NextPerformanceDate; } if (item.Remains != null) { nextComplianceRemain = item.Remains; } if (item.Threshold.FirstPerformanceSinceNew != null && !item.Threshold.FirstPerformanceSinceNew.IsNullOrZero()) { firstPerformanceString = "s/n: " + item.Threshold.FirstPerformanceSinceNew; } if (item.Threshold.FirstPerformanceSinceEffectiveDate != null && !item.Threshold.FirstPerformanceSinceEffectiveDate.IsNullOrZero()) { if (firstPerformanceString != "N/A") { firstPerformanceString += " or "; } else { firstPerformanceString = ""; } firstPerformanceString += "s/e.d: " + item.Threshold.FirstPerformanceSinceEffectiveDate; } var repeatInterval = item.Threshold.RepeatInterval; var kitRequieredString = item.Kits.Count + " kits"; var ndtString = item.NDTType.ShortName; var workType = item.WorkType; var effDate = item.Threshold.EffectiveDate; var manHours = item.ManHours; var cost = item.Cost; var remarksString = item.Remarks; var hiddenRemarksString = item.HiddenRemarks; if (lastComplianceDate <= DateTimeExtend.GetCASMinDateTime()) { lastPerformanceString = "N/A"; } else { lastPerformanceString = lastComplianceLifeLength.ToString(); } var lastDate = (lastComplianceDate <= DateTimeExtend.GetCASMinDateTime()) ? "" : SmartCore.Auxiliary.Convert.GetDateFormat(lastComplianceDate); var titleString = item.Title != "" ? item.Title : "N/A"; var sbString = item.ServiceBulletinNo != "" ? item.ServiceBulletinNo : "N/A"; var eoString = item.EngineeringOrders != "" ? item.EngineeringOrders : "N/A"; var descriptionString = item.Description; var applicabilityString = item.Applicability; var numberString = item is DamageItem ? ((DamageItem)item).Number : ""; var typeString = item is DamageItem ? ((DamageItem)item).DamageType.ToString() : ""; var classString = item is DamageItem ? ((DamageItem)item).DamageClass.ToString() : ""; var locationString = item is DamageItem ? ((DamageItem)item).Location : ""; var sizeString = item is DamageItem ? ((DamageItem)item).Size : ""; var corrective = item is DamageItem ? ((DamageItem)item).CorrectiveAction : ""; var temporaryString = item is DamageItem ? (((DamageItem)item).IsTemporary ? "Yes" : "No") : ""; var ata = item.ATAChapter; var condition = !string.IsNullOrEmpty(firstPerformanceString) ? (item.Threshold.FirstPerformanceConditionType == ThresholdConditionType.WhicheverFirst ? "/WF" : "/WL") : ""; var conditionRepeat = !item.Threshold.RepeatInterval.IsNullOrZero() ? (item.Threshold.RepeatPerformanceConditionType == ThresholdConditionType.WhicheverFirst ? "/WF" : "/WL") : ""; var adColor = radGridView1.ForeColor; var sbColor = radGridView1.ForeColor; var eoColor = radGridView1.ForeColor; if (item.ADNoFile == null) { adColor = Color.MediumVioletRed; } if (item.ServiceBulletinFile == null) { sbColor = Color.MediumVioletRed; } if (item.EngineeringOrderFile == null) { eoColor = Color.MediumVioletRed; } subItems.Add(CreateRow(titleString, titleString, adColor)); subItems.Add(CreateRow(sbString, sbString, sbColor)); subItems.Add(CreateRow(eoString, eoString, eoColor)); subItems.Add(CreateRow(descriptionString, descriptionString)); subItems.Add(CreateRow(corrective, corrective)); subItems.Add(CreateRow(numberString, numberString)); subItems.Add(CreateRow(classString, classString)); subItems.Add(CreateRow(typeString, typeString)); subItems.Add(CreateRow(locationString, locationString)); subItems.Add(CreateRow(sizeString, sizeString)); subItems.Add(CreateRow(applicabilityString, applicabilityString)); subItems.Add(CreateRow(workType.ToString(), workType)); subItems.Add(CreateRow(status.ToString(), status)); subItems.Add(CreateRow(effDate > DateTimeExtend.GetCASMinDateTime() ? SmartCore.Auxiliary.Convert.GetDateFormat(effDate) : "", effDate)); subItems.Add(CreateRow($"{firstPerformanceString} {condition}", firstPerformanceString)); subItems.Add(CreateRow($"{repeatInterval} {conditionRepeat}", repeatInterval)); subItems.Add(CreateRow(SmartCore.Auxiliary.Convert.GetDateFormat(item.NextPerformance?.PerformanceDate), item.NextPerformance?.PerformanceDate)); subItems.Add(CreateRow(item.NextPerformance?.PerformanceSource.ToString(), item.NextPerformance?.PerformanceSource)); subItems.Add(CreateRow(item.NextPerformance?.Remains.ToString(), item.NextPerformance?.Remains)); subItems.Add(CreateRow(item.NextPerformance?.NextLimit.Days != null ? SmartCore.Auxiliary.Convert.GetDateFormat(item.NextPerformance?.NextPerformanceDateNew) : "", item.NextPerformance?.NextPerformanceDateNew)); subItems.Add(CreateRow(item.NextPerformance?.NextLimit.ToString(), item.NextPerformance?.NextLimit.ToString())); subItems.Add(CreateRow(item.NextPerformance?.RemainLimit.ToString(), item.NextPerformance?.RemainLimit.ToString())); subItems.Add(CreateRow(lastDate, lastComplianceDate)); subItems.Add(CreateRow(lastPerformanceString, lastComplianceDate)); subItems.Add(CreateRow(ata.ToString(), ata)); subItems.Add(CreateRow(temporaryString, temporaryString)); subItems.Add(CreateRow(kitRequieredString, kitRequieredString)); subItems.Add(CreateRow(ndtString, ndtString)); subItems.Add(CreateRow(manHours == -1 ? "" : manHours.ToString(), manHours)); subItems.Add(CreateRow(cost == -1 ? "" : cost.ToString(), cost)); subItems.Add(CreateRow(remarksString, remarksString)); subItems.Add(CreateRow(hiddenRemarksString, hiddenRemarksString)); subItems.Add(CreateRow(author, author)); return(subItems); }
/// <summary> /// /// </summary> //protected override void SetGroupsToItems(int columnIndex) //{ //} #endregion #region protected override ListViewItem.ListViewSubItem[] GetListViewSubItems(Procedure item) /// <summary> /// /// </summary> /// <param name="item"></param> /// <returns></returns> protected override List <CustomCell> GetListViewSubItems(Procedure item) { var subItems = new List <CustomCell>(); ////////////////////////////////////////////////////////////////////////////////////// // Определение последнего выполнения директивы и KitRequiered // ////////////////////////////////////////////////////////////////////////////////////// DateTime defaultDateTime = DateTimeExtend.GetCASMinDateTime(); DateTime lastComplianceDate = defaultDateTime; DateTime nextComplianceDate = defaultDateTime; Lifelength lastComplianceLifeLength = Lifelength.Zero; string lastPerformanceString, firstPerformanceString = "N/A"; if (item.LastPerformance != null) { lastComplianceDate = item.LastPerformance.RecordDate; lastComplianceLifeLength = item.LastPerformance.OnLifelength; } if (item.Threshold.FirstPerformanceSinceNew != null && !item.Threshold.FirstPerformanceSinceNew.IsNullOrZero()) { firstPerformanceString = "s/n: " + item.Threshold.FirstPerformanceSinceNew; } if (item.Threshold.FirstPerformanceSinceEffectiveDate != null && !item.Threshold.FirstPerformanceSinceEffectiveDate.IsNullOrZero()) { if (firstPerformanceString != "N/A") { firstPerformanceString += " or "; } else { firstPerformanceString = ""; } firstPerformanceString += "s/e.d: " + item.Threshold.FirstPerformanceSinceEffectiveDate; } //if (item.BindDetailDirectives.Count == 0) //{ if (item.NextPerformanceDate != null && item.NextPerformanceDate > defaultDateTime) { nextComplianceDate = Convert.ToDateTime(item.NextPerformanceDate); } // nextComplianceLifelength = item.NextCompliance; //} //else //{ // DetailDirective firstLimitter = // item.BindDetailDirectives.Where(bdd => bdd.NextComplianceDate != null && // bdd.NextComplianceDate > defaultDateTime) // .OrderBy(d => d) // .FirstOrDefault(); // if (firstLimitter != null) // { // nextComplianceDate = Convert.ToDateTime(firstLimitter.NextComplianceDate); // nextComplianceLifelength = firstLimitter.NextCompliance; // } //} string kitRequieredString = item.Kits.Count + " kits"; string remarksString = item.Remarks; string hiddenRemarksString = item.HiddenRemarks; if (lastComplianceDate <= defaultDateTime) { lastPerformanceString = "N/A"; } else { lastPerformanceString = SmartCore.Auxiliary.Convert.GetDateFormat(lastComplianceDate) + " " + lastComplianceLifeLength; } string nextComplianceString = ((nextComplianceDate <= defaultDateTime) ? "" : SmartCore.Auxiliary.Convert.GetDateFormat(nextComplianceDate) + " ") + item.NextPerformanceSource; string nextRemainString = item.Remains != null && !item.Remains.IsNullOrZero() ? item.Remains.ToString() : "N/A"; ////////////////////////////////////////////////////////////////////////////////////// var author = GlobalObjects.CasEnvironment.GetCorrector(item); string description = item.Description != "" ? item.Description : "N/A"; string title = item.Title != "" ? item.Title : "N/A"; string reqiredDocuments = item.DocumentReferences.Count > 0 ? item.DocumentReferences.Aggregate("", (current, i) => current + (i.Document + "; ")): "N/A"; DirectiveStatus status = item.Status; subItems.Add(CreateRow(title, title)); subItems.Add(CreateRow(description, description)); subItems.Add(CreateRow(item.ProcedureRating.ToString(), item.ProcedureRating)); subItems.Add(CreateRow(item.Level.ToString(), item.Level)); subItems.Add(CreateRow(item.AuditedObject, item.AuditedObject)); subItems.Add(CreateRow(item.ProcedureType.ToString(), item.ProcedureType)); subItems.Add(CreateRow(firstPerformanceString, firstPerformanceString)); subItems.Add(CreateRow(item.Threshold.RepeatInterval.ToString(), item.Threshold.RepeatInterval)); subItems.Add(CreateRow(nextComplianceString, nextComplianceDate)); subItems.Add(CreateRow(nextRemainString, nextRemainString)); subItems.Add(CreateRow(lastPerformanceString, lastComplianceDate)); subItems.Add(CreateRow(status.ToString(), status)); subItems.Add(CreateRow(reqiredDocuments, reqiredDocuments)); subItems.Add(CreateRow(kitRequieredString, kitRequieredString)); subItems.Add(CreateRow(item.ManHours <= 0 ? "" : item.ManHours.ToString(), item.ManHours)); subItems.Add(CreateRow(item.Cost <= 0 ? "" : item.Cost.ToString(), item.Cost)); subItems.Add(CreateRow(remarksString, remarksString)); subItems.Add(CreateRow(hiddenRemarksString, hiddenRemarksString)); subItems.Add(CreateRow(author, author)); return(subItems); }
protected override List <CustomCell> GetListViewSubItems(Directive item) { var subItems = new List <CustomCell>(); var author = GlobalObjects.CasEnvironment.GetCorrector(item); ////////////////////////////////////////////////////////////////////////////////////// // Определение последнего выполнения директивы и KitRequiered // ////////////////////////////////////////////////////////////////////////////////////// var lastComplianceDate = DateTimeExtend.GetCASMinDateTime(); var nextComplianceDate = DateTimeExtend.GetCASMinDateTime(); var lastComplianceLifeLength = Lifelength.Zero; var nextComplianceRemain = Lifelength.Null; string lastPerformanceString, firstPerformanceString = "N/A"; DeferredItem pd = (DeferredItem)item; DirectiveStatus status = pd.Status; DeferredCategory cat = pd.DeferredCategory; ////////////////////////////////////////////////////////////////////////////////////// // Определение последнего выполнения директивы и KitRequiered // ////////////////////////////////////////////////////////////////////////////////////// var par = " §: " + item.Paragraph; //Последнее выполнение if (item.LastPerformance != null && item.LastPerformance.RecordDate > lastComplianceDate) { lastComplianceDate = item.LastPerformance.RecordDate; lastComplianceLifeLength = item.LastPerformance.OnLifelength; } //Следующее выполнение //GlobalObjects.CasEnvironment.Calculator.GetNextPerformance(pd.DirectiveCollection[0]); var nextComplianceLifeLength = item.NextPerformanceSource; if (item.NextPerformanceDate != null) { nextComplianceDate = (DateTime)item.NextPerformanceDate; } if (item.Remains != null) { nextComplianceRemain = item.Remains; } if (item.Threshold.FirstPerformanceSinceNew != null && !item.Threshold.FirstPerformanceSinceNew.IsNullOrZero()) { firstPerformanceString = "s/n: " + item.Threshold.FirstPerformanceSinceNew; } if (item.Threshold.FirstPerformanceSinceEffectiveDate != null && !item.Threshold.FirstPerformanceSinceEffectiveDate.IsNullOrZero()) { if (firstPerformanceString != "N/A") { firstPerformanceString += " or "; } else { firstPerformanceString = ""; } firstPerformanceString += "s/e.d: " + item.Threshold.FirstPerformanceSinceEffectiveDate; } var repeatInterval = item.Threshold.RepeatInterval; var kitRequieredString = item.Kits.Count + " kits"; var ndtString = item.NDTType.ShortName; var workType = item.WorkType; var effDate = item.Threshold.EffectiveDate; var manHours = item.ManHours; var cost = item.Cost; var remarksString = pd.Remarks; var hiddenRemarksString = pd.HiddenRemarks; if (lastComplianceDate <= DateTimeExtend.GetCASMinDateTime()) { lastPerformanceString = "N/A"; } else { lastPerformanceString = lastComplianceLifeLength.ToString(); } var lastDate = (lastComplianceDate <= DateTimeExtend.GetCASMinDateTime()) ? "" : SmartCore.Auxiliary.Convert.GetDateFormat(lastComplianceDate); var titleString = pd.Title != "" ? pd.Title + par : "N/A"; var sbString = pd.ServiceBulletinNo != "" ? pd.ServiceBulletinNo : "N/A"; var eoString = pd.EngineeringOrders != "" ? pd.EngineeringOrders : "N/A"; var descriptionString = pd.Description; var applicabilityString = pd.Applicability; var ata = pd.ATAChapter; var groupName = ""; if (item is DeferredItem) { var aircraft = GlobalObjects.AircraftsCore.GetAircraftById(item.ParentBaseComponent.ParentAircraftId); groupName = $"{aircraft}"; } subItems.Add(CreateRow(groupName, groupName)); subItems.Add(CreateRow(titleString, titleString)); subItems.Add(CreateRow(sbString, sbString)); subItems.Add(CreateRow(eoString, eoString)); subItems.Add(CreateRow(descriptionString, descriptionString)); subItems.Add(CreateRow(applicabilityString, applicabilityString)); subItems.Add(CreateRow(workType.ToString(), workType)); subItems.Add(CreateRow(cat.ToString(), cat)); subItems.Add(CreateRow(status.ToString(), status)); subItems.Add(CreateRow(effDate > DateTimeExtend.GetCASMinDateTime() ? SmartCore.Auxiliary.Convert.GetDateFormat(effDate) : "", effDate)); subItems.Add(CreateRow(SmartCore.Auxiliary.Convert.GetDateFormat(item.NextPerformance?.PerformanceDate), item.NextPerformance?.PerformanceDate)); subItems.Add(CreateRow(item.NextPerformance?.PerformanceSource.ToString(), item.NextPerformance?.PerformanceSource)); subItems.Add(CreateRow(item.NextPerformance?.Remains.ToString(), item.NextPerformance?.Remains)); subItems.Add(CreateRow(item.NextPerformance?.NextLimit.Days != null ? SmartCore.Auxiliary.Convert.GetDateFormat(item.NextPerformance?.NextPerformanceDateNew) : "", item.NextPerformance?.NextPerformanceDateNew)); subItems.Add(CreateRow(item.NextPerformance?.NextLimit.ToString(), item.NextPerformance?.NextLimit.ToString())); subItems.Add(CreateRow(item.NextPerformance?.RemainLimit.ToString(), item.NextPerformance?.RemainLimit.ToString())); subItems.Add(CreateRow(lastDate, lastComplianceDate)); subItems.Add(CreateRow(lastPerformanceString, lastComplianceDate)); subItems.Add(CreateRow(ata.ToString(), ata)); subItems.Add(CreateRow(kitRequieredString, kitRequieredString)); subItems.Add(CreateRow(ndtString, ndtString)); subItems.Add(CreateRow(manHours == -1 ? "" : manHours.ToString(), manHours)); subItems.Add(CreateRow(cost == -1 ? "" : cost.ToString(), cost)); subItems.Add(CreateRow(remarksString, remarksString)); subItems.Add(CreateRow(hiddenRemarksString, hiddenRemarksString)); subItems.Add(CreateRow(author, author)); return(subItems); }
protected override List <CustomCell> GetListViewSubItems(MaintenanceDirective item) { var subItems = new List <CustomCell>(); ////////////////////////////////////////////////////////////////////////////////////// // Определение последнего выполнения директивы и KitRequiered // ////////////////////////////////////////////////////////////////////////////////////// DateTime defaultDateTime = DateTimeExtend.GetCASMinDateTime(); DateTime lastComplianceDate = defaultDateTime; DateTime nextComplianceDate = defaultDateTime; Lifelength lastComplianceLifeLength = Lifelength.Zero; //Lifelength nextComplianceLifelength = Lifelength.Null; string lastPerformanceString, firstPerformanceString = "N/A"; Color tcnColor = radGridView1.ForeColor; Color kitColor = radGridView1.BackColor; AtaChapter ata = item.ATAChapter; if (item.LastPerformance != null) { lastComplianceDate = item.LastPerformance.RecordDate; lastComplianceLifeLength = item.LastPerformance.OnLifelength; } if (item.Threshold.FirstPerformanceSinceNew != null && !item.Threshold.FirstPerformanceSinceNew.IsNullOrZero()) { firstPerformanceString = "s/n: " + item.Threshold.FirstPerformanceSinceNew; } if (item.Threshold.FirstPerformanceSinceEffectiveDate != null && !item.Threshold.FirstPerformanceSinceEffectiveDate.IsNullOrZero()) { if (firstPerformanceString != "N/A") { firstPerformanceString += " or "; } else { firstPerformanceString = ""; } firstPerformanceString += "s/e.d: " + item.Threshold.FirstPerformanceSinceEffectiveDate; } if (item.NextPerformanceDate != null && item.NextPerformanceDate > defaultDateTime) { nextComplianceDate = Convert.ToDateTime(item.NextPerformanceDate); } var author = GlobalObjects.CasEnvironment.GetCorrector(item); string kitRequieredString = item.KitsApplicable ? item.Kits.Count + " EA" : "N/A"; string ndtString = item.NDTType.ShortName; string skillString = item.Skill.ShortName; string categoryString = item.Category.ShortName; string remarksString = item.Remarks; string hiddenRemarksString = item.HiddenRemarks; if (lastComplianceDate <= defaultDateTime) { lastPerformanceString = "N/A"; } else { lastPerformanceString = SmartCore.Auxiliary.Convert.GetDateFormat(lastComplianceDate) + " " + lastComplianceLifeLength; } string nextComplianceString = ((nextComplianceDate <= defaultDateTime) ? "" : SmartCore.Auxiliary.Convert.GetDateFormat(nextComplianceDate) + " ") + item.NextPerformanceSource; string nextRemainString = item.Remains != null && !item.Remains.IsNullOrZero() ? item.Remains.ToString() : "N/A"; var repeat = item.Threshold.RepeatInterval.ToString(); if (item.APUCalc) { firstPerformanceString = firstPerformanceString.Replace("FH", "AH"); repeat = repeat.Replace("FH", "AH"); } ////////////////////////////////////////////////////////////////////////////////////// string description = item.Description != "" ? item.Description : "N/A"; string app = item.IsApplicability ? $"APL {item.Applicability}" : $"N/A {item.Applicability}"; string taskNumber = item.MPDTaskNumber != "" ? item.MPDTaskNumber : "N/A"; string taskCheck = item.TaskNumberCheck != "" ? item.TaskNumberCheck : "N/A"; string maintManual = item.MaintenanceManual != "" ? item.MaintenanceManual : "N/A"; string mrb = item.MRB != "" ? item.MRB : "N/A"; string check = item.MaintenanceCheck != null ? item.MaintenanceCheck.Name : "N/A"; DirectiveStatus status = item.Status; if (item.TaskCardNumberFile == null) { tcnColor = Color.MediumVioletRed; } if (item.KitsApplicable && item.Kits.Count == 0) { kitColor = Color.FromArgb(Highlight.Red.Color); } subItems.Add(CreateRow(item.ParentAircraft?.ToString() ?? "", item.ParentAircraft)); subItems.Add(CreateRow(item.ScheduleItem, item.ScheduleItem)); subItems.Add(CreateRow(taskCheck, taskCheck)); subItems.Add(CreateRow(item.TaskCardNumber, item.TaskCardNumber, tcnColor)); subItems.Add(CreateRow(description, description)); subItems.Add(CreateRow(item.Program.ToString(), item.Program)); subItems.Add(CreateRow(item.ProgramIndicator.ShortName, item.ProgramIndicator)); subItems.Add(CreateRow(item.WorkType.ToString(), item.WorkType)); subItems.Add(CreateRow(check, check)); subItems.Add(CreateRow(item.APUCalc ? "Yes" : "No", item.APUCalc)); subItems.Add(CreateRow(firstPerformanceString, firstPerformanceString)); subItems.Add(CreateRow(repeat, item.Threshold.RepeatInterval)); subItems.Add(CreateRow(nextComplianceString, nextComplianceDate)); subItems.Add(CreateRow(nextRemainString, nextRemainString)); subItems.Add(CreateRow(lastPerformanceString, lastComplianceDate)); subItems.Add(CreateRow(item.Zone, item.Zone)); subItems.Add(CreateRow(item.Workarea, item.Workarea)); subItems.Add(CreateRow(item.Access, item.Access)); subItems.Add(CreateRow(status.ToString(), status)); subItems.Add(CreateRow(taskNumber, taskNumber)); subItems.Add(CreateRow(maintManual, maintManual)); subItems.Add(CreateRow(mrb, mrb)); subItems.Add(CreateRow(item.TaskCardNumber, item.TaskCardNumber)); subItems.Add(CreateRow(item.CriticalSystem.ToString(), item.CriticalSystem)); subItems.Add(CreateRow(ata.ToString(), ata)); subItems.Add(CreateRow(kitRequieredString, kitRequieredString, kitColor)); subItems.Add(CreateRow(ndtString, ndtString)); subItems.Add(CreateRow(skillString, skillString)); subItems.Add(CreateRow(categoryString, categoryString)); subItems.Add(CreateRow(item.Elapsed <= 0 ? "" : item.Elapsed.ToString(), item.Elapsed)); subItems.Add(CreateRow(item.ManHours <= 0 ? "" : item.ManHours.ToString(), item.ManHours)); subItems.Add(CreateRow(item.Cost <= 0 ? "" : item.Cost.ToString(), item.Cost)); subItems.Add(CreateRow(app, app)); subItems.Add(CreateRow(remarksString, remarksString)); subItems.Add(CreateRow(hiddenRemarksString, hiddenRemarksString)); subItems.Add(CreateRow(author, author)); return(subItems); }