Esempio n. 1
0
        public override string Compile()
        {
            //Je pense que mettre ça en cache est con x)
            StringBuilder sb = new StringBuilder("Wp");

            sb.Append(character.Map);
            int subAreaID = character.myMap.subArea.area.superArea.ID;

            foreach (Prisme prisma in PrismeTable.Cache.Values.Where(x => x.Alignement == character.Alignement))
            {
                short mapid = prisma.Mapid;
                if (MapTable.Get(mapid) == null || MapTable.Get(mapid).subArea.area.superArea.ID != subAreaID)
                {
                    continue;
                }
                if (prisma.CurrentFight != null || prisma.inFight == -2)
                {
                    sb.Append("|" + mapid + ";*");
                }
                else
                {
                    int costo = ZaapTable.calculZaapCost(character.myMap, (MapTable.Get(mapid)));
                    if (mapid == character.myMap.Id)
                    {
                        costo = 0;
                    }
                    sb.Append("|" + mapid + ";" + costo);
                }
            }

            return(sb.ToString());
        }
Esempio n. 2
0
        private void startFight(List <Player> team1, List <Player> team2)
        {
            var Map = MapTable.GetRandomMap();

            foreach (var Player in team1)
            {
                if (Player.Client.IsGameAction(GameActionTypeEnum.GROUP) && (Player.Client.GetGameAction(GameActionTypeEnum.GROUP) as GameParty).Party.inKolizeum)
                {
                    unregisterGroupEvent((Player.Client.GetGameAction(GameActionTypeEnum.GROUP) as GameParty).Party);
                    (Player.Client.GetGameAction(GameActionTypeEnum.GROUP) as GameParty).Party.Send(new ChatGameMessage("D'autres joueurs ont été trouvés, lancement du combat...", "38A7C8"));
                }
                Player.Client.EndGameAction(GameActionTypeEnum.KOLIZEUM);
                Player.OldPosition = new Couple <Map, int>(Player.myMap, Player.CellId);
                Player.Teleport(Map, 0);
            }
            foreach (var Player in team2)
            {
                if (Player.Client.IsGameAction(GameActionTypeEnum.GROUP) && (Player.Client.GetGameAction(GameActionTypeEnum.GROUP) as GameParty).Party.inKolizeum)
                {
                    unregisterGroupEvent((Player.Client.GetGameAction(GameActionTypeEnum.GROUP) as GameParty).Party);
                    (Player.Client.GetGameAction(GameActionTypeEnum.GROUP) as GameParty).Party.Send(new ChatGameMessage("D'autres joueurs ont été trouvés, lancement du combat...", "38A7C8"));
                }
                Player.Client.EndGameAction(GameActionTypeEnum.KOLIZEUM);
                Player.OldPosition = new Couple <Map, int>(Player.myMap, Player.CellId);
                Player.Teleport(Map, 0);
            }
            //var delayer = new Delayer<KolizeumManager>(GetType().GetMethod("startFightTask"), new object[] { Map,team1,team2 }, this, 3000);
            //delayer.Start();
            new StartFightTask(Map, team1, team2);
        }
Esempio n. 3
0
        private IValue AreEqual(List <IValue> arguments, Scope s)
        {
            MapTable left  = (MapTable)arguments[0];
            MapTable right = (MapTable)arguments[1];

            return(left.AsDictionary().SequenceEqual(right.AsDictionary()) ? Bool.True : Bool.False);
        }
Esempio n. 4
0
    public void SetMap()
    {
        MapTable mapTable = GameSys.Map.CreateMap.Create(GameInfo.nXSize, GameInfo.nYSize, 0);

        bOpen = new bool[GameInfo.nXSize, GameInfo.nYSize];
        for (int x = 0; x < GameInfo.nXSize; x++)
        {
            for (int y = 0; y < GameInfo.nYSize; y++)
            {
                bOpen[x, y] = true;
            }
        }
        foreach (TileData tile in mapTable.TileList)
        {
            GameObject gTile = Instantiate(gTilePre, transform.Find("TileTrans"));
            gTile.transform.localPosition = new Vector3(tile.X, 0, tile.Y);
            MapTile cTile = gTile.GetComponent <MapTile>();
            cTile.SetPos(tile.X, tile.Y);
            cTile.myMapMng = this;
            cTile.Height   = tile.Height;
            if (tile.Height < 5)
            {
                bOpen[tile.X, tile.Y] = false;
            }
            cTile.StackBlock(tile.Stratum);
            MapTiles.Add((tile.X << 8) | tile.Y, cTile);
        }

        foreach (int key in MapTiles.Keys)
        {
            MapTiles[key].optimizeBlock();
        }
    }
