OK, here is where I am. I figured out the code to change, and I have a general idea how to do it, but I need a little help figuring out the details. Here is what I have so far.
Code:
private void InitializeShippingMethodDisplayFormat(ShippingMethodCollection shippingMethods)
{
if (ThisCustomer.CustomerLevelID == 1)
{
using (SqlConnection con = new SqlConnection(DB.GetDBConn()))
{
con.Open();
using (IDataReader rs = DB.GetRS("SELECT * FROM ShippingMethod WHERE ShippingMethodID IN (SELECT ShippingMethodID FROM CustomerLevelShippingOption WHERE CustomerLevelID = 1) order by DisplayOrder,Name", con))
{
foreach (ShippingMethod shipMethod in shippingMethods)
{
shipMethod.DisplayFormat = string.Format("{0} {1}", shipMethod.Name, "");
}
}
}
}
else
{
using (SqlConnection con = new SqlConnection(DB.GetDBConn()))
{
con.Open();
using (IDataReader rs = DB.GetRS("SELECT * FROM ShippingMethod WHERE ShippingMethodID IN (SELECT ShippingMethodID FROM CustomerLevelShippingOption WHERE CustomerLevelID = 0) order by DisplayOrder,Name", con))
{
foreach (ShippingMethod shipMethod in shippingMethods)
{
shipMethod.DisplayFormat = string.Format("{0} {1}", shipMethod.Name, "");
}
}
}
}
}
If the concept is right, what I need to know is:
1. how should the foreach statements be written
2. how should the shipMethod.DisplayFormat line be rewritten
.NET is not my strongest which is why I am struggling with this part. Your help is greatly appreciated.