public void FetchMenu(string id) { lang = Session["LanguageSetting"].ToString(); if (id == "#") { var tree = new JsTreeModel[] { new JsTreeModel { text = "Menu", attr = new JsTreeAttribute { id = "0", selected = true } } }; this.Context.Response.ContentType = "application/json; charset=utf-8"; this.Context.Response.Write(new JavaScriptSerializer().Serialize(tree).Replace("null", "true")); } else { DataTable dt = null; var tree1 = new JsTreeModel[] { }; objServiceMenu.AuthSoapHdValue = ServiceAuth.ServiceAuthenticationMenu(); dt = objServiceMenu.FetchMenuHierarchy(int.Parse(id), lang, Session["role_id"].ToInt32()); if (dt != null && dt.Rows.Count > 0) { tree1 = new JsTreeModel[dt.Rows.Count]; int i = 0; foreach (DataRow dr in dt.Rows) { tree1[i] = new JsTreeModel { text = dr["menu_name"].ToString(), attr = new JsTreeAttribute { id = dr["menu_id"].ToString(), selected = true } }; i++; } } this.Context.Response.ContentType = "application/json; charset=utf-8"; this.Context.Response.Write(new JavaScriptSerializer().Serialize(tree1).Replace("null", "true")); } }
public void FetchOffice(string id) { if (id == "#") { var tree = new JsTreeModel[] { new JsTreeModel { text = "Office", attr = new JsTreeAttribute { id = "0", selected = true } } }; this.Context.Response.ContentType = "application/json; charset=utf-8"; this.Context.Response.Write(new JavaScriptSerializer().Serialize(tree).Replace("null", "true")); } else { // Base objDal=new Base(); DataTable dt = null; var tree1 = new JsTreeModel[] { }; objServiceOffice.AuthSoapHdValue = ServiceAuth.ServiceAuthenticationOffice(); // dt = objService.FetchOfficeHierarchy(int.Parse(id)); dt = objServiceOffice.FetchOfficeHierarchy(int.Parse(id)); if (dt != null && dt.Rows.Count > 0) { tree1 = new JsTreeModel[dt.Rows.Count]; int i = 0; foreach (DataRow dr in dt.Rows) { tree1[i] = new JsTreeModel { text = dr["office_nep_name"].ToString(), attr = new JsTreeAttribute { id = dr["office_id"].ToString(), selected = true } }; i++; } } this.Context.Response.ContentType = "application/json; charset=utf-8"; this.Context.Response.Write(new JavaScriptSerializer().Serialize(tree1).Replace("null", "true")); } }
public void HelloWorld(string id) { if (id == "#") { var tree = new JsTreeModel[] { new JsTreeModel { text = "A", attr = new JsTreeAttribute { id = "10", selected = true } }, new JsTreeModel { text = "B", attr = new JsTreeAttribute { id = "11", selected = true } } }; this.Context.Response.ContentType = "application/json; charset=utf-8"; this.Context.Response.Write(new JavaScriptSerializer().Serialize(tree).Replace("null", "true")); } else { var tree = new JsTreeModel[] { }; if (id == "10") { tree = new JsTreeModel[] { new JsTreeModel { text = "A1", attr = new JsTreeAttribute { id = "21" } } }; } if (id == "11") { tree = new JsTreeModel[] { new JsTreeModel { text = "B1", attr = new JsTreeAttribute { id = "12" } } }; } this.Context.Response.ContentType = "application/json; charset=utf-8"; this.Context.Response.Write(new JavaScriptSerializer().Serialize(tree).Replace("null", "true")); } }