Atomia.Web.Plugin.PublicOrder.Helpers.GeneralHelper.FilterPackages C# (CSharp) Метод

FilterPackages() публичный статический Метод

Filters the packages.
public static FilterPackages ( Controller controller, AtomiaBillingPublicService atomiaBillingPublicService, System.Guid accountId, System.Guid resellerId, string currencyCode, string countryCode, string filterValue ) : List
controller Controller The controller.
atomiaBillingPublicService AtomiaBillingPublicService The atomia billing public service.
accountId System.Guid The account id.
resellerId System.Guid The reseller id.
currencyCode string The currency code.
countryCode string The country code.
filterValue string The filter value.
Результат List
        public static List<RadioRow> FilterPackages(Controller controller, AtomiaBillingPublicService atomiaBillingPublicService, Guid accountId, Guid resellerId, string currencyCode, string countryCode, string filterValue)
        {
            string languageCode = null;
            if (controller.HttpContext.Session != null
                && controller.HttpContext.Session["SessionAccountLanguages"] != null)
            {
                AtomiaCultureInfo atomiaCultureInfo =
                    (AtomiaCultureInfo)controller.HttpContext.Session["SessionAccountLanguages"];
                languageCode = atomiaCultureInfo.Language;
            }

            List<RadioRow> packages = OrderModel.FetchPackagesData(controller, resellerId, null, accountId, currencyCode, countryCode, languageCode).ToList();
            if (!string.IsNullOrEmpty(filterValue))
            {
                // get all packages from the config
                IList<Product> packageProducts = GetProductProvider().GetShopProducts(resellerId, null, accountId, countryCode);
                packages = packages.Where(rr =>
                                              {
                                                  Product item = packageProducts.FirstOrDefault(p => p.ArticleNumber == rr.productId);
                                                  if (item == null)
                                                  {
                                                      return false;
                                                  }

                                                  string value;
                                                  if (item.Properties.TryGetValue("groups", out value))
                                                  {
                                                      return value
                                                          .ToString()
                                                          .Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)
                                                          .ToList()
                                                          .Exists(v => v == filterValue);
                                                  }

                                                  return false;
                                              }).ToList();
            }

            return packages;
        }