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

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

            AddParameter(cmd, "CU_ID",
                         value.IsCU_IDNull ? DBNull.Value : (object)value.CU_ID);
            AddParameter(cmd, "Role_ID",
                         value.IsRole_IDNull ? DBNull.Value : (object)value.Role_ID);
            AddParameter(cmd, "CUR_ID", value.CUR_ID);
            return(0 != cmd.ExecuteNonQuery());
        }
        public virtual void Insert(Channel_User_RoleRow value)
        {
            string sqlStr = "INSERT INTO [dbo].[Channel_User_Role] (" +
                            "[CU_ID], " +
                            "[Role_ID]" +
                            ") VALUES (" +
                            _db.CreateSqlParameterName("CU_ID") + ", " +
                            _db.CreateSqlParameterName("Role_ID") + ");SELECT @@IDENTITY";
            IDbCommand cmd = _db.CreateCommand(sqlStr);

            AddParameter(cmd, "CU_ID",
                         value.IsCU_IDNull ? DBNull.Value : (object)value.CU_ID);
            AddParameter(cmd, "Role_ID",
                         value.IsRole_IDNull ? DBNull.Value : (object)value.Role_ID);
            value.CUR_ID = Convert.ToInt32(cmd.ExecuteScalar());
        }
        protected virtual Channel_User_RoleRow[] 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 cur_idColumnIndex  = reader.GetOrdinal("CUR_ID");
            int cu_idColumnIndex   = reader.GetOrdinal("CU_ID");
            int role_IDColumnIndex = reader.GetOrdinal("Role_ID");

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

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

                    record.CUR_ID = Convert.ToInt32(reader.GetValue(cur_idColumnIndex));
                    if (!reader.IsDBNull(cu_idColumnIndex))
                    {
                        record.CU_ID = Convert.ToInt32(reader.GetValue(cu_idColumnIndex));
                    }
                    if (!reader.IsDBNull(role_IDColumnIndex))
                    {
                        record.Role_ID = Convert.ToInt32(reader.GetValue(role_IDColumnIndex));
                    }

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

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