Esempio n. 5
0
        private void pmInitForm()
        {
            string strErrorMsg = "";

            WS.Data.Agents.cDBMSAgent objSQLHelper = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside);

            this.txtQcBGBook.Properties.MaxLength = MapTable.GetMaxLength(objSQLHelper, QBGBookInfo.TableName, QBGBookInfo.Field.Code);
            this.txtQnBGBook.Properties.MaxLength = MapTable.GetMaxLength(objSQLHelper, QBGBookInfo.TableName, QBGBookInfo.Field.Name);

            this.txtQcBGBook.Tag   = "";
            this.txtQcBGBook.Text  = "";
            this.txtQnBGBook.Text  = "";
            this.txtQcRefType.Tag  = "";
            this.txtQcRefType.Text = "";
            this.txtQnRefType.Text = "";

            objSQLHelper.SetPara(new object[] { this.mstrDefaRefType });
            if (objSQLHelper.SQLExec(ref this.dtsDataEnv, "QDocType", "DocType", "select cRowID, cCode, cName from DocType where cCode = ?", ref strErrorMsg))
            {
                DataRow dtrRefType = this.dtsDataEnv.Tables["QDocType"].Rows[0];
                this.txtQcRefType.Tag  = dtrRefType["cRowID"].ToString();
                this.txtQcRefType.Text = dtrRefType["cCode"].ToString().TrimEnd();
                this.txtQnRefType.Text = dtrRefType["cName"].ToString().TrimEnd();
            }

            int intYear = DateTime.Now.Year;

            this.pmDefaultBook();
        }
Esempio n. 6
0
        private void pmSetMaxLength()
        {
            WS.Data.Agents.cDBMSAgent pobjSQLUtil = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside);

            this.txtCode.Properties.MaxLength = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, QBGYearInfo.Field.Code);
            this.txtDesc.Properties.MaxLength = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, QBGYearInfo.Field.Desc);
        }
Esempio n. 7
0
        private void pmInitForm()
        {
            this.pmMapEvent();
            this.pmSetFormUI();

            string strErrorMsg = "";

            WS.Data.Agents.cDBMSAgent objSQLHelper = new WS.Data.Agents.cDBMSAgent(App.ERPConnectionString, App.DatabaseReside);

            this.txtQcBook.Properties.MaxLength = MapTable.GetMaxLength(objSQLHelper, "BOOK", "FCCODE");

            this.txtQcBook.Tag  = "";
            this.txtQcBook.Text = "";
            this.txtQnBook.Text = "";

            this.pmDefaultBook();

            objSQLHelper.SetPara(new object[] { this.mstrCoor });
            if (objSQLHelper.SQLExec(ref this.dtsDataEnv, "QCoor", "COOR", "select fcSkid, fcCode, fcName from COOR where fcSkid = ? ", ref strErrorMsg))
            {
                DataRow dtrCoor = this.dtsDataEnv.Tables["QCoor"].Rows[0];
                this.txtQcCoor.Text = dtrCoor["fcCode"].ToString().TrimEnd();
                this.txtQnCoor.Text = dtrCoor["fcName"].ToString().TrimEnd();
            }

            UIBase.SetDefaultChildAppreance(this);
            this.pmCreateTem();
            this.pmInitGridProp();
        }
Esempio n. 8
0
        private IValue MapContains(List <IValue> arguments, Scope s)
        {
            MapTable map = (MapTable)arguments[0];
            IValue   key = arguments[1];

            return(map.AsDictionary().ContainsKey(key) ? Bool.True : Bool.False);
        }
