/// <summary>
        /// Adds a new record into the <c>tblRecentLog</c> table.
        /// </summary>
        /// <param name="value">The <see cref="tblRecentLogRow"/> object to be inserted.</param>
        public virtual void Insert(tblRecentLogRow value)
        {
            IDbCommand cmd = _db.CreateCommand("dbo._tblRecentLog_Insert", true);

            AddParameter(cmd, "Entity_Id", value.Entity_Id);
            AddParameter(cmd, "Recent_Log_Type", value.Recent_Log_Type);
            AddParameter(cmd, "Recent_Log_Time", value.Recent_Log_Time);
            AddParameter(cmd, "UserId", value.UserId);
            AddParameter(cmd, "Action", value.Action);
            value.Recent_Log_Id = Convert.ToInt32(cmd.ExecuteScalar());
        }
        /// <summary>
        /// Updates a record in the <c>tblRecentLog</c> table.
        /// </summary>
        /// <param name="value">The <see cref="tblRecentLogRow"/>
        /// object used to update the table record.</param>
        /// <returns>true if the record was updated; otherwise, false.</returns>
        public virtual bool Update(tblRecentLogRow value)
        {
            IDbCommand cmd = _db.CreateCommand("dbo._tblRecentLog_Update", true);

            AddParameter(cmd, "Entity_Id", value.Entity_Id);
            AddParameter(cmd, "Recent_Log_Type", value.Recent_Log_Type);
            AddParameter(cmd, "Recent_Log_Time", value.Recent_Log_Time);
            AddParameter(cmd, "UserId", value.UserId);
            AddParameter(cmd, "Action", value.Action);
            AddParameter(cmd, "Recent_Log_Id", value.Recent_Log_Id);
            return(0 != cmd.ExecuteNonQuery());
        }
        /// <summary>
        /// Reads data from the provided data reader and returns
        /// an array of mapped objects.
        /// </summary>
        /// <param name="reader">The <see cref="System.Data.IDataReader"/> object to read data from the table.</param>
        /// <param name="startIndex">The index of the first record to map.</param>
        /// <param name="length">The number of records to map.</param>
        /// <param name="totalRecordCount">A reference parameter that returns the total number
        /// of records in the reader object if 0 was passed into the method; otherwise it returns -1.</param>
        /// <returns>An array of <see cref="tblRecentLogRow"/> objects.</returns>
        protected virtual tblRecentLogRow[] MapRecords(IDataReader reader,
                                                       int startIndex, int length, ref int totalRecordCount)
        {
            if (0 > startIndex)
            {
                throw new ArgumentOutOfRangeException("startIndex", startIndex, "StartIndex cannot be less than zero.");
            }
            if (0 > length)
            {
                throw new ArgumentOutOfRangeException("length", length, "Length cannot be less than zero.");
            }

            int recent_Log_IdColumnIndex   = reader.GetOrdinal("Recent_Log_Id");
            int entity_IdColumnIndex       = reader.GetOrdinal("Entity_Id");
            int recent_Log_TypeColumnIndex = reader.GetOrdinal("Recent_Log_Type");
            int recent_Log_TimeColumnIndex = reader.GetOrdinal("Recent_Log_Time");
            int userIdColumnIndex          = reader.GetOrdinal("UserId");
            int actionColumnIndex          = reader.GetOrdinal("Action");

            System.Collections.ArrayList recordList = new System.Collections.ArrayList();
            int ri = -startIndex;

            while (reader.Read())
            {
                ri++;
                if (ri > 0 && ri <= length)
                {
                    tblRecentLogRow record = new tblRecentLogRow();
                    recordList.Add(record);

                    record.Recent_Log_Id   = Convert.ToInt32(reader.GetValue(recent_Log_IdColumnIndex));
                    record.Entity_Id       = Convert.ToInt32(reader.GetValue(entity_IdColumnIndex));
                    record.Recent_Log_Type = Convert.ToInt32(reader.GetValue(recent_Log_TypeColumnIndex));
                    record.Recent_Log_Time = Convert.ToDateTime(reader.GetValue(recent_Log_TimeColumnIndex));
                    record.UserId          = Convert.ToInt32(reader.GetValue(userIdColumnIndex));
                    record.Action          = Convert.ToString(reader.GetValue(actionColumnIndex));

                    if (ri == length && 0 != totalRecordCount)
                    {
                        break;
                    }
                }
            }

            totalRecordCount = 0 == totalRecordCount ? ri + startIndex : -1;
            return((tblRecentLogRow[])(recordList.ToArray(typeof(tblRecentLogRow))));
        }
        /// <summary>
        /// Converts <see cref="System.Data.DataRow"/> to <see cref="tblRecentLogRow"/>.
        /// </summary>
        /// <param name="row">The <see cref="System.Data.DataRow"/> object to be mapped.</param>
        /// <returns>A reference to the <see cref="tblRecentLogRow"/> object.</returns>
        protected virtual tblRecentLogRow MapRow(DataRow row)
        {
            tblRecentLogRow mappedObject = new tblRecentLogRow();
            DataTable       dataTable    = row.Table;
            DataColumn      dataColumn;

            // Column "Recent_Log_Id"
            dataColumn = dataTable.Columns["Recent_Log_Id"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Recent_Log_Id = (int)row[dataColumn];
            }
            // Column "Entity_Id"
            dataColumn = dataTable.Columns["Entity_Id"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Entity_Id = (int)row[dataColumn];
            }
            // Column "Recent_Log_Type"
            dataColumn = dataTable.Columns["Recent_Log_Type"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Recent_Log_Type = (int)row[dataColumn];
            }
            // Column "Recent_Log_Time"
            dataColumn = dataTable.Columns["Recent_Log_Time"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Recent_Log_Time = (System.DateTime)row[dataColumn];
            }
            // Column "UserId"
            dataColumn = dataTable.Columns["UserId"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.UserId = (int)row[dataColumn];
            }
            // Column "Action"
            dataColumn = dataTable.Columns["Action"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Action = (string)row[dataColumn];
            }
            return(mappedObject);
        }
 /// <summary>
 /// Deletes the specified object from the <c>tblRecentLog</c> table.
 /// </summary>
 /// <param name="value">The <see cref="tblRecentLogRow"/> object to delete.</param>
 /// <returns>true if the record was deleted; otherwise, false.</returns>
 public bool Delete(tblRecentLogRow value)
 {
     return(DeleteByPrimaryKey(value.Recent_Log_Id));
 }