public ActionResult GetChildID(FormCollection form) { string bookID = form["BookID"]; string cataID = form["CataID"]; string cataIDs = DataBaseBLL.GetChildCataByCataID(Int32.Parse(bookID), Int32.Parse(cataID)); return(Json(cataIDs)); }
public ActionResult GetResourceTypeList(FormCollection form) { string bookID = form["BookID"]; string parentID = form["ParentID"]; List <ResourceType> list = new List <ResourceType>(); List <ResourceType> type_list = DataBaseBLL.GetResourceTypeList(); ResourceBLL resourceBLL = new ResourceBLL(); string cataIDs = DataBaseBLL.GetChildCataByCataID(Int32.Parse(bookID), Int32.Parse(parentID)); List <Resource> resource_list = resourceBLL.GetResourceList(cataIDs, 0, 0); foreach (var type in type_list) { var result = false; foreach (var resource in resource_list) { if (type.ID == resource.ResourceType && resource.ResourceStyle == 0) { list.Add(type); result = true; break; } } if (!result) { foreach (var child in type.Child) { foreach (var resource in resource_list) { if (child.ID == resource.ResourceStyle && child.ParentID == resource.ResourceType) { list.Add(child); result = true; break; } } } } } ResourceAndType modellist = new ResourceAndType(); modellist.ResourceList = resource_list; modellist.TypeList = list; return(Json(modellist)); }
public ActionResult GetResource(FormCollection form) { ResourceBLL resourceBLL = new ResourceBLL(); string bookID = form["BookID"]; string cataID = form["CataID"]; int resourceType = Int32.Parse(form["ResourceType"]); int resourceStyle = Int32.Parse(form["ResourceStyle"]); string cataIDs = DataBaseBLL.GetChildCataByCataID(Int32.Parse(bookID), Int32.Parse(cataID)); List <Resource> list = new List <Resource>(); if (resourceStyle == 0) { list = resourceBLL.GetResourceList(cataIDs, resourceType, resourceStyle); } else { list = resourceBLL.GetResourceList(cataIDs, resourceStyle, resourceType); } return(Json(list)); }