Esempio n. 9
0
        private void pmInitForm()
        {
            WS.Data.Agents.cDBMSAgent objSQLHelper = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside);

            this.txtQcBGBook.Properties.MaxLength = MapTable.GetMaxLength(objSQLHelper, QBGBookInfo.TableName, QBGBookInfo.Field.Code);
            this.txtQnBGBook.Properties.MaxLength = MapTable.GetMaxLength(objSQLHelper, QBGBookInfo.TableName, QBGBookInfo.Field.Name);

            int intYear = DateTime.Now.Year;

            string strErrorMsg = "";

            objSQLHelper.SetPara(new object[] { App.ActiveCorp.RowID });
            if (objSQLHelper.SQLExec(ref this.dtsDataEnv, "QBranch", "EMBRANCH", "select cRowID, cCode, cName from EMBRANCH where cCorp = ? order by CCODE", ref strErrorMsg))
            {
                DataRow dtrBranch = this.dtsDataEnv.Tables["QBranch"].Rows[0];
                this.txtQcBranch.Tag  = dtrBranch["cRowID"].ToString();
                this.txtQcBranch.Text = dtrBranch["cCode"].ToString().TrimEnd();
                this.txtQnBranch.Text = dtrBranch["cName"].ToString().TrimEnd();

                this.pmDefaultBook();
            }

            objSQLHelper.SetPara(new object[] { App.ActiveCorp.RowID });
            if (objSQLHelper.SQLExec(ref this.dtsDataEnv, "QBGYear", "BGYEAR", "select * from BGYEAR where CCORP = ? order by NYEAR desc", ref strErrorMsg))
            {
                DataRow dtrBGYear = this.dtsDataEnv.Tables["QBGYear"].Rows[0];
                this.txtYear.Text = dtrBGYear["cCode"].ToString().TrimEnd();
                this.mintYear     = Convert.ToInt32(dtrBGYear["nYear"]);
            }
        }
Esempio n. 10
0
        public override string Compile()
        {
            StringBuilder sb  = new StringBuilder("WC");
            String        map = character.myMap.Id + "";

            try
            {
                map = character.SavePos.Split(',')[0];
            }
            catch (Exception localException)
            {
                Logger.Error(localException);
            }
            sb.Append(map);
            int SubAreaID = character.myMap.subArea.area.superArea.ID;

            foreach (short i in character.Zaaps)
            {
                if (MapTable.Get(i) == null || MapTable.Get(i).subArea.area.superArea.ID != SubAreaID)
                {
                    continue;
                }
                int cost = ZaapTable.calculZaapCost(character.myMap, MapTable.Get(i));
                if (i == character.myMap.Id)
                {
                    cost = 0;
                }
                sb.Append("|").Append(i).Append(";").Append(cost);
            }
            return(sb.ToString());
        }
Esempio n. 11
0
        public override void Execute(WorldClient client, CommandParameters parameters)
        {
            var mapid      = parameters.getShortParamater(0);
            var cellid     = parameters.GetIntParameter(1);
            var toTeleport = client.Character;

            if (parameters.Lenght > 2)
            {
                var playerName = parameters.GetParameter(2);
                toTeleport = CharacterTable.GetCharacter(playerName);
            }

            if (toTeleport != null)
            {
                var NextMap = MapTable.Get(mapid);
                if (NextMap == null)
                {
                    client.Send(new ConsoleMessage("Mapid invalide"));
                    return;
                }
                toTeleport.Teleport(NextMap, cellid);
                client.Send(new ConsoleMessage("Teleportation effectuer"));
            }
            else
            {
                client.Send(new ConsoleMessage("Impossible de trouver le joueur", ConsoleColorEnum.RED));
            }
        }
Esempio n. 12
0
File: Debug.cs Progetto: szensk/wul
        internal static IValue FunctionInfo(List <IValue> list, Scope s)
        {
            var    first   = list[0];
            string name    = "unnamed";
            string type    = "unknown";
            string source  = "";
            int    line    = 0;
            int?   numArgs = null;

            if (first is IFunction ifunc)
            {
                name    = ifunc.Name;
                line    = ifunc.Line;
                source  = ifunc.FileName;
                type    = ifunc.GetType().Name;
                numArgs = ifunc.ArgumentNames?.Count;
            }
            else if (first is WulType wt)
            {
                name   = wt.Name;
                line   = wt.Line;
                source = wt.FileName;
                type   = "Type";
            }

            return(MapTable.FromObject(new
            {
                Name = (WulString)name,
                Type = (WulString)type,
                Source = (WulString)source,
                Line = (Number)line,
                ArgC = numArgs.HasValue ? (Number)numArgs.Value : null
            }));
        }
Esempio n. 13
0
        private void pmSetMaxLength()
        {
            WS.Data.Agents.cDBMSAgent pobjSQLUtil = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside);

            this.txtCode.Properties.MaxLength  = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, QEMWHLocationInfo.Field.Code);
            this.txtName.Properties.MaxLength  = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, QEMWHLocationInfo.Field.Name);
            this.txtName2.Properties.MaxLength = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, QEMWHLocationInfo.Field.Name2);
        }
