Пример #1
0
        /// <summary>
        /// serialises a Position object
        /// </summary>
        /// <returns>Position_Serialised object</returns>
        /// <param name="p">Position to be converted</param>
        public static Position_Serialised Position_serialise(Position p)
        {
            Position_Serialised posOut = null;

            posOut = new Position_Serialised(p);
            return(posOut);
        }
Пример #2
0
 /// <summary>
 /// Constructor for Position using Position_Serialised object.
 /// For use when de-serialising.
 /// </summary>
 /// <param name="ps">Position_Serialised object to use as source</param>
 public Position(Position_Serialised ps)
     : base(ps: ps)
 {
     this.officeHolder = ps.officeHolder;
     // nationality to be inserted later
     this.nationality = null;
 }
Пример #3
0
        /// <summary>
        /// Writes a Position or Position_Serialised object to the database
        /// </summary>
        /// <returns>bool indicating success</returns>
        /// <param name="gameID">Game (bucket) to write to</param>
        /// <param name="p">Position to write</param>
        /// <param name="ps">Position_Serialised to write</param>
        public static bool DatabaseWrite_Position(string gameID, Position p = null, Position_Serialised ps = null)
        {
            if (p != null)
            {
                // convert Position into Position_Serialised
                ps = DatabaseWrite.Position_serialise(p);
            }

            var rPos         = new RiakObject(gameID, ps.id.ToString(), ps);
            var putPosResult = Globals_Server.rClient.Put(rPos);

            if (!putPosResult.IsSuccess)
            {
                Globals_Server.logError("Write failed: Position " + rPos.Key + " to bucket " + rPos.Bucket);
            }

            return(putPosResult.IsSuccess);
        }
Пример #4
0
 /// <summary>
 /// Constructor for Rank using Position_Serialised object
 /// For use when de-serialising
 /// </summary>
 /// <param name="ps">Position_Serialised object to use as source</param>
 public Rank(Position_Serialised ps)
 {
     this.id      = ps.id;
     this.title   = ps.title;
     this.stature = ps.stature;
 }