private void CheckHeaders(XlWorksheet worksheet) { if (worksheet != null) { Schema s; List <string> h; if (worksheet.Name == "DET_Deployments") { s = DeploymentDTO.GetSchema(); } else if (worksheet.Name == "DET_Measurements") { s = MeasurementDTO.GetSchema(); } else if (worksheet.Name == "LIST_Sites") { s = SiteDTO.GetSchema(); } else if (worksheet.Name == "LIST_Sensors") { s = SensorDTO.GetSchema(); } else { return; } h = new List <string>(); List <string> hdrs = ExcelBaseDet.Headers(worksheet); bool bad = false; for (int i = 0; i < hdrs.Count - 1; i++) { string t = hdrs[i]; for (int j = i + 1; j < hdrs.Count; j++) { if (t == hdrs[j]) { bad = true; break; //inner } } if (bad) { break; //outer } } if (bad) { generalDet.ValidationIssues.Add(ValidationIssue.Code.DuplicateHeader, "Duplicate column header in " + worksheet.Name); } foreach (SchemaEntry c in s) { h.Add(c.LowerColumnName); } if (!ExcelBaseDet.HasHeaders(hdrs, h)) { generalDet.ValidationIssues.Add(ValidationIssue.Code.MissingFieldHeader, "Missing column header in " + worksheet.Name); } } }
private DataTab MeasurementsDataTab() { return(new DataTab("DET_Measurements", XlColor.White, MeasurementDTO.GetSchema(), generalDet.Measurements.Values)); }