Exemple #1
0
        private DBAccessor()
        {
            //var documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

            //SafeCreateDirectory(documents + @"\HardwareLedger\Database\");
            //Directory = documents + @"\HardwareLedger\Database\{0}.json";
            Directory = @"Database\{0}.json";

            //SafeCreateDirectory(documents + @"\HardwareLedger\Database\");
            SafeCreateDirectory(@"Database\");

            data = new Dictionary <Type, List <IPgmRow> >();

            Reserves         = ReadJson <Reserve, DBObject.Reserve>();
            ShopTypes        = ReadJson <ShopType, DBObject.ShopType>();
            ItemTypes        = ReadJson <ItemType, DBObject.ItemType>();
            ItemStates       = ReadJson <ItemState, DBObject.ItemState>();
            Malfunctions     = ReadJson <Malfunction, DBObject.Malfunction>();
            Relations        = ReadJson <Relation, DBObject.Relation>();
            CollectSchedules = ReadJson <CollectSchedule, DBObject.CollectSchedule>();
            ReserveShippings = ReadJson <ReserveShipping, DBObject.ReserveShipping>();



            data.Add(typeof(Reserve), Reserves.Cast <IPgmRow>().ToList());
            data.Add(typeof(ShopType), ShopTypes.Cast <IPgmRow>().ToList());
            data.Add(typeof(ItemType), ItemTypes.Cast <IPgmRow>().ToList());
            data.Add(typeof(ItemState), ItemStates.Cast <IPgmRow>().ToList());
            data.Add(typeof(Malfunction), Malfunctions.Cast <IPgmRow>().ToList());
            data.Add(typeof(Relation), Relations.Cast <IPgmRow>().ToList());
            data.Add(typeof(CollectSchedule), CollectSchedules.Cast <IPgmRow>().ToList());
            data.Add(typeof(ReserveShipping), ReserveShippings.Cast <IPgmRow>().ToList());
        }