public List <string> ValidateSchedulePlan(Stream stream) { List <string> missingEquipmentCode = new List <string>(); try { ExcelRecordImporter importer = new ExcelRecordImporter(stream); int worksheet = 0; foreach (var dataSetName in importer.GetDataSetNames()) { if (worksheet == 0) { var importedRows = importer.Import(dataSetName); if (importedRows != null && importedRows.Any()) { foreach (var row in importedRows) { var equipmentCode = Convert.ToString(row["equipment type"]); if (!string.IsNullOrEmpty(equipmentCode)) { var found = _routeManagement.CheckEquipmentType(equipmentCode); if (!found) { missingEquipmentCode.Add(equipmentCode); } } } } } } } catch (Exception ex) { //write to Elma ErrorSignal.FromCurrentContext().Raise(ex); } return(missingEquipmentCode); }
public void UploadFlightSchedule(Stream stream, bool clearSchedule) { ExcelRecordImporter importer = new ExcelRecordImporter(stream); int worksheet = 0; foreach (var dataSetName in importer.GetDataSetNames()) { if (worksheet == 0) { var importedRows = importer.Import(dataSetName); if (importedRows != null && importedRows.Any()) { //clear all the flight schedules if (clearSchedule) { _routeManagement.ClearFlightSchedules(); } //Import flight schedules foreach (var importedRow in importedRows) { try { ImportFlightSchedule(importedRow); } catch (Exception e) { //write to Elma ErrorSignal.FromCurrentContext().Raise(e); } } } } worksheet++; } }