/// <summary> /// This method allows to get the document's childs by id /// </summary> /// <param name="parentCategory"> /// The category's id that we want to find its children /// </param> /// <author> /// Abigail Rodriguez /// </author> /// <returns> /// Returns an array with the information needed to represent a tree /// only tipo = 1, location type /// </returns> public JsonResult getNodeContent(String parentCategory) { if (parentCategory == "") { parentCategory = "null"; } String categoriesString = locationTable.Get("parent", parentCategory); if (categoriesString == null) { return(null); //there are no subcategories } JArray categoriesObject = JsonConvert.DeserializeObject <JArray>(categoriesString); JArray categoryResult = new JArray(); foreach (JObject category in categoriesObject) { if (category["tipo"].ToString() == "1") { try { //try to remove customFields, if can't be removed it doesn't care category.Remove("profileFields"); } catch (Exception e) { /*Ignored*/ } try { category.Remove("parentCategory"); } catch (Exception e) { /*Ignored*/ } try { category.Remove("CreatedDate"); } catch (Exception e) { /*Ignored*/ } try { category.Remove("LastmodDate"); } catch (Exception e) { /*Ignored*/ } try { category.Remove("map"); } catch (Exception e) { /*Ignored*/ } try { category.Remove("imgext"); } catch (Exception e) { /*Ignored*/ } categoryResult.Add(category); } } String categoryResultString = JsonConvert.SerializeObject(categoryResult); return(Json(categoryResultString)); }
public ActionResult Index() { bool access = getpermissions("location", "r"); if (access == true) { string rowArray = locationTable.Get("tipo", "2"); // string rowArray = locationTable.GetRows(); JArray locat = JsonConvert.DeserializeObject <JArray>(rowArray); Dictionary <string, string> data = new Dictionary <string, string>(); foreach (JObject items in locat) { data.Add(items["_id"].ToString(), items["name"].ToString()); } ViewData["locations"] = data; rowArray = _processesTable.GetRows(); locat = JsonConvert.DeserializeObject <JArray>(rowArray); data = new Dictionary <string, string>(); foreach (JObject items in locat) { data.Add(items["_id"].ToString(), items["name"].ToString()); } ViewData["processes"] = data; rowArray = _diagramTable.GetRows(); locat = JsonConvert.DeserializeObject <JArray>(rowArray); data = new Dictionary <string, string>(); foreach (JObject items in locat) { data.Add(items["_id"].ToString(), items["name"].ToString()); } ViewData["diagrams"] = data; return(View()); } else { return(Redirect("~/Home")); } }
public JsonResult getNodes(string parentCategory) { if (this.Request.IsAjaxRequest()) //only available with AJAX { if (parentCategory == null || parentCategory == "") { parentCategory = "null"; } String docs = locationTable.Get("parent", parentCategory); //getting all the users JArray objs = JsonConvert.DeserializeObject <JArray>(docs); return(Json(JsonConvert.SerializeObject(objs))); } else { return(null); } }
public ulong GetLocationId(string function) => _locationTable.Get(function);