Hello,
You can set the customer's (not the User) discount level by getting the
CustomerInfo object and setting its
CustomerDiscountLevelID property.
That can be obtained like:
DiscountLevelInfo dli = DiscountLevelInfoProvider.
GetDiscountLevelInfo("discountLevenCodeName");
After checking it for null --
if (dli != null) --
you can select older customers by comparing
CustomerCreated datetime property in the where condition of the
CustomerInfoProvider method
GetCustomers like:
DataSet oldCustomers = CustomerInfoProvider.
GetCustomers("CustomerCreated < '1/1/2010 00:00:00'", "");
Then, you can loop through this DataSet:
if (!DataHelper.DataSourceIsEmpty(oldCustomers) && (oldCustomers.Tables[0].Rows.Count > 1))
{
foreach (DataRow dr in oldCustomers.Tables[0])
{
ci = new CustomerInfo(dr);
ci.CustomerDiscountLevelID = dli.DiscountLevelID;
CustomerInfoProvider.SetCustomerInfo(ci);
}
}
And that should be all...
Regards,
Zdenek