Exemple #1
0
        private InventoryObject GetInventoryInfoFromFileName(string _fileName, string _fullFileName)
        {
            try
            {
                int year  = int.Parse(_fileName.Substring(_fileName.Length - 10, 4));
                int month = int.Parse(_fileName.Substring(_fileName.Length - 5, 2));
                int day   = int.Parse(_fileName.Substring(_fileName.Length - 2, 2));

                DateTime resultDate = new DateTime(year, month, day);

                InventoryObject obj = new InventoryObject(resultDate, _fullFileName);
                return(obj);
            }
            catch (Exception ex)
            {
                return(new InventoryObject(new DateTime(1000, 1, 1), ""));
            }
        }
Exemple #2
0
        private int processInventoryReport()
        {
            try
            {
                string fileName;

                for (int i = 0; i < FileNamesInventory.Length; i++)
                {
                    fileName = FileNamesInventory[i].Substring(inventory_path.Length + 1, FileNamesInventory[i].Length - inventory_path.Length - 1);
                    fileName = fileName.Substring(6, fileName.Length - 5 - 6);        //6 - это stock! в начале имени файла, сразу отсекаем его

                    inventoryObject = GetInventoryInfoFromFileName(fileName, FileNamesInventory[i]);
                }

                tb_inventoryrep.Text = inventoryObject.fullFileName;

                return(1);
            }
            catch (Exception ex)
            {
                return(-4);
            }
        }