Esempio n. 14
0
        private void pmSetMaxLength()
        {
            WS.Data.Agents.cDBMSAgent pobjSQLUtil = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside);

            this.txtCode.Properties.MaxLength  = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, "FCCODE");
            this.txtName.Properties.MaxLength  = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, "FCNAME");
            this.txtName2.Properties.MaxLength = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, "FCNAME2");
        }
Esempio n. 15
0
        public JsonObject(params JsonPair[] items)
        {
            _map = new MapTable <string, JsonValue>();

            if (items != null)
            {
                AddRange(items);
            }
        }
Esempio n. 16
0
 internal void WarpToSavePos()
 {
     try
     {
         String[] infos = this.SavePos.Split(',');
         Teleport(MapTable.Get(short.Parse(infos[0])), int.Parse(infos[1]));
     }
     catch (Exception e) { Logger.Error(e); };
 }
        public void BuldGenericMapDelete()
        {
            var sql = MapTable.BuilderDelete(new Customer()
            {
                Id = 1
            });

            Assert.AreEqual(sql, "delete from customers where id=1");
        }
        public void BuldGenericMapUpdate()
        {
            var sql = MapTable.BuilderUpdate(new Customer()
            {
                Id = 1, Name = "Danilo"
            });

            Assert.AreEqual(sql, "update customers set name=@name where id=@id");
        }
        public void BuldGenericMapInsert()
        {
            var sql = MapTable.BuilderInsert(new Customer()
            {
                Name = "Danilo"
            });

            Assert.AreEqual(sql, "insert into customers (name) values (@name)");
        }
Esempio n. 20
0
        public JsonObject(JsonPairEnumerable items)
        {
            if (items == null)
            {
                throw new ArgumentNullException(nameof(items));
            }

            _map = new MapTable <string, JsonValue>();
            AddRange(items);
        }
Esempio n. 21
0
        /// <summary>
        /// Create a new instance of <see cref="DataPackage"/> from <see cref="IDataReader"/>
        /// </summary>
        /// <param name="dr"><see cref="IDataReader"/></param>
        /// <param name="headerSpaceSize">Header size (default 512 bytes)</param>
        /// <param name="allowDublicate"><see cref="bool"/></param>
        /// <returns></returns>
        public DataPackage(IDataReader dr, int headerSpaceSize, bool allowDublicate) : base(null)
        {
            _headerSpaceSize = headerSpaceSize <= 0 ? header_space_size_default : headerSpaceSize;
            _b       = new BinaryDataBuffer(_headerSpaceSize * 2);
            _bw      = new BinaryDataWriter(_b);
            _br      = new BinaryDataReader(_b);
            _headers = new MapTable <string, object>(StringComparer.Ordinal);

            using (DataTable dt = dr.GetSchemaTable())
            {
                _colCount = dr.FieldCount;
                _indexes  = new string[_colCount];
                _colInfo  = new ColumnInfo[_colCount];

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    DataRow drCol = dt.Rows[i];
                    string  name  = (string)drCol["ColumnName"];

                    if (allowDublicate)
                    {
                        string nameOrig = name;
                        for (int j = 1; _indexes.Contains(name, StringComparer.OrdinalIgnoreCase); j++)
                        {
                            name = nameOrig + j.ToString();
                        }
                    }
                    //else if (_indexes.Contains(name, StringComparer.OrdinalIgnoreCase))
                    //	continue;

                    ColumnInfo ci = new ColumnInfo()
                    {
                        DataType    = (Type)drCol["DataType"],
                        ColumnSize  = (int)drCol["ColumnSize"],
                        AllowDBNull = (bool)drCol["AllowDBNull"]
                    };
                    _indexes[i] = name;
                    _colInfo[i] = ci;
                }

                WritePackageHeader();

                //write data
                for (; dr.Read();)
                {
                    object[] values = new object[_colCount];
                    dr.GetValues(values);
                    //_bw.Write(values);
                    AddNew();
                    SetValues(values);
                    Update();
                }
                GoDataTop();
            }
        }
