Exemplo n.º 1
0
        public static DojoPromotionFlag ParseFromReader(IDataReader r, int idOffset, int dataOffset)
        {
            DojoPromotionFlag dojoPromotionFlag = new DojoPromotionFlag();

            FillFromReader(dojoPromotionFlag, r, idOffset, dataOffset);
            return(dojoPromotionFlag);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Deep copies the current DojoPromotionFlag to another instance of DojoPromotionFlag.
 /// </summary>
 /// <param name="DojoPromotionFlag">The DojoPromotionFlag to copy to.</param>
 /// <param name="isolation">Placeholders are used to isolate the DojoPromotionFlag from its children.</param>
 public void CopyTo(DojoPromotionFlag dojoPromotionFlag, bool isolation)
 {
     dojoPromotionFlag.iD            = iD;
     dojoPromotionFlag.isPlaceHolder = isPlaceHolder;
     dojoPromotionFlag.isSynced      = isSynced;
     dojoPromotionFlag.name          = name;
 }
Exemplo n.º 3
0
        /// <summary>
        /// Makes a deep copy of the current DojoPromotionFlag.
        /// </summary>
        /// <returns> A new DojoPromotionFlag object reflecting the cloned DojoPromotionFlag object.</returns>
        /// <param name="isolation">Placeholders are used to isolate the DojoPromotionFlag from its children.</param>
        public DojoPromotionFlag Copy(bool isolation)
        {
            DojoPromotionFlag dojoPromotionFlag = new DojoPromotionFlag();

            CopyTo(dojoPromotionFlag, isolation);
            return(dojoPromotionFlag);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Makes a deep copy of the current DojoPromotionFlag.
        /// </summary>
        /// <returns> A new DojoPromotionFlag object reflecting the cloned DojoPromotionFlag object.</returns>
        public DojoPromotionFlag Copy()
        {
            DojoPromotionFlag dojoPromotionFlag = new DojoPromotionFlag();

            CopyTo(dojoPromotionFlag);
            return(dojoPromotionFlag);
        }
Exemplo n.º 5
0
        private static void fillParameters(Database database, DbCommand dbCommand, DojoPromotionFlag dojoPromotionFlag)
        {
            #region Default

            addParameter(database, dbCommand, "@Name", DbType.String, dojoPromotionFlag.name);

            #endregion
        }
Exemplo n.º 6
0
        /// <summary>
        /// Fills the {0} from a OleIDataReader.
        /// </summary>
        public static void FillFromReader(DojoPromotionFlag dojoPromotionFlag, IDataReader r, int idOffset, int dataOffset)
        {
            dojoPromotionFlag.iD            = r.GetInt32(idOffset);
            dojoPromotionFlag.isSynced      = true;
            dojoPromotionFlag.isPlaceHolder = false;

            dojoPromotionFlag.name = r.GetString(0 + dataOffset);
        }
Exemplo n.º 7
0
        public static DojoPromotionFlag NewPlaceHolder(int iD)
        {
            DojoPromotionFlag dojoPromotionFlag = new DojoPromotionFlag();

            dojoPromotionFlag.iD            = iD;
            dojoPromotionFlag.isPlaceHolder = true;
            dojoPromotionFlag.isSynced      = true;
            return(dojoPromotionFlag);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Duplicates DojoPromotionFlag object into a database; may or may not be the same database
        /// as the parent object.
        /// </summary>
        /// <returns> A new DojoPromotionFlag object reflecting the replicated DojoPromotionFlag object.</returns>
        public DojoPromotionFlag Duplicate()
        {
            DojoPromotionFlag clonedDojoPromotionFlag = this.Clone();

            // Insert must be called after children are replicated!
            clonedDojoPromotionFlag.iD       = DojoPromotionFlagManager._insert(clonedDojoPromotionFlag);
            clonedDojoPromotionFlag.isSynced = true;
            return(clonedDojoPromotionFlag);
        }
Exemplo n.º 9
0
        public void Remove(DojoPromotionFlag value)
        {
            OnCollectionChanged(EventArgs.Empty);
            int index = IndexOf(value);

            if (index == -1)
            {
                throw(new Exception("DojoPromotionFlag not found in collection."));
            }
            RemoveAt(index);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Clones DojoPromotionFlag object and clones child objects with cloning or replication.
        /// as the parent object.
        /// </summary>
        /// <returns> A new DojoPromotionFlag object reflecting the replicated DojoPromotionFlag object.</returns>
        public DojoPromotionFlag Clone()
        {
            DojoPromotionFlag clonedDojoPromotionFlag = new DojoPromotionFlag();

            clonedDojoPromotionFlag.iD       = iD;
            clonedDojoPromotionFlag.isSynced = isSynced;
            clonedDojoPromotionFlag.name     = name;


            return(clonedDojoPromotionFlag);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Inserts a DojoPromotionFlag into the database. All children should have been
        /// saved to the database before insertion. New children will not be
        /// related to this object in the database.
        /// </summary>
        /// <param name="_DojoPromotionFlag">The DojoPromotionFlag to insert into the database.</param>
        internal static int _insert(DojoPromotionFlag dojoPromotionFlag)
        {
            int       id;
            string    query;
            Database  database;
            DbCommand dbCommand;

            database = DatabaseFactory.CreateDatabase();

            query = "INSERT INTO kitTessen_PromotionFlags " +
                    "(" +
                    "Name) VALUES (" +
                    "@Name);";

            if (database.ConnectionStringWithoutCredentials.StartsWith("provider=microsoft.jet.oledb.4.0"))
            {
                // Microsoft Access
                // Connection must remain open for IDENTITY to return correct value,
                // therefore use the dbCommand object's Connection directly to control
                // connection state.
                dbCommand = database.GetSqlStringCommand(query);
                fillParameters(database, dbCommand, dojoPromotionFlag);
                dbCommand.Connection = database.CreateConnection();
                dbCommand.Connection.Open();
                dbCommand.ExecuteNonQuery();
                dbCommand.CommandText = "SELECT @@IDENTITY AS LastID";
                id = (int)dbCommand.ExecuteScalar();
                dbCommand.Connection.Close();
            }
            else
            {
                //// Microsoft SQL Server
                dbCommand = database.GetSqlStringCommand(query + " SELECT @LastID = SCOPE_IDENTITY();");
                fillParameters(database, dbCommand, dojoPromotionFlag);
                database.AddOutParameter(dbCommand, "@LastID", DbType.Int32, 10);
                database.ExecuteNonQuery(dbCommand);
                id = (int)dbCommand.Parameters["@LastID"].Value;
            }
            // Store dojoPromotionFlag in cache.
            if (cacheEnabled)
            {
                cacheStore(dojoPromotionFlag);
            }
            // ************************* WARNING ****************************
            // Insert operations must invalidate the cached collections.
            // Invalidation MUST invalidate any foreign cached collections that
            // with children objects this manager provides or else the foreign
            // caches retain invalidated and potentially corrupt data!
            // NOTE:
            // NitroCast only allows collection caching on objects that do not
            // have any children objects to minimize potential corruption.
            invalidateCachedCollections();
            return(id);
        }
Exemplo n.º 12
0
 public int IndexOf(DojoPromotionFlag value)
 {
     lock (this)
     {
         for (int x = 0; x < count; x++)
         {
             if (DojoPromotionFlagArray[x].Equals(value))
             {
                 return(x);
             }
         }
         return(-1);
     }
 }
Exemplo n.º 13
0
        internal static bool _fill(DojoPromotionFlag dojoPromotionFlag)
        {
            // Clone item from cache.
            if (cacheEnabled)
            {
                object cachedObject = cacheFind(dojoPromotionFlag.iD);
                if (cachedObject != null)
                {
                    ((DojoPromotionFlag)cachedObject).CopyTo(dojoPromotionFlag, true);
                    return(dojoPromotionFlag.isSynced);
                }
            }

            StringBuilder query;
            Database      database;
            DbCommand     dbCommand;

            query = new StringBuilder("SELECT ");
            query.Append(string.Join(",", InnerJoinFields));
            query.Append(" FROM kitTessen_PromotionFlags WHERE DojoPromotionFlagID=");
            query.Append(dojoPromotionFlag.iD);
            query.Append(";");

            database  = DatabaseFactory.CreateDatabase();
            dbCommand = database.GetSqlStringCommand(query.ToString());
            IDataReader r = database.ExecuteReader(dbCommand);

            if (!r.Read())
            {
                throw(new Exception(string.Format("Cannot find DojoPromotionFlagID '{0}'.",
                                                  dojoPromotionFlag.iD)));
            }

            FillFromReader(dojoPromotionFlag, r, 0, 1);

            // Microsoft DAAB still needs to have the reader closed.
            r.Close();

            // Store dojoPromotionFlag in cache.
            if (cacheEnabled)
            {
                cacheStore(dojoPromotionFlag);
            }

            return(true);
        }
Exemplo n.º 14
0
 public int Add(DojoPromotionFlag value)
 {
     OnCollectionChanged(EventArgs.Empty);
     lock (this)
     {
         count++;
         // Resize the array if the count is greater than the length
         // of the array.
         if (count > DojoPromotionFlagArray.GetUpperBound(0) + 1)
         {
             DojoPromotionFlag[] tempDojoPromotionFlagArray = new DojoPromotionFlag[count * 2];
             Array.Copy(DojoPromotionFlagArray, tempDojoPromotionFlagArray, count - 1);
             DojoPromotionFlagArray = tempDojoPromotionFlagArray;
         }
         DojoPromotionFlagArray[count - 1] = value;
     }
     return(count - 1);
 }
Exemplo n.º 15
0
 public void Insert(int index, DojoPromotionFlag value)
 {
     OnCollectionChanged(EventArgs.Empty);
     lock (this)
     {
         count++;
         // Resize the array if the count is greater than the length
         // of the array.
         if (count > DojoPromotionFlagArray.GetUpperBound(0) + 1)
         {
             DojoPromotionFlag[] tempDojoPromotionFlagArray = new DojoPromotionFlag[count * 2];
             Array.Copy(DojoPromotionFlagArray, tempDojoPromotionFlagArray, count - 1);
             DojoPromotionFlagArray = tempDojoPromotionFlagArray;
         }
         for (int x = index + 1; x == count - 2; x++)
         {
             DojoPromotionFlagArray[x] = DojoPromotionFlagArray[x - 1];
         }
         DojoPromotionFlagArray[index] = value;
     }
 }
Exemplo n.º 16
0
        internal static int _update(DojoPromotionFlag dojoPromotionFlag)
        {
            Database  database;
            DbCommand dbCommand;

            database = DatabaseFactory.CreateDatabase();

            dbCommand = database.GetSqlStringCommand("UPDATE kitTessen_PromotionFlags SET Name=@Name WHERE DojoPromotionFlagID=@DojoPromotionFlagID;");

            fillParameters(database, dbCommand, dojoPromotionFlag);
            database.AddInParameter(dbCommand, "DojoPromotionFlagID", DbType.Int32, dojoPromotionFlag.iD);
            // Abandon remaining updates if no rows have been updated by returning false immediately.
            if (database.ExecuteNonQuery(dbCommand) == 0)
            {
                return(-1);
            }

            // Store dojoPromotionFlag in cache.
            if (cacheEnabled)
            {
                cacheStore(dojoPromotionFlag);
            }
            // ************************* WARNING ****************************
            // Update operations must invalidate the cached collections.
            // Invalidation MUST invalidate any foreign cached collections that
            // with children objects this manager provides or else the foreign
            // caches retain invalidated and potentially corrupt data!
            // NOTE:
            // NitroCast only allows collection caching on objects that do not
            // have any children objects to minimize potential corruption.
            // ************************* WARNING ****************************

            invalidateCachedCollections();

            return(dojoPromotionFlag.iD);
        }
Exemplo n.º 17
0
        private static void cacheStore(DojoPromotionFlag dojoPromotionFlag)
        {
            CacheManager cache = CacheFactory.GetCacheManager();

            cache.Add("kitTessen_PromotionFlags_" + dojoPromotionFlag.iD.ToString(), dojoPromotionFlag);
        }
Exemplo n.º 18
0
 /// <summary>
 /// Deep copies the current DojoPromotionFlag to another instance of DojoPromotionFlag.
 /// This method does not provide isolated copies; use overriden method for this feature.
 /// </summary>
 /// <param name="DojoPromotionFlag">The DojoPromotionFlag to copy to.</param>
 public void CopyTo(DojoPromotionFlag dojoPromotionFlag)
 {
     CopyTo(dojoPromotionFlag, false);
 }
Exemplo n.º 19
0
        /// <summary>
        /// Compares the object's ID to another object's ID.
        /// </summary>
        int IComparable.CompareTo(object obj)
        {
            DojoPromotionFlag dojoPromotionFlag = (DojoPromotionFlag)obj;

            return(this.iD - dojoPromotionFlag.iD);
        }
Exemplo n.º 20
0
        public DojoPromotionFlagCollection GetCollection(int topCount, string whereClause, string sortClause)
        {
            StringBuilder query;
            Database      database;
            DbCommand     dbCommand;
            IDataReader   r;
            DojoPromotionFlagCollection dojoPromotionFlagCollection;
            int hashcode;

            // Cache Handling

            hashcode = 0;

            if (cacheEnabled)
            {
                hashcode = topCount.GetHashCode() +
                           whereClause.GetHashCode() +
                           sortClause.GetHashCode() +
                           tableName.GetHashCode();

                DojoPromotionFlagCollection collection = cacheFindCollection(hashcode);
                if (collection != null)
                {
                    return(collection);
                }
            }


            query = new StringBuilder("SELECT ");

            if (topCount > 0)
            {
                query.Append("TOP ");
                query.Append(topCount);
                query.Append(" ");
            }

            foreach (string columnName in InnerJoinFields)
            {
                query.Append("DojoPromotionFlag.");
                query.Append(columnName);
                query.Append(",");
            }

            //
            // Remove trailing comma
            //
            query.Length--;
            query.Append(" FROM kitTessen_PromotionFlags AS DojoPromotionFlag");
            //
            // Render where clause
            //
            if (whereClause != string.Empty)
            {
                query.Append(" WHERE ");
                query.Append(whereClause);
            }

            //
            // Render sort clause
            //
            if (sortClause != string.Empty)
            {
                query.Append(" ORDER BY ");
                query.Append(sortClause);
            }

            //
            // Render final semicolon
            //
            query.Append(";");
            database  = DatabaseFactory.CreateDatabase();
            dbCommand = database.GetSqlStringCommand(query.ToString());
                        #if DEBUG
            try
            {
                r = database.ExecuteReader(dbCommand);
            }
            catch (Exception e)
            {
                string msg = e.Message;
                throw(new Exception(msg + " --- Query: " + query.ToString()));
            }
                        #else
            r = database.ExecuteReader(dbCommand);
                        #endif

            dojoPromotionFlagCollection = new DojoPromotionFlagCollection();

            while (r.Read())
            {
                DojoPromotionFlag dojoPromotionFlag = ParseFromReader(r, 0, 1);

                dojoPromotionFlagCollection.Add(dojoPromotionFlag);
            }

            // Microsoft DAAB still needs to close readers.
            r.Close();

            if (cacheEnabled)
            {
                cacheStoreCollection(hashcode, dojoPromotionFlagCollection);
            }

            return(dojoPromotionFlagCollection);
        }
Exemplo n.º 21
0
 /// <summary>
 /// Compares the object's ID to another object's ID.
 /// </summary>
 public int CompareTo(DojoPromotionFlag dojoPromotionFlag)
 {
     return(this.iD - dojoPromotionFlag.iD);
 }
Exemplo n.º 22
0
 public bool Contains(DojoPromotionFlag value)
 {
     return(IndexOf(value) != -1);
 }