public ResolvedValue(string name, Entity.Types type, string unresolvedValue) { Name = name; Type = type; UnresolvedValue = unresolvedValue; Gender = Sample.Genders.NEUTRAL; Value = null; }
/// <summary> /// use this method only when recreate a map or the map id the database is null /// </summary> /// <param name="MapName"></param> /// <param name="layers"></param> /// <param name="racks"></param> /// <param name="columns"></param> /// <returns></returns> public Entity.Map CreateNewMap(string MapName, int layers, int racks, int columns) { using (TransactionScope scope = new TransactionScope()) { Map = new Entity.Map(); Map.MapName = MapName; Map.RackCount = racks; Map.LayerCount = layers; Map.ColumnCount = columns; //first save map initial messages this.MapDictionaryService = new Repository.MapDictionaryService(); this.MapDictionaryService.InsertMap(Map); //Reset Zones' static color Zone.ResetRrandomColor(); //initial all services as the map reference for one InitialServices(Map); //create general types list List <Entity.Types> generalTypes = TypesService.LoadTypes(); if (generalTypes.Count == 0)//if there has no types in the database, create new and save from code { generalTypes = GetGeneralTypes(); this.TypesService.InsertTypes(generalTypes); } //ALERT!! must be constrainted here as the same name of all the GENERAL_TYPES, or will has logical error //ALERT!! you can modify and make contraint from "public class ItemTypesString" in this singleton class Entity.Types tt = Map.Types.Single(t => t.Name == ItemTypesString.ITEM_TYPE_DEFAULT_STORAGE); this._default_storage = tt; //then set mapitems, default type Id is zt's Type Id List <Entity.MapItems> additionMapItemList = new List <MapItems>(); for (int i = 0; i < layers; i++) { for (int j = 0; j < racks; j++) { for (int k = 0; k < columns; k++) { Entity.MapItems tmp = new Entity.MapItems(); DAL.MapItems DAL_tmp = new DAL.MapItems() { MapItemLayer = i, MapItemRack = j, MapItemColumn = k, TypeId = tt.Id, ZoneId = 0, CargowayId = 0, Status = (int)MapItems.MapItemStatus.STATUS_NOT_STORAGE }; tmp.DAL_SetMapItem(DAL_tmp); additionMapItemList.Add(tmp); } } } MapItemsService.InsertMapItems(additionMapItemList); scope.Complete(); } return(Map); }
/// <summary> /// load types into global one map /// </summary> /// <returns></returns> public List <Entity.Types> LoadTypes() { DAL.TypesDA.ITypesDA typesDA = new DAL.TypesDA.TypesDAO(); List <DAL.Types> tl = typesDA.GetTypes(); List <Entity.Types> res = new List <Entity.Types>(); foreach (DAL.Types t in tl) { t.Name = t.Name.Trim(); t.Color = t.Color.Trim(); Entity.Types tmp = new Entity.Types(); tmp.DAL_SetTypes(t); res.Add(tmp); } _DAL_Types = tl; _map.Types = res; return(res); }
//public IMapAlgorithmService GetMapAlgorithmService() //{ // return MapAlgorithmService; //} private void InitialMapInfos() { Map = MapDictionaryService.GetMap(); if (Map != null) { //initial the services, for Map as one reference //should do load in this certain sequence this.MapDictionaryService = new Repository.MapDictionaryService(); InitialServices(Map); this.TypesService.LoadTypes(); this.ZonesService.LoadZones(); //we get cargoways first here, for the mapitems and cargolocks should take a reference of the cargoway this.CargoWaysService.LoadCargoWays(); this.CargoWaysLockService.LoadCargoWaysLocks(); this.MapItemsService.LoadMapItems(); this.GoodsService.LoadGoods(); this.RailsService.LoadRails(); this.SpecialConnectionService.LoadSpecialConnections(); this._default_storage = Map.Types.SingleOrDefault(t => t.Name == ItemTypesString.ITEM_TYPE_DEFAULT_STORAGE); } }