I am trying to write a modification to the call for price feature. I want to have a checkbox on the product variant info page that shows up when you check call for price, that says something like "Exclude set roles". Basically what I want to happen is if the Prices By Customer Role is set and someone logs in under that role they will see and be able to purchase the item at the price set for their role.

This post is almost what I need but either I'm doing something wrong or the code isn't valid in the current version (1.9): https://www.nopcommerce.com/Boards/Topic.aspx?TopicID=258

I'm kind of a newbie with .NET, but when I try to compile I get this:
Error  4  The type or namespace name 'CustomerRoleCollection' could not be found (are you missing a using directive or an assembly reference?)  C:\Development\nopCommerce\nopCommerce_1.90_Source Folder\nopCommerce_1.90_Source Folder\NopCommerceStore\Modules\ProductPrice1.ascx.cs  211  17  NopCommerceStore

Error  5  The type or namespace name 'CustomerRoleCollection' could not be found (are you missing a using directive or an assembly reference?)  C:\Development\nopCommerce\nopCommerce_1.90_Source Folder\nopCommerce_1.90_Source Folder\NopCommerceStore\Modules\ProductPrice1.ascx.cs  211  60  NopCommerceStore

Error  6  The name 'CustomerManager' does not exist in the current context  C:\Development\nopCommerce\nopCommerce_1.90_Source Folder\nopCommerce_1.90_Source Folder\NopCommerceStore\Modules\ProductPrice1.ascx.cs  214  37  NopCommerceStore


However, even if that did compile, it's not exactly what I need. I need to check if the customers role(s) have a price set. Can anyone point me to where that might be?

Here's my code (ProductPrice1.ascx.cs):
//------------------------------------------------------------------------------
// The contents of this file are subject to the nopCommerce Public License Version 1.0 ("License"); you may not use this file except in compliance with the License.
// You may obtain a copy of the License at  https://www.nopcommerce.com/License.aspx.
//
// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
// See the License for the specific language governing rights and limitations under the License.
//
// The Original Code is nopCommerce.
// The Initial Developer of the Original Code is NopSolutions.
// All Rights Reserved.
//
// Contributor(s): _______.
//------------------------------------------------------------------------------

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Text;
using System.Threading;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using NopSolutions.NopCommerce.BusinessLogic;
using NopSolutions.NopCommerce.BusinessLogic.Configuration.Settings;
using NopSolutions.NopCommerce.BusinessLogic.CustomerManagement;
using NopSolutions.NopCommerce.BusinessLogic.Directory;
using NopSolutions.NopCommerce.BusinessLogic.Localization;
using NopSolutions.NopCommerce.BusinessLogic.Products;
using NopSolutions.NopCommerce.BusinessLogic.Tax;
using NopSolutions.NopCommerce.Common.Utils;
using System.Text.RegularExpressions;
using System.Globalization;
using NopSolutions.NopCommerce.BusinessLogic.Infrastructure;

