Пример #1
0
        /// <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 IAllianceTable source, DbParameterValues paramValues)
        {
            for (var i = 0; i < paramValues.Count; i++)
            {
                switch (paramValues.GetParameterName(i))
                {
                case "id":
                    paramValues[i] = (Byte)source.ID;
                    break;

                case "name":
                    paramValues[i] = source.Name;
                    break;
                }
            }
        }
Пример #2
0
/// <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 IAllianceTable source, NetGore.Db.DbParameterValues paramValues)
        {
            for (int i = 0; i < paramValues.Count; i++)
            {
                switch (paramValues.GetParameterName(i))
                {
                case "id":
                    paramValues[i] = (System.Byte)source.ID;
                    break;


                case "name":
                    paramValues[i] = (System.String)source.Name;
                    break;
                }
            }
        }
Пример #3
0
/// <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 IAllianceTable source, NetGore.Db.DbParameterValues paramValues)
        {
            paramValues["id"]   = (System.Byte)source.ID;
            paramValues["name"] = (System.String)source.Name;
        }
Пример #4
0
/// <summary>
/// Checks if this <see cref="IAllianceTable"/> contains the same values as another <see cref="IAllianceTable"/>.
/// </summary>
/// <param name="source">The source <see cref="IAllianceTable"/>.</param>
/// <param name="otherItem">The <see cref="IAllianceTable"/> to compare the values to.</param>
/// <returns>
/// True if this <see cref="IAllianceTable"/> contains the same values as the <paramref name="otherItem"/>; otherwise false.
/// </returns>
        public static System.Boolean HasSameValues(this IAllianceTable source, IAllianceTable otherItem)
        {
            return(Equals(source.ID, otherItem.ID) &&
                   Equals(source.Name, otherItem.Name));
        }
Пример #5
0
/// <summary>
/// Copies the values from the given <paramref name="source"/> into this AllianceTable.
/// </summary>
/// <param name="source">The IAllianceTable to copy the values from.</param>
        public void CopyValuesFrom(IAllianceTable source)
        {
            this.ID   = (DemoGame.AllianceID)source.ID;
            this.Name = (System.String)source.Name;
        }
Пример #6
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(IAllianceTable source, System.Collections.Generic.IDictionary <System.String, System.Object> dic)
        {
            dic["id"]   = (DemoGame.AllianceID)source.ID;
            dic["name"] = (System.String)source.Name;
        }
Пример #7
0
/// <summary>
/// Initializes a new instance of the <see cref="AllianceTable"/> class.
/// </summary>
/// <param name="source">IAllianceTable to copy the initial values from.</param>
        public AllianceTable(IAllianceTable source)
        {
            CopyValuesFrom(source);
        }
/// <summary>
/// Checks if this <see cref="IAllianceTable"/> contains the same values as another <see cref="IAllianceTable"/>.
/// </summary>
/// <param name="source">The source <see cref="IAllianceTable"/>.</param>
/// <param name="otherItem">The <see cref="IAllianceTable"/> to compare the values to.</param>
/// <returns>
/// True if this <see cref="IAllianceTable"/> contains the same values as the <paramref name="otherItem"/>; otherwise false.
/// </returns>
public static System.Boolean HasSameValues(this IAllianceTable source, IAllianceTable otherItem)
{
return Equals(source.ID, otherItem.ID) && 
Equals(source.Name, otherItem.Name);
}
Пример #9
0
 /// <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 IAllianceTable source, DbParameterValues paramValues)
 {
     paramValues["id"]   = (Byte)source.ID;
     paramValues["name"] = source.Name;
 }
Пример #10
0
 /// <summary>
 /// Copies the values from the given <paramref name="source"/> into this AllianceTable.
 /// </summary>
 /// <param name="source">The IAllianceTable to copy the values from.</param>
 public void CopyValuesFrom(IAllianceTable source)
 {
     ID = source.ID;
     Name = source.Name;
 }
Пример #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AllianceTable"/> class.
 /// </summary>
 /// <param name="source">IAllianceTable to copy the initial values from.</param>
 public AllianceTable(IAllianceTable source)
 {
     CopyValuesFrom(source);
 }
Пример #12
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(IAllianceTable source, IDictionary<String, Object> dic)
 {
     dic["id"] = source.ID;
     dic["name"] = source.Name;
 }
Пример #13
0
/// <summary>
/// Copies the values from the given <paramref name="source"/> into this AllianceTable.
/// </summary>
/// <param name="source">The IAllianceTable to copy the values from.</param>
public void CopyValuesFrom(IAllianceTable source)
{
this.ID = (DemoGame.AllianceID)source.ID;
this.Name = (System.String)source.Name;
}
Пример #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(IAllianceTable source, System.Collections.Generic.IDictionary<System.String,System.Object> dic)
{
dic["id"] = (DemoGame.AllianceID)source.ID;
dic["name"] = (System.String)source.Name;
}
Пример #15
0
 /// <summary>
 /// Copies the values from the given <paramref name="source"/> into this AllianceTable.
 /// </summary>
 /// <param name="source">The IAllianceTable to copy the values from.</param>
 public void CopyValuesFrom(IAllianceTable source)
 {
     ID   = source.ID;
     Name = source.Name;
 }
Пример #16
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(IAllianceTable source, IDictionary <String, Object> dic)
 {
     dic["id"]   = source.ID;
     dic["name"] = source.Name;
 }