protected override void SetRowCellsValues(DataGridViewRow row, BaseEntityObject item) { AtaChapter ataChapter = null; string title = ""; string description = ""; //string zone = ""; //string access = ""; string taskType = ""; MaintenanceDirectiveProgramType program = MaintenanceDirectiveProgramType.Unknown; StaticDictionary workType = null; //string phase = ""; double manHours = 0; int mans = 0; string categories = ""; double cost = 0; string kits = ""; //Lifelength performance = Lifelength.Null; //Lifelength repeat = Lifelength.Null; //Lifelength remain = Lifelength.Null; //DateTime? performanceDate = null; if (item is NextPerformance) { NextPerformance np = (NextPerformance)item; IEngineeringDirective engineeringDirective = np.Parent as IEngineeringDirective; if (engineeringDirective != null) { ataChapter = engineeringDirective.ATAChapter; //zone = engineeringDirective.Zone; //access = engineeringDirective.Access; program = engineeringDirective.Program; workType = engineeringDirective.WorkType; //phase = engineeringDirective.Phase; manHours = engineeringDirective.ManHours; mans = engineeringDirective.Mans; categories = engineeringDirective.CategoriesRecords.Aggregate("", (current, i) => current + (i.AircraftWorkerCategory + "; ")); cost = engineeringDirective.Cost; } title = np.Title; description = np.Description; taskType = np.Parent.SmartCoreObjectType.ToString(); kits = np.KitsToString; //performance = np.PerformanceSource; //repeat = np.Parent.Threshold != null ? np.Parent.Threshold.RepeatInterval : Lifelength.Null; //remain = np.Remains; //performanceDate = np.PerformanceDate; } else if (item is AbstractPerformanceRecord) { //DirectiveRecord directiveRecord = (DirectiveRecord)item; AbstractPerformanceRecord apr = (AbstractPerformanceRecord)item; IEngineeringDirective engineeringDirective = apr.Parent as IEngineeringDirective; if (engineeringDirective != null) { ataChapter = engineeringDirective.ATAChapter; //zone = engineeringDirective.Zone; //access = engineeringDirective.Access; program = engineeringDirective.Program; workType = engineeringDirective.WorkType; //phase = engineeringDirective.Phase; manHours = engineeringDirective.ManHours; mans = engineeringDirective.Mans; categories = engineeringDirective.CategoriesRecords.Aggregate("", (current, i) => current + (i.AircraftWorkerCategory + "; ")); cost = engineeringDirective.Cost; } title = apr.Title; description = apr.Description; taskType = apr.Parent.SmartCoreObjectType.ToString(); kits = apr.KitsToString; //performance = apr.OnLifelength; //repeat = apr.Parent.Threshold != null ? apr.Parent.Threshold.RepeatInterval : Lifelength.Null; //performanceDate = apr.RecordDate; } else if (item is IEngineeringDirective) { IEngineeringDirective engineeringDirective = item as IEngineeringDirective; ataChapter = engineeringDirective.ATAChapter; //zone = engineeringDirective.Zone; //access = engineeringDirective.Access; program = engineeringDirective.Program; workType = engineeringDirective.WorkType; //phase = engineeringDirective.Phase; manHours = engineeringDirective.ManHours; mans = engineeringDirective.Mans; categories = engineeringDirective.CategoriesRecords.Aggregate("", (current, i) => current + (i.AircraftWorkerCategory + "; ")); cost = engineeringDirective.Cost; title = engineeringDirective.Title; description = engineeringDirective.Description; taskType = engineeringDirective.SmartCoreObjectType.ToString(); kits = engineeringDirective is IKitRequired ? ((IKitRequired)engineeringDirective).Kits.ToString() : ""; //performance = engineeringDirective.NextPerformanceSource; //repeat = engineeringDirective.Threshold != null ? engineeringDirective.Threshold.RepeatInterval : Lifelength.Null; //performanceDate = engineeringDirective.NextPerformanceDate; } //if (performance == null) // performance = Lifelength.Null; //if (repeat == null) // repeat = Lifelength.Null; //if (remain == null) // remain = Lifelength.Null; row.Cells[0].Value = ataChapter != null?ataChapter.ToString() : ""; row.Cells[0].Tag = ataChapter; row.Cells[1].Value = title; row.Cells[1].Tag = title; row.Cells[2].Value = description; row.Cells[2].Tag = description; //row.Cells[3].Value = zone; //row.Cells[3].Tag = zone; //row.Cells[4].Value = access; //row.Cells[4].Tag = access; row.Cells[3].Value = taskType; row.Cells[3].Tag = taskType; row.Cells[4].Value = program.ToString(); row.Cells[4].Tag = program; row.Cells[5].Value = workType != null?workType.ToString() : DirectiveType.Unknown.ToString(); row.Cells[5].Tag = workType != null?workType.ToString() : DirectiveType.Unknown.ToString(); //row.Cells[8].Value = phase; //row.Cells[8].Tag = phase; row.Cells[6].Value = manHours.ToString(); row.Cells[6].Tag = manHours; row.Cells[7].Value = mans.ToString(); row.Cells[7].Tag = mans; row.Cells[8].Value = categories; row.Cells[8].Tag = categories; row.Cells[9].Value = cost.ToString(); row.Cells[9].Tag = cost; row.Cells[10].Value = kits; row.Cells[10].Tag = kits; //row.Cells[14].Value = performance.ToString(); //row.Cells[14].Tag = performance; //row.Cells[15].Value = repeat.ToString(); //row.Cells[15].Tag = repeat; //row.Cells[16].Value = remain.ToString(); //row.Cells[16].Tag = remain.ToString(); //row.Cells[17].Value = performanceDate == null ? "N/A" : SmartCore.Auxiliary.Convert.GetDateFormat((DateTime)performanceDate); //row.Cells[17].Tag = performanceDate; }
protected override ListViewItem.ListViewSubItem[] GetListViewSubItems(BaseEntityObject item) { List <ListViewItem.ListViewSubItem> subItems = new List <ListViewItem.ListViewSubItem> (); AtaChapter ataChapter = null; string title = ""; string description = ""; //string zone = ""; //string access = ""; //string taskType = ""; //MaintenanceDirectiveProgramType program = MaintenanceDirectiveProgramType.Unknown; //StaticDictionary workType = null; //string phase = ""; double manHours = 0; //int mans = 0; //string categories = ""; double cost = 0, costServiceable = 0, costOverhaul = 0; string kits = ""; //Lifelength performance = Lifelength.Null; //Lifelength repeat = Lifelength.Null; //Lifelength remain = Lifelength.Null; //DateTime? performanceDate = null; if (item is NextPerformance) { NextPerformance np = (NextPerformance)item; IEngineeringDirective engineeringDirective = np.Parent as IEngineeringDirective; if (engineeringDirective != null) { ataChapter = engineeringDirective.ATAChapter; //zone = engineeringDirective.Zone; //access = engineeringDirective.Access; //program = engineeringDirective.Program; //workType = engineeringDirective.WorkType; //phase = engineeringDirective.Phase; manHours = engineeringDirective.ManHours; //mans = engineeringDirective.Mans; //categories = engineeringDirective.CategoriesRecords.Aggregate("", (current, i) => current + (i.AircraftWorkerCategory + "; ")); cost = engineeringDirective.Cost; } title = np.Title; description = np.Description; //taskType = np.Parent.SmartCoreObjectType.ToString(); kits = np.KitsToString; //performance = np.PerformanceSource; //repeat = np.Parent.Threshold != null ? np.Parent.Threshold.RepeatInterval : Lifelength.Null; //remain = np.Remains; //performanceDate = np.PerformanceDate; } else if (item is AbstractPerformanceRecord) { //DirectiveRecord directiveRecord = (DirectiveRecord)item; AbstractPerformanceRecord apr = (AbstractPerformanceRecord)item; IEngineeringDirective engineeringDirective = apr.Parent as IEngineeringDirective; if (engineeringDirective != null) { ataChapter = engineeringDirective.ATAChapter; //zone = engineeringDirective.Zone; //access = engineeringDirective.Access; //program = engineeringDirective.Program; //workType = engineeringDirective.WorkType; //phase = engineeringDirective.Phase; manHours = engineeringDirective.ManHours; //mans = engineeringDirective.Mans; //categories = engineeringDirective.CategoriesRecords.Aggregate("", (current, i) => current + (i.AircraftWorkerCategory + "; ")); cost = engineeringDirective.Cost; } title = apr.Title; description = apr.Description; //taskType = apr.Parent.SmartCoreObjectType.ToString(); kits = apr.KitsToString; //performance = apr.OnLifelength; //repeat = apr.Parent.Threshold != null ? apr.Parent.Threshold.RepeatInterval : Lifelength.Null; //performanceDate = apr.RecordDate; } else if (item is IEngineeringDirective) { IEngineeringDirective engineeringDirective = item as IEngineeringDirective; ataChapter = engineeringDirective.ATAChapter; //zone = engineeringDirective.Zone; //access = engineeringDirective.Access; //program = engineeringDirective.Program; //workType = engineeringDirective.WorkType; //phase = engineeringDirective.Phase; manHours = engineeringDirective.ManHours; //mans = engineeringDirective.Mans; //categories = engineeringDirective.CategoriesRecords.Aggregate("", (current, i) => current + (i.AircraftWorkerCategory + "; ")); cost = engineeringDirective.Cost; title = engineeringDirective.Title; description = engineeringDirective.Description; //taskType = engineeringDirective.SmartCoreObjectType.ToString(); kits = engineeringDirective is IKitRequired ? ((IKitRequired)engineeringDirective).Kits.ToString() : ""; //performance = engineeringDirective.NextPerformanceSource; //repeat = engineeringDirective.Threshold != null ? engineeringDirective.Threshold.RepeatInterval : Lifelength.Null; //performanceDate = engineeringDirective.NextPerformanceDate; if (engineeringDirective is Component) { Component d = engineeringDirective as Component; costServiceable = d.CostServiceable; costOverhaul = d.CostOverhaul; } } subItems.Add(new ListViewItem.ListViewSubItem { Text = ataChapter != null ? ataChapter.ToString() : "", Tag = ataChapter }); subItems.Add(new ListViewItem.ListViewSubItem { Text = title, Tag = title }); subItems.Add(new ListViewItem.ListViewSubItem { Text = description, Tag = description }); subItems.Add(new ListViewItem.ListViewSubItem { Text = kits, Tag = kits }); subItems.Add(new ListViewItem.ListViewSubItem { Text = manHours.ToString(), Tag = manHours }); subItems.Add(new ListViewItem.ListViewSubItem { Text = cost.ToString(), Tag = cost }); subItems.Add(new ListViewItem.ListViewSubItem { Text = costServiceable.ToString(), Tag = costServiceable }); subItems.Add(new ListViewItem.ListViewSubItem { Text = costOverhaul.ToString(), Tag = costOverhaul }); return(subItems.ToArray()); }