private SparkTeleport CreateFromRecord(IDataRecord record)
        {
            var teleport = new SparkTeleport();

            teleport.ID = record.GetValue <int>("id");
            var baseEid = record.GetValue <long>("baseeid");

            teleport.DockingBase = _dockingBaseHelper.GetDockingBase(baseEid);
            teleport.Character   = Character.Get(record.GetValue <int>("characterid"));
            return(teleport);
        }
        public void Delete(SparkTeleport sparkTeleport)
        {
            var res = Db.Query().CommandText("delete charactersparkteleports where id=@ID")
                      .SetParameter("@ID", sparkTeleport.ID)
                      .ExecuteNonQuery();

            if (res == 0)
            {
                throw new PerpetuumException(ErrorCodes.SQLDeleteError);
            }
        }
Esempio n. 3
0
        public SparkTeleport CreateSparkTeleport(DockingBase dockingBase, Character character)
        {
            var teleport = new SparkTeleport
            {
                Character   = character,
                DockingBase = dockingBase
            };

            _sparkTeleportRepository.Insert(teleport);

            return(teleport);
        }
        public void Insert(SparkTeleport sparkTeleport)
        {
            sparkTeleport.ID = Db.Query().CommandText("insert charactersparkteleports (characterid,baseeid,basedefinition,zoneid,x,y) values (@characterID, @baseEID, @baseDefinition, @zoneID, @x, @y); select cast(scope_identity() as integer")
                               .SetParameter("@characterID", sparkTeleport.Character.Id)
                               .SetParameter("@baseEID", sparkTeleport.DockingBase.Eid)
                               .SetParameter("@baseDefinition", sparkTeleport.DockingBase.Definition)
                               .SetParameter("@zoneId", sparkTeleport.DockingBase.Zone.Id)
                               .SetParameter("@x", sparkTeleport.DockingBase.CurrentPosition.intX)
                               .SetParameter("@y", sparkTeleport.DockingBase.CurrentPosition.intY)
                               .ExecuteNonQuery();

            if (sparkTeleport.ID == 0)
            {
                throw new PerpetuumException(ErrorCodes.SQLInsertError);
            }
        }
Esempio n. 5
0
        public void DeleteAndInform(SparkTeleport sparkTeleport)
        {
            _sparkTeleportRepository.Delete(sparkTeleport);

            Transaction.Current.OnCommited(() =>
            {
                var data = new Dictionary <string, object> {
                    { k.description, sparkTeleport.ToDictionary() }
                };

                Message.Builder.SetCommand(Commands.SparkTeleportBaseDeleted)
                .WithData(data)
                .ToCharacter(sparkTeleport.Character)
                .Send();
            });
        }
 public void Update(SparkTeleport item)
 {
     throw new NotImplementedException();
 }