//build Organizations Hierarchy tree public JsonResult json_readWorkFlow() { sqlServer db = new sqlServer(connString); DataTable dt = db.fetch("select * from dbo.organization").Tables[0]; //build tree List <Classes.organization> tree = new List <Classes.organization> { }; for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["parent_org_id"].ToString() == "") { var node = new Classes.organization() { org_id = dt.Rows[i][0].ToString(), parent_org_id = dt.Rows[i][1].ToString(), org_name = dt.Rows[i][2].ToString(), logo = "/jsplugins/workflow/images/" + dt.Rows[i][6].ToString(), children = new List <Classes.organization>(), //assignedUsers = this.getTaskAssignedUsers(Convert.ToUInt16(dt.Rows[i][0])) }; tree.Add(node); } } for (int j = 0; j < tree.Count; j++) { this.RecTree(tree[j], dt); } return(Json(tree, JsonRequestBehavior.AllowGet)); }
public static organization getOrgDetails(string org_id) { sqlServer db = new sqlServer(""); DataTable dt = db.fetch("select * from organization where org_id=" + org_id).Tables[0]; organization data = new organization(); data = new organization() { org_id = dt.Rows[0][0].ToString(), parent_org_id = dt.Rows[0][1].ToString(), org_name = dt.Rows[0][2].ToString(), street = dt.Rows[0][3].ToString(), city = dt.Rows[0][4].ToString(), postalcode = dt.Rows[0][5].ToString() }; return data; }
public static organization getOrgDetails(string org_id) { sqlServer db = new sqlServer(""); DataTable dt = db.fetch("select * from organization where org_id=" + org_id).Tables[0]; organization data = new organization(); data = new organization() { org_id = dt.Rows[0][0].ToString(), parent_org_id = dt.Rows[0][1].ToString(), org_name = dt.Rows[0][2].ToString(), street = dt.Rows[0][3].ToString(), city = dt.Rows[0][4].ToString(), postalcode = dt.Rows[0][5].ToString() }; return(data); }
public void RecTree(Classes.organization node, DataTable dt) { for (int j = 0; j < dt.Rows.Count; j++) { if (dt.Rows[j]["parent_org_id"].ToString() == node.org_id) { var _node = new Classes.organization() { org_id = dt.Rows[j][0].ToString(), parent_org_id = dt.Rows[j][1].ToString(), org_name = dt.Rows[j][2].ToString(), logo = "/jsplugins/workflow/images/" + dt.Rows[j][6].ToString(), children = new List <Classes.organization>(), //assignedUsers = this.getTaskAssignedUsers(Convert.ToUInt16(dt.Rows[j][0])) }; node.children.Add(_node); } } for (int j = 0; j < node.children.Count; j++) { RecTree(node.children[j], dt); } }