namespace NopSolutions.NopCommerce.Web.Modules
{
    public partial class ProductPrice1Control: BaseNopFrontendUserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                BindData();
            }
        }

        private void BindData()
        {
            var productVariant = this.ProductService.GetProductVariantById(this.ProductVariantId);
            if (productVariant != null)
            {
                if (!this.SettingManager.GetSettingValueBoolean("Common.HidePricesForNonRegistered") ||
                        (NopContext.Current.User != null &&
                        !NopContext.Current.User.IsGuest))
                {
                    if (productVariant.CustomerEntersPrice)
                    {
                        phOldPrice.Visible = false;
                        lblPrice.Visible = false;
                        lblPriceValue.Visible = false;
                        phDiscount.Visible = false;

                        lblCustomerEnterPrice.Visible = true;
                        lblCustomerEnterPrice.Text = GetLocaleResourceString("Products.EnterProductPrice");
                    }
                    else
                    {
                        if (productVariant.CallForPrice)
                        {
                            //Begin Modification for Exclude Roles JEH 02-07-2011
                            var productVariantOverrideForRoles = true; //temporary variant for checkbox
                            if (!productVariantOverrideForRoles)
                            {
                                //default call for price function
                                lblPriceValue.Text = GetLocaleResourceString("Products.CallForPrice");
                                phOldPrice.Visible = false;
                                phDiscount.Visible = false;
                            }
                            else
                            {
                                if (!String.IsNullOrEmpty(getCustomerRole))
                                {
                                    //show price for roles only;
                                    phOldPrice.Visible = true; //haven't tested this
                                    phDiscount.Visible = true; //haven't tested this
                                }
                            }
                            //End Modification for Exclude Roles JEH 02-07-2011

                        }
                        else
                        {
                            decimal taxRate = decimal.Zero;
                            decimal oldPriceBase = this.TaxService.GetPrice(productVariant, productVariant.OldPrice, out taxRate);
                            decimal finalPriceWithoutDiscountBase = this.TaxService.GetPrice(productVariant, PriceHelper.GetFinalPrice(productVariant, false), out taxRate);
                            decimal finalPriceWithDiscountBase = this.TaxService.GetPrice(productVariant, PriceHelper.GetFinalPrice(productVariant, true), out taxRate);

                            decimal oldPrice = this.CurrencyService.ConvertCurrency(oldPriceBase, this.CurrencyService.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
                            decimal finalPriceWithoutDiscount = this.CurrencyService.ConvertCurrency(finalPriceWithoutDiscountBase, this.CurrencyService.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
                            decimal finalPriceWithDiscount = this.CurrencyService.ConvertCurrency(finalPriceWithDiscountBase, this.CurrencyService.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);

                            if (finalPriceWithoutDiscountBase != oldPriceBase && oldPriceBase > decimal.Zero)
                            {
                                lblOldPrice.Text = PriceHelper.FormatPrice(oldPrice);
                                lblPriceValue.Text = PriceHelper.FormatPrice(finalPriceWithoutDiscount);
                                phOldPrice.Visible = true;
                            }
                            else
                            {
                                lblPriceValue.Text = PriceHelper.FormatPrice(finalPriceWithoutDiscount);
                                phOldPrice.Visible = false;
                            }

                            if (finalPriceWithoutDiscountBase != finalPriceWithDiscountBase)
                            {
                                lblFinalPriceWithDiscount.Text = PriceHelper.FormatPrice(finalPriceWithDiscount);
                                phDiscount.Visible = true;
                            }
                            else
                            {
                                phDiscount.Visible = false;
                            }

                            if (phDiscount.Visible)
                            {
                                lblPriceValue.CssClass = string.Empty;
                            }
                            else
                            {
                                lblPriceValue.CssClass = "productPrice";
                            }

                            if (phDiscount.Visible || phOldPrice.Visible)
                            {
                                lblPrice.Text = GetLocaleResourceString("Products.FinalPriceWithoutDiscount");
                            }
                            if (this.SettingManager.GetSettingValueBoolean("ProductAttribute.EnableDynamicPriceUpdate"))
                            {
                                string pattern = this.SettingManager.GetSettingValue("ProductAttribute.PricePattern", "(?<val>(\\d+[\\s\\,\\.]?)+)");
                                string replacement = String.Format("<span class=\"price-val-for-dyn-upd-{0}\">${{val}}</span> ", productVariant.ProductVariantId);

                                if (finalPriceWithoutDiscountBase != finalPriceWithDiscountBase)
                                {
                                    lblFinalPriceWithDiscount.Text = Regex.Replace(lblFinalPriceWithDiscount.Text, pattern, replacement);
                                }
                                else
                                {
                                    lblPriceValue.Text = Regex.Replace(lblPriceValue.Text, pattern, replacement);
                                }
                            }
                        }
                    }
                }
                else
                {
                    this.Visible = false;
                }
            }
            else
            {
                this.Visible = false;
            }
        }

        protected override void OnPreRender(EventArgs e)
        {
            if(this.SettingManager.GetSettingValueBoolean("ProductAttribute.EnableDynamicPriceUpdate"))
            {
                var productVariant = this.ProductService.GetProductVariantById(this.ProductVariantId);
                if(productVariant != null && !productVariant.CallForPrice)
                {
                    decimal taxRate = decimal.Zero;
                    decimal finalPriceWithoutDiscountBase = this.TaxService.GetPrice(productVariant, PriceHelper.GetFinalPrice(productVariant, false), out taxRate);
                    decimal finalPriceWithoutDiscount = this.CurrencyService.ConvertCurrency(finalPriceWithoutDiscountBase, this.CurrencyService.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);

                    decimal finalPriceWithDiscountBase = this.TaxService.GetPrice(productVariant, PriceHelper.GetFinalPrice(productVariant, true), out taxRate);
                    decimal finalPriceWithDiscount = this.CurrencyService.ConvertCurrency(finalPriceWithDiscountBase, this.CurrencyService.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);

                    float val = (float)(finalPriceWithoutDiscountBase != finalPriceWithDiscountBase ? finalPriceWithDiscount : finalPriceWithoutDiscount);
                    string key = String.Format("PriceValForDynUpd_{0}", productVariant.ProductVariantId);
                    string script = String.Format(CultureInfo.InvariantCulture, "var priceValForDynUpd_{0} = {1};", productVariant.ProductVariantId, val);

                    Page.ClientScript.RegisterClientScriptBlock(GetType(), key, script, true);
                }
            }
            base.OnPreRender(e);
        }

        public int ProductVariantId
        {
            get
            {
                object obj2 = this.ViewState["ProductVariantId"];
                if (obj2 != null)
                    return (int)obj2;
                else
                    return 0;
            }
            set
            {
                this.ViewState["ProductVariantId"] = value;
            }
        }
        //Begin Modification for Exclude Roles JEH 02-07-2011
        public string getCustomerRole
        {
            get
            {
                CustomerRoleCollection customerRoles = new CustomerRoleCollection();
                if (NopContext.Current.User != null)
                {
                    customerRoles = CustomerManager.GetCustomerRolesByCustomerID(NopContext.Current.User.CustomerId);
                    CustomerRole customerRole = new CustomerRole();
                    foreach (CustomerRole custRole in customerRoles)
                    {
                        if (custRole.CustomerRoleID == 5)
                        {
                            customerRole = CustomerManager.GetCustomerRoleByID(custRole.CustomerRoleID);
                        }
                    }
                    return customerRole.Name;
                }
                return "";
            }
        }
        //End Modification for Exclude Roles JEH 02-07-2011
    }
}