public HttpResponseMessage GetProductsItems( string officeNumber, string manufacturer, string lensType, string lensStyle, string lensCategory, bool activeOnly) { int? lensStyleId = null; int? lensTypeId = null; bool? active = null; string manufacturerId = null; bool? hardLens; if (!string.IsNullOrEmpty(lensType) && lensType != "0") { lensTypeId = int.Parse(lensType); } if (!string.IsNullOrEmpty(lensStyle) && lensStyle != "0") { lensStyleId = int.Parse(lensStyle); } if (manufacturer != "0") { manufacturerId = manufacturer; } if (activeOnly) { active = true; } switch (lensCategory) { case "1": ////Hard Contact Lens hardLens = true; break; case "2": ////Soft Contact Lens hardLens = false; break; default: hardLens = null; break; } var itemGroups = ProductsIt2Manager.GetItemGroups(); var enumerable = itemGroups as IList <Item> ?? itemGroups.ToList(); var items = this.productsManager.SearchProducts(officeNumber, manufacturerId, lensStyleId, lensTypeId, hardLens, active); return(this.Request.CreateResponse( HttpStatusCode.OK, new { ProductsSetupItems = items, ItemGroups = enumerable.Select(ItemGroupVm.FromItem) })); }
/// <summary>The get all lens types.</summary> /// <returns>The list.</returns> private static List <SelectListItem> GetAllLensTypes() { var result = new List <SelectListItem> { new SelectListItem { Selected = false, Text = "Select", Value = "0" } }; var lookups = ProductsIt2Manager.GetAllLensTypes(); lookups.ForEach(l => result.Add(new SelectListItem { Selected = false, Text = l.Description, Value = l.Key + string.Empty })); return(result); }
/// <summary>The get all style names.</summary> /// <param name="manufacturerId">The manufacturer Id.</param> /// <returns>The list.</returns> private static List <SelectListItem> GetStyleNames(string manufacturerId) { var result = new List <SelectListItem>(); var lookups = ProductsIt2Manager.GetStyleNames(manufacturerId); if (lookups.Count > 0) { result.Add(new SelectListItem { Selected = false, Text = "Select", Value = "0" }); lookups.ForEach(l => result.Add(new SelectListItem { Selected = false, Text = l.Description, Value = l.Key + string.Empty })); } return(result); }