private void getProductList(long userId) { int ecl = 0; int vcl = 0; Util.GetUserClearanceLevels(userId, out ecl, out vcl); List<Product> listProductInformation = new List<Product>(); using (Database db = new MySqlDatabase()) { ClientInfo ci = null; if (userId > -1) ci = db.GetClientInfo(userId); string currency = "EUR"; string countryIso2 = "NL"; string currencyFmt = "{0} {1:N2}"; if (ci != null) { countryIso2 = Util.GetCountryIso2(ci.Country); currency = Util.GetCurrencyIsoNameByCountryIso2("NL"); currencyFmt = Util.GetCurrencyFormatByCountryIso2("NL"); } string culture = "en-US"; if (Session["culture"] != null) culture = Session["culture"] as string; if (culture.Length == 2) { switch (culture) { case "nl": culture += "-NL"; break; case "en": culture += "US"; break; case "NL": culture = "nl-" + culture; break; case "US": culture = "en" + culture; break; } } ProductInfoList pil = db._GetProducts(); foreach (ProductInfo prod in pil) { String price = string.Empty; ProductPriceInfoList ppil = db.GetProductPrices(prod.ProductId, culture); if (ppil[0].Price > 0m) { price = string.Format( currencyFmt, Util.GetCurrencySymbolByCountryIso2("NL"), ppil[0].Price); } else { price = Resources.Resource.Quotation; } string desc = db.GetProduct_Desc_Price(prod.ProductId, culture); Product _product = new Product(); if (ecl >= 100 && vcl >= 100 && prod.ProductId == 4) _product.ProductPlan = Resources.Resource.ManagedPlan; else _product.ProductPlan = prod.ProductPlan; if (prod.Credits <= 0) _product.Credits = string.Empty; else _product.Credits = Convert.ToString(prod.Credits); _product.ProductDesc = desc.Split('#')[0]; _product.ProductPrice = desc.Split('#')[1]; _product.ProductId = prod.ProductId; _product.Extra = prod.Extra; if (ecl >= 100 && vcl >= 100 && prod.ProductId == 4) _product.Price = string.Empty; else _product.Price = price; listProductInformation.Add(_product); } if (ecl >= 100 && vcl >= 100) { List<Product> productInfoList = new List<Product>(); List<Product> unmanagedProductList = new List<Product>(); List<Product> managedProductList = new List<Product>(); int count = 0; foreach (Product product in listProductInformation) { if (count < 3) unmanagedProductList.Add(product); else managedProductList.Add(product); count++; } foreach (var _managedProduct in managedProductList) { productInfoList.Add(_managedProduct); } foreach (var _unmanagedProduct in unmanagedProductList) { productInfoList.Add(_unmanagedProduct); } ProductList.DataSource = productInfoList; } else { ProductList.DataSource = listProductInformation; } ProductList.DataBind(); } }