Esempio n. 22
0
        // Loads a maptile in
        private MapTile loadTile(int x, int z)
        {
            //String mapname = BoogieCore.mapTable.getMapName(BoogieCore.world.getMapID());
            MapTable map = new MapTable();

            string  mapname = map.getMapName(MapId);
            MapTile tile    = new MapTile(mapname, x, z);

            mapTiles.Add(tile);
            return(tile);
        }
        public void BuldGenericMapParameterNull()
        {
            var parameters = MapTable.BuilderParameters(new Customer()
            {
                Name = "Danilo", Phone = null
            });

            Assert.AreEqual(parameters.Count, 1);

            Assert.AreEqual(parameters[0].ParameterName, "@name");
            Assert.AreEqual(parameters[0].SqlDbType, SqlDbType.VarChar);
        }
Esempio n. 24
0
/// <summary>
/// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this
/// object's properties. The database column's name is used to as the key, so the value
/// will not be found if any aliases are used or not all columns were selected.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param>
        public static void ReadValues(this MapTable source, System.Data.IDataRecord dataRecord)
        {
            System.Int32 i;

            i = dataRecord.GetOrdinal("id");

            source.ID = (NetGore.World.MapID)(NetGore.World.MapID) dataRecord.GetUInt16(i);

            i = dataRecord.GetOrdinal("name");

            source.Name = (System.String)(System.String) dataRecord.GetString(i);
        }
Esempio n. 25
0
        /// <summary>
        /// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this
        /// object's properties. The database column's name is used to as the key, so the value
        /// will not be found if any aliases are used or not all columns were selected.
        /// </summary>
        /// <param name="source">The object to add the extension method to.</param>
        /// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param>
        public static void ReadValues(this MapTable source, IDataRecord dataRecord)
        {
            Int32 i;

            i = dataRecord.GetOrdinal("id");

            source.ID = (MapID)dataRecord.GetUInt16(i);

            i = dataRecord.GetOrdinal("name");

            source.Name = dataRecord.GetString(i);
        }
Esempio n. 26
0
        private void pmSetMaxLength()
        {
            WS.Data.Agents.cDBMSAgent pobjSQLUtil = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside);

            this.txtCode.Properties.MaxLength  = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, QAppRoleInfo.Field.Code);
            this.txtName.Properties.MaxLength  = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, QAppRoleInfo.Field.Name);
            this.txtName2.Properties.MaxLength = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, QAppRoleInfo.Field.Name2);

            this.cmbLevel.Properties.Items.Clear();
            this.cmbLevel.Properties.Items.AddRange(new object[] { "O = OPERATOR", "M = MIDDLE", "T = TOP" });
            this.cmbLevel.SelectedIndex = 0;
        }
Esempio n. 27
0
        public static void Initialize()
        {
            nextPlayerGuid = CharacterTable.getNextGuid();
            nextPlayerGuid++;
            nextItemGuid = InventoryItemTable.getNextGuid();
            nextItemGuid++;
            nextGuildId = GuildTable.getNextGuid();
            nextGuildId++;
            nextMountId = MountTable.getNextGuid();
            nextMountId++;
            nextSpeakingId = SpeakingTable.getNextGuid();
            nextSpeakingId++;
            SpellTable.Load();
            ExpFloorTable.Load();
            MonsterTable.Load();
            ItemTemplateTable.Load();
            ItemTemplateTable.LoadItemActions();
            ItemSetTable.Load();
            DropTable.Load();
            TitleTable.Load();
            IObjectTemplateTable.Load();
            AreaTable.Load();
            AreaSubTable.Load();
            MapTable.Load();
            MapTable.LoadActions();
            CellActionTable.Load();
            MobGroupFixTable.Load();
            BreedTable.Load();
            NpcTemplateTable.Load();
            NpcTemplateTable.LoadPlaces();
            NpcQuestionTable.Load();
            NpcReplyTable.Load();
            ShopNpcTable.Initialize();
            GuildTable.Load();
            CharactersGuildTable.Load();
            TaxCollectorTable.Load();
            PrismeTable.Load();
            BidHouseTable.Load();
            BidHouseTable.LoadItems();
            MountParkTable.Load();
            StaticMountTable.Load();
            MountTable.Load();//TODO Dynamic load of Character mount
            ZaapTable.Load();
            ZaapiTable.Load();

            var Timer = new System.Timers.Timer(1000 * 60 * 25);

            Timer.Elapsed += delegate(object sender, ElapsedEventArgs e)
            {
                Save();
            };
            Timer.Start();
        }
