protected virtual User_CategoryRow MapRow(DataRow row)
        {
            User_CategoryRow mappedObject = new User_CategoryRow();
            DataTable        dataTable    = row.Table;
            DataColumn       dataColumn;

            // Column "UC_ID"
            dataColumn = dataTable.Columns["UC_ID"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.UC_ID = (int)row[dataColumn];
            }
            // Column "UP_ID"
            dataColumn = dataTable.Columns["UP_ID"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.UP_ID = (int)row[dataColumn];
            }
            // Column "Cat_ID"
            dataColumn = dataTable.Columns["Cat_ID"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Cat_ID = (int)row[dataColumn];
            }
            return(mappedObject);
        }
        public virtual bool Update(User_CategoryRow value)
        {
            string sqlStr = "UPDATE [dbo].[User_Category] SET " +
                            "[UP_ID]=" + _db.CreateSqlParameterName("UP_ID") + ", " +
                            "[Cat_ID]=" + _db.CreateSqlParameterName("Cat_ID") +
                            " WHERE " +
                            "[UC_ID]=" + _db.CreateSqlParameterName("UC_ID");
            IDbCommand cmd = _db.CreateCommand(sqlStr);

            AddParameter(cmd, "UP_ID",
                         value.IsUP_IDNull ? DBNull.Value : (object)value.UP_ID);
            AddParameter(cmd, "Cat_ID",
                         value.IsCat_IDNull ? DBNull.Value : (object)value.Cat_ID);
            AddParameter(cmd, "UC_ID", value.UC_ID);
            return(0 != cmd.ExecuteNonQuery());
        }
        public virtual void Insert(User_CategoryRow value)
        {
            string sqlStr = "INSERT INTO [dbo].[User_Category] (" +
                            "[UP_ID], " +
                            "[Cat_ID]" +
                            ") VALUES (" +
                            _db.CreateSqlParameterName("UP_ID") + ", " +
                            _db.CreateSqlParameterName("Cat_ID") + ");SELECT @@IDENTITY";
            IDbCommand cmd = _db.CreateCommand(sqlStr);

            AddParameter(cmd, "UP_ID",
                         value.IsUP_IDNull ? DBNull.Value : (object)value.UP_ID);
            AddParameter(cmd, "Cat_ID",
                         value.IsCat_IDNull ? DBNull.Value : (object)value.Cat_ID);
            value.UC_ID = Convert.ToInt32(cmd.ExecuteScalar());
        }
        protected virtual User_CategoryRow[] 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 uc_idColumnIndex  = reader.GetOrdinal("UC_ID");
            int up_idColumnIndex  = reader.GetOrdinal("UP_ID");
            int cat_IDColumnIndex = reader.GetOrdinal("Cat_ID");

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

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

                    record.UC_ID = Convert.ToInt32(reader.GetValue(uc_idColumnIndex));
                    if (!reader.IsDBNull(up_idColumnIndex))
                    {
                        record.UP_ID = Convert.ToInt32(reader.GetValue(up_idColumnIndex));
                    }
                    if (!reader.IsDBNull(cat_IDColumnIndex))
                    {
                        record.Cat_ID = Convert.ToInt32(reader.GetValue(cat_IDColumnIndex));
                    }

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

            totalRecordCount = 0 == totalRecordCount ? ri + startIndex : -1;
            return((User_CategoryRow[])(recordList.ToArray(typeof(User_CategoryRow))));
        }
 public bool Delete(User_CategoryRow value)
 {
     return(DeleteByPrimaryKey(value.UC_ID));
 }