private bool ReadDataNomenclatures() { using (ExcelPackage xlPackage = new ExcelPackage(new FileInfo(PathData.Nomenclatures))) { ExcelWorksheet myWorksheet = xlPackage.Workbook.Worksheets.First(); int totalRows = myWorksheet.Dimension.End.Row; int totalColumns = myWorksheet.Dimension.End.Column; for (int row = Nomenclature.StartDataRow; row <= totalRows; row++) { string strId = myWorksheet.GetValue(row, 1).ToString(); string strNomenclature = myWorksheet.GetValue(row, 2).ToString(); if (!CheckId(strId)) { return(false); } int id = int.Parse(strId); string nomenclature = strNomenclature; if (Nomenclatures.Exists((n => n.Id == id))) { return(false); } Nomenclatures.Add(new Nomenclature(id, nomenclature)); } } return(true); }
public bool CheckHarmony() { bool check = true; foreach (Time time in Times) { if (!MachineTools.Exists((tool => tool.Id == time.MachineToolId))) { Console.WriteLine($"MachineTool ID not exist: {time.MachineToolId}"); check = false; } if (!Nomenclatures.Exists((nomenclature => nomenclature.Id == time.NomenclatureId))) { Console.WriteLine($"Nomenclature ID not exist: {time.NomenclatureId}"); check = false; } } foreach (Party party in Parties) { if (!Nomenclatures.Exists((nomenclature => nomenclature.Id == party.NomenclatureId))) { Console.WriteLine($"Nomenclature ID not exist: {party.NomenclatureId}"); check = false; } } return(check); }