Esempio n. 28
0
        private void pmSetMaxLength()
        {
            WS.Data.Agents.cDBMSAgent pobjSQLUtil = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside);

            this.txtCode.Properties.MaxLength  = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, QEMSectInfo.Field.Code);
            this.txtName.Properties.MaxLength  = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, QEMSectInfo.Field.Name);
            this.txtName2.Properties.MaxLength = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, QEMSectInfo.Field.Name2);

            this.cmbType.Properties.Items.Clear();
            this.cmbType.Properties.Items.AddRange(new object[] { "D = DETAIL", "G = GROUP" });
            this.cmbType.SelectedIndex = 0;
        }
Esempio n. 29
0
        /// <summary>
        /// Migration reference from destination to source
        /// </summary>
        /// <param name="manager"></param>
        /// <param name="sourceDatabase"></param>
        /// <param name="destinationDatabase"></param>
        private void MigrationReference(MappingManager manager, SourceDatabase sourceDatabase, DestinationDatabase destinationDatabase)
        {
            List <string> listSourceTableName = sourceDatabase.GetListTable();
            List <string> listDestTableName   = destinationDatabase.GetListTable();

            foreach (string sourceTableName in listSourceTableName)
            {
                //
                // Check does it rename or not ?
                string destTableName = manager.GetTableNewName(sourceTableName);
                LogService.Log.Info("Migrate from " + destTableName + " to " + sourceTableName);


                //
                // Then check, it's still exist in destination database or not
                if (listDestTableName.Contains(destTableName) == false)
                {
                    LogService.Log.Info("Table " + sourceTableName + " has been dropped in destination database.");
                    continue;
                }


                //
                // Get MapTable (class contains information about table, includes references)
                MapTable sourceMapTable = sourceDatabase.GetMapTable(sourceTableName);
                MapTable destMapTable   = destinationDatabase.GetMapTable(destTableName);


                //
                // Add references
                List <ReferenceInformation> listDestReference = destMapTable.GetReference();
                foreach (ReferenceInformation reference in listDestReference)
                {
                    //
                    // Try to revert from new name of table to old name of table
                    string PKTableOldName = manager.GetTableOldName(reference.PKTableName);
                    string FKTableOldName = manager.GetTableOldName(reference.FKTableName);
                    reference.PKTableName = PKTableOldName;
                    reference.FKTableName = FKTableOldName;


                    //
                    // Add new reference information to sourceMapTable
                    if (sourceMapTable.HasReference(reference) == false)
                    {
                        LogService.Log.Info("Add new reference from " + reference.FKTableName + "(" + reference.FKColumnName + ")" +
                                            "to " + reference.FKTableName + "(" + reference.FKColumnName + ")");
                        sourceMapTable.AddReference(reference);
                    }
                }
            }
        }
        private void pmInitForm()
        {
            this.txtQcBranch.ButtonClick += new DevExpress.XtraEditors.Controls.ButtonPressedEventHandler(txtPopUp_ButtonClick);
            this.txtQcBranch.KeyDown     += new KeyEventHandler(txtPopUp_KeyDown);
            this.txtQcBranch.Validating  += new CancelEventHandler(txtQcBranch_Validating);

            this.txtQcWHouse.ButtonClick += new DevExpress.XtraEditors.Controls.ButtonPressedEventHandler(txtPopUp_ButtonClick);
            this.txtQcWHouse.KeyDown     += new KeyEventHandler(txtPopUp_KeyDown);
            this.txtQcWHouse.Validating  += new CancelEventHandler(txtQcWHouse_Validating);

            this.txtQcBook.ButtonClick += new DevExpress.XtraEditors.Controls.ButtonPressedEventHandler(txtPopUp_ButtonClick);
            this.txtQcBook.KeyDown     += new KeyEventHandler(txtPopUp_KeyDown);
            this.txtQcBook.Validating  += new CancelEventHandler(txtQcMfgBook_Validating);

            WS.Data.Agents.cDBMSAgent objSQLHelper  = new WS.Data.Agents.cDBMSAgent(App.ERPConnectionString, App.DatabaseReside);
            WS.Data.Agents.cDBMSAgent objSQLHelper2 = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside);

            this.txtQcBook.Properties.MaxLength = MapTable.GetMaxLength(objSQLHelper2, QMfgBookInfo.TableName, QMfgBookInfo.Field.Code);
            this.txtQnBook.Properties.MaxLength = MapTable.GetMaxLength(objSQLHelper2, QMfgBookInfo.TableName, QMfgBookInfo.Field.Name);

            this.btnOK.Click += new EventHandler(btnOK_Click);

            this.txtQcBook.Tag  = "";
            this.txtQcBook.Text = "";
            this.txtQnBook.Text = "";

            int intYear = DateTime.Now.Year;

            string strErrorMsg = "";

            objSQLHelper.SetPara(new object[] { App.ActiveCorp.RowID });
            if (objSQLHelper.SQLExec(ref this.dtsDataEnv, "QBranch", "BRANCH", "select fcSkid, fcCode, fcName from BRANCH where FCCORP = ? order by FCCODE", ref strErrorMsg))
            {
                DataRow dtrBranch = this.dtsDataEnv.Tables["QBranch"].Rows[0];
                this.txtQcBranch.Tag  = dtrBranch["fcSkid"].ToString();
                this.txtQcBranch.Text = dtrBranch["fcCode"].ToString().TrimEnd();
                this.txtQnBranch.Text = dtrBranch["fcName"].ToString().TrimEnd();
            }

            this.pmDefaultBook();

            this.txtBegDate.DateTime = DateTime.Now;

            this.lblTitle.Text  = UIBase.GetAppUIText(new string[] { "ระบุ Option การสร้างใบเบิก", "Gen Finish Good Recieve Option" });
            this.lblBranch.Text = UIBase.GetAppUIText(new string[] { "ระบุสาขา :", "Branch Code :" });
            this.lblWHouse.Text = UIBase.GetAppUIText(new string[] { "ระบุคลังสินค้า :", "Warehouse Code :" });
            this.lblBook.Text   = UIBase.GetAppUIText(new string[] { "ระบุเล่มเอกสาร :", "Book Code :" });
            this.lblLot.Text    = UIBase.GetAppUIText(new string[] { "ระบุ LOT :", "LOT :" });
            this.lblDate.Text   = UIBase.GetAppUIText(new string[] { "วันที่เอกสาร :", "Document Date :" });

            UIBase.SetDefaultChildAppreance(this);
        }
Esempio n. 31
0
        public Map(string seializedMap, bool isYSymmetrical)
        {
            var lines = seializedMap.Split('\n');
            YSymmetrical = isYSymmetrical;
            int jdx = 0;
            int rows = 0;
            int cols = 0;
            foreach (var line in lines)
            {
                if(line.StartsWith("players"))
                {
                    var playersCount = int.Parse(line.Substring(7).Trim());
                    Armies = new AntArmy[playersCount];
                    for(int i = 0; i < playersCount; i++)
                        Armies[i] = new AntArmy{Idx = i};
                }
                else if (line.StartsWith("rows"))
                {
                    rows = int.Parse(line.Substring(4).Trim());
                }
                else if (line.StartsWith("cols"))
                {
                    cols = int.Parse(line.Substring(4).Trim());
                }
                else if (line.StartsWith("m"))
                {
                    if (OriginalMap == null)
                        OriginalMap = new MapTable<UnMovableCell>(cols, rows);
                    if (ObjectsMap == null)
                        ObjectsMap = new MapTable<MovableCell>(cols, rows);
                    if (KilledAntsMap == null)
                        KilledAntsMap = new MapTable<List<Cell>>(cols, rows);

                    var mapPart = line.Substring(1).Trim();

                    for (int idx = 0; idx < mapPart.Length; idx++)
                    {
                        var point = new Point(idx, jdx, Width, Height);
                        InitCell(point, mapPart[idx]);

                        if (OriginalMap[point].Type == Cell.CellType.Hill)
                            Hills.Add((Hill)OriginalMap[point]);
                    }

                    jdx++;
                }
            }
        }
Esempio n. 32
0
        /// <summary>
        /// A object for Class-Table mapped column, properties and type 
        /// </summary>
        /// <param name="t"> type of object </param>
        /// <returns></returns>
        public MapTable GetMapTable(Type t)
        {
            MapTable ret = null;

            if (!TableMapCollection.ContainsKey(t))
                AddToTableMapCollection(t);

            try
            {
                if (TableMapCollection.ContainsKey(t))
                {
                    ret = new MapTable();
                    ret.ClassName = t;
                    ret.TableName = TableMapCollection[t];
                    ret.ColumnAndProperties = ColumnMapCollection[t];
                    ret.ColumnAndType = TypeMapCollection[t];
                    ret.PrimaryId = GetPrimaryColumn(t);
                }
            }
            catch { throw; }

            return ret;
        }