public static List<Object> GetDepItem(string id = "") { DepartmentService s = new DepartmentService(); string itemid = id; List<object> itemlist = new List<object>(); itemlist = s.getItemByDep(id); return itemlist; }
public RequisitionItemByDepartment[] GetDataItemByDepartment(String itemID) { DepartmentService department = new DepartmentService(); var objItemByDepartment = department.getItemByDep(itemID); RequisitionItemByDepartment[] itemList = new RequisitionItemByDepartment[objItemByDepartment.Count]; int count = 0; foreach (var obj in objItemByDepartment) { RequisitionItemByDepartment d = new RequisitionItemByDepartment(); Type t = obj.GetType(); PropertyInfo dep_ID = t.GetProperty("DepID"); PropertyInfo item_Description = t.GetProperty("ItemDescription"); PropertyInfo dep_Name = t.GetProperty("DepName"); PropertyInfo required_Qty = t.GetProperty("Required_Quantity"); d.DepID = dep_ID.GetValue(obj, null).ToString(); d.DepName = dep_Name.GetValue(obj, null).ToString(); d.ItemDescription = item_Description.GetValue(obj, null).ToString(); d.Required_Quantity = required_Qty.GetValue(obj, null).ToString(); itemList.SetValue(d,count); count++; } return itemList; }