/// <summary>
        /// Copies the column values into the given DbParameterValues using the database column name
        /// with a prefixed @ as the key. The key must already exist in the DbParameterValues
        /// for the value to be copied over. If any of the keys in the DbParameterValues do not
        /// match one of the column names, or if there is no field for a key, then it will be
        /// ignored. Because of this, it is important to be careful when using this method
        /// since columns or keys can be skipped without any indication.
        /// </summary>
        /// <param name="source">The object to copy the values from.</param>
        /// <param name="paramValues">The DbParameterValues to copy the values into.</param>
        public static void TryCopyValues(this ICharacterInventoryTable source, DbParameterValues paramValues)
        {
            for (var i = 0; i < paramValues.Count; i++)
            {
                switch (paramValues.GetParameterName(i))
                {
                case "character_id":
                    paramValues[i] = (Int32)source.CharacterID;
                    break;

                case "item_id":
                    paramValues[i] = (Int32)source.ItemID;
                    break;

                case "slot":
                    paramValues[i] = (Byte)source.Slot;
                    break;
                }
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="CharacterInventoryTable"/> class.
 /// </summary>
 /// <param name="source">ICharacterInventoryTable to copy the initial values from.</param>
 public CharacterInventoryTable(ICharacterInventoryTable source)
 {
     CopyValuesFrom(source);
 }
 /// <summary>
 /// Copies the values from the given <paramref name="source"/> into this CharacterInventoryTable.
 /// </summary>
 /// <param name="source">The ICharacterInventoryTable to copy the values from.</param>
 public void CopyValuesFrom(ICharacterInventoryTable source)
 {
     CharacterID = source.CharacterID;
     ItemID      = source.ItemID;
     Slot        = source.Slot;
 }
 /// <summary>
 /// Copies the column values into the given Dictionary using the database column name
 /// with a prefixed @ as the key. The keys must already exist in the Dictionary;
 /// this method will not create them if they are missing.
 /// </summary>
 /// <param name="source">The object to copy the values from.</param>
 /// <param name="dic">The Dictionary to copy the values into.</param>
 public static void CopyValues(ICharacterInventoryTable source, IDictionary <String, Object> dic)
 {
     dic["character_id"] = source.CharacterID;
     dic["item_id"]      = source.ItemID;
     dic["slot"]         = source.Slot;
 }
 /// <summary>
 /// Checks if this <see cref="ICharacterInventoryTable"/> contains the same values as another <see cref="ICharacterInventoryTable"/>.
 /// </summary>
 /// <param name="source">The source <see cref="ICharacterInventoryTable"/>.</param>
 /// <param name="otherItem">The <see cref="ICharacterInventoryTable"/> to compare the values to.</param>
 /// <returns>
 /// True if this <see cref="ICharacterInventoryTable"/> contains the same values as the <paramref name="otherItem"/>; otherwise false.
 /// </returns>
 public static Boolean HasSameValues(this ICharacterInventoryTable source, ICharacterInventoryTable otherItem)
 {
     return(Equals(source.CharacterID, otherItem.CharacterID) && Equals(source.ItemID, otherItem.ItemID) &&
            Equals(source.Slot, otherItem.Slot));
 }
/// <summary>
/// Checks if this <see cref="ICharacterInventoryTable"/> contains the same values as another <see cref="ICharacterInventoryTable"/>.
/// </summary>
/// <param name="source">The source <see cref="ICharacterInventoryTable"/>.</param>
/// <param name="otherItem">The <see cref="ICharacterInventoryTable"/> to compare the values to.</param>
/// <returns>
/// True if this <see cref="ICharacterInventoryTable"/> contains the same values as the <paramref name="otherItem"/>; otherwise false.
/// </returns>
public static System.Boolean HasSameValues(this ICharacterInventoryTable source, ICharacterInventoryTable otherItem)
{
return Equals(source.CharacterID, otherItem.CharacterID) && 
Equals(source.ItemID, otherItem.ItemID) && 
Equals(source.Slot, otherItem.Slot);
}
 /// <summary>
 /// Copies the column values into the given DbParameterValues using the database column name
 /// with a prefixed @ as the key. The keys must already exist in the DbParameterValues;
 ///  this method will not create them if they are missing.
 /// </summary>
 /// <param name="source">The object to copy the values from.</param>
 /// <param name="paramValues">The DbParameterValues to copy the values into.</param>
 public static void CopyValues(this ICharacterInventoryTable source, DbParameterValues paramValues)
 {
     paramValues["character_id"] = (Int32)source.CharacterID;
     paramValues["item_id"]      = (Int32)source.ItemID;
     paramValues["slot"]         = (Byte)source.Slot;
 }
Example #8
0
/// <summary>
/// Copies the column values into the given Dictionary using the database column name
/// with a prefixed @ as the key. The keys must already exist in the Dictionary;
/// this method will not create them if they are missing.
/// </summary>
/// <param name="source">The object to copy the values from.</param>
/// <param name="dic">The Dictionary to copy the values into.</param>
public static void CopyValues(ICharacterInventoryTable source, System.Collections.Generic.IDictionary<System.String,System.Object> dic)
{
dic["character_id"] = (DemoGame.CharacterID)source.CharacterID;
dic["item_id"] = (DemoGame.ItemID)source.ItemID;
dic["slot"] = (NetGore.InventorySlot)source.Slot;
}
Example #9
0
/// <summary>
/// Copies the values from the given <paramref name="source"/> into this CharacterInventoryTable.
/// </summary>
/// <param name="source">The ICharacterInventoryTable to copy the values from.</param>
public void CopyValuesFrom(ICharacterInventoryTable source)
{
this.CharacterID = (DemoGame.CharacterID)source.CharacterID;
this.ItemID = (DemoGame.ItemID)source.ItemID;
this.Slot = (NetGore.InventorySlot)source.Slot;
}
Example #10
0
/// <summary>
/// Initializes a new instance of the <see cref="CharacterInventoryTable"/> class.
/// </summary>
/// <param name="source">ICharacterInventoryTable to copy the initial values from.</param>
public CharacterInventoryTable(ICharacterInventoryTable source)
{
CopyValuesFrom(source);
}
 /// <summary>
 /// Copies the values from the given <paramref name="source"/> into this CharacterInventoryTable.
 /// </summary>
 /// <param name="source">The ICharacterInventoryTable to copy the values from.</param>
 public void CopyValuesFrom(ICharacterInventoryTable source)
 {
     CharacterID = source.CharacterID;
     ItemID = source.ItemID;
     Slot = source.Slot;
 }
 /// <summary>
 /// Copies the column values into the given Dictionary using the database column name
 /// with a prefixed @ as the key. The keys must already exist in the Dictionary;
 /// this method will not create them if they are missing.
 /// </summary>
 /// <param name="source">The object to copy the values from.</param>
 /// <param name="dic">The Dictionary to copy the values into.</param>
 public static void CopyValues(ICharacterInventoryTable source, IDictionary<String, Object> dic)
 {
     dic["character_id"] = source.CharacterID;
     dic["item_id"] = source.ItemID;
     dic["slot"] = source.Slot;
 }
Example #13
0
/// <summary>
/// Copies the values from the given <paramref name="source"/> into this CharacterInventoryTable.
/// </summary>
/// <param name="source">The ICharacterInventoryTable to copy the values from.</param>
        public void CopyValuesFrom(ICharacterInventoryTable source)
        {
            this.CharacterID = (DemoGame.CharacterID)source.CharacterID;
            this.ItemID      = (DemoGame.ItemID)source.ItemID;
            this.Slot        = (NetGore.InventorySlot)source.Slot;
        }
Example #14
0
/// <summary>
/// Copies the column values into the given Dictionary using the database column name
/// with a prefixed @ as the key. The keys must already exist in the Dictionary;
/// this method will not create them if they are missing.
/// </summary>
/// <param name="source">The object to copy the values from.</param>
/// <param name="dic">The Dictionary to copy the values into.</param>
        public static void CopyValues(ICharacterInventoryTable source, System.Collections.Generic.IDictionary <System.String, System.Object> dic)
        {
            dic["character_id"] = (DemoGame.CharacterID)source.CharacterID;
            dic["item_id"]      = (DemoGame.ItemID)source.ItemID;
            dic["slot"]         = (NetGore.InventorySlot)source.Slot;
        }