public List<Location> GetLocations(string itemNumber, string site, string warehouse, string userName) { IAXHelper axHelper = ObjectFactory.GetInstance<IAXHelper>(); List<Location> locationList = new List<Location>(); try { DataTable resultTable = axHelper.GetLocations(itemNumber, site, warehouse, userName); foreach (DataRow row in resultTable.Rows) { Location locationObject = new Location(); locationObject.LocationId = row["LocationID"].ToString(); locationObject.LocationQty = row["PhysicalQty"].ToString(); locationObject.LocationandQty = locationObject.LocationId + " [Qty - " + locationObject.LocationQty + " ]"; locationList.Add(locationObject); } } catch (Exception ex) { throw ex; } return locationList; }
private JsonResult _GetLocations(string itemNumber, string site, string warehouse) { string userName = User.Identity.Name.ToString().Split('\\')[1]; Location locationObject = new Location(); return Json(new SelectList(locationObject.GetLocations(itemNumber, site, warehouse, userName), "LocationId", "LocationandQty"), JsonRequestBehavior.AllowGet); }