Exemple #1
0
        private bool ReadDataMachineTools()
        {
            using (ExcelPackage xlPackage = new ExcelPackage(new FileInfo(PathData.MachineTools)))
            {
                ExcelWorksheet myWorksheet  = xlPackage.Workbook.Worksheets.First();
                int            totalRows    = myWorksheet.Dimension.End.Row;
                int            totalColumns = myWorksheet.Dimension.End.Column;

                for (int row = MachineTool.StartDataRow; row <= totalRows; row++)
                {
                    string strId   = myWorksheet.GetValue(row, 1).ToString();
                    string strName = myWorksheet.GetValue(row, 2).ToString();

                    if (!CheckId(strId))
                    {
                        return(false);
                    }

                    int    id   = int.Parse(strId);
                    string name = strName;

                    if (MachineTools.Exists((machineTool => machineTool.Id == id)))
                    {
                        return(false);
                    }

                    MachineTools.Add(new MachineTool(id, name));
                }
            }

            return(true);
        }
Exemple #2
0
        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);
        }