Beispiel #1
0
 public WorldEmployee( DateTime beginTime, DateTime endTime, World world, Employee employee )
 {
     this._beginTime = beginTime;
     this._endTime = endTime;
     this._world = world;
     this._employee = employee;
 }
Beispiel #2
0
 public WorldName( long languageID, string name, World world )
 {
     this._languageID = languageID;
     this._name = name;
     this._world = world;
 }
Beispiel #3
0
        protected override void readCSVFile(CachedCsvReader csv)
        {
            #if(UseHeaders)
            int worldIDIndex = csv.GetFieldIndex(_WorldID);
            int worldNameIndex = csv.GetFieldIndex(_WorldName);
            #else
            int worldIDIndex = _WorldIDIndex;
            int worldNameIndex = _WorldNameIndex;
            #endif
            Dictionary<string, World> dbWorldHash = getDBWorldHash();
            Dictionary<long, Store> dbStoreHash = getDBStoreList();
            Dictionary<string, StoreToWorld> dbStore_WorldHash = getStore_WorldHash();

            List<World> worldSaveList = new List<World>();
            List<StoreToWorld> store_WorldSaveList = new List<StoreToWorld>();

            bool isNew= false;
            while (csv.ReadNextRecord())
            {
                csvDataNextRow();
                string worldID = csv[worldIDIndex];
                string worldName = csv[worldNameIndex];
                string key = worldID;
                World world;
                if (dbWorldHash.ContainsKey(key))
                {
                    world = dbWorldHash[key];
                }
                else
                {
                    world = new World();
                }
                world.ExSystemID = int.Parse(worldID);
                world.LanguageID = SharedConsts.NeutralLangId;
                world.Name = worldName;
                world.WorldTypeID = WorldType.World;
                world.Import = true;
                if (!worldSaveList.Contains(world))
                    worldSaveList.Add(world);
                else
                    message(string.Format(GetLocalized("WorldExists"), _CurrentRow, _WorldID, worldID));

                if (world.IsNew && !dbWorldHash.ContainsKey(key))
                {
                    dbWorldHash.Add(key, world);
                    isNew= true;
                }
            }
            csvDataEndRead();
            SaveOrUpdateList<World>(_IStoreService.WorldService,worldSaveList);

            if (isNew)
                dbWorldHash = getDBWorldHash();
            foreach (Store store in dbStoreHash.Values)
            {
                foreach (World world in dbWorldHash.Values)
                {
                    string key= store.ID.ToString () + world.ID.ToString ();
                    if (!dbStore_WorldHash.ContainsKey(key))
                    {
                        StoreToWorld store_world = new StoreToWorld(world.ID, store.ID);
                        store_WorldSaveList.Add(store_world);
                        dbStore_WorldHash.Add(key, store_world);
                    }
                }
            }
            if (dbStoreHash.Count == 0)
                message(GetLocalized("StoresNotExistsDB"));
            SaveList<StoreToWorld>(_IStoreService.StoreToWorldService, store_WorldSaveList);
        }