/// <summary> /// 通讯录树结构 /// </summary> /// <param name="searchCondition"></param> /// <returns></returns> public string ZTreeJsonOfTxl(GgfzInfoModel searchCondition) { string sql = @" select * from ( select distinct a.groupID,a.groupName,c.sjmlID,c.sjmlName+' 【'+ nvl(c.sjmlMobile,'') +'】' sjmlName,c.sjmlTel,c.SjmlEmail,d.UserID from Gwtz_Ggfz a inner join Gwtz_Ggfz_Sjml b on b.groupID = a.groupID inner join Gwtz_Sjml c on c.sjmlID = b.sjmlID left join Gwtz_User_Relation d on c.SjmlID=d.SjmlID ) t where 1=1 "; SqlParameterCollection spc = this.DB.CreateSqlParameterCollection(); if (!string.IsNullOrEmpty(searchCondition.SjmlName)) { sql += " and SjmlName like '%" + searchCondition.SjmlName + "%' "; // spc.Add("@SjmlName", '%' + searchCondition.SjmlName + '%'); } sql += " order by groupID "; DataTable dtSjr = this.DB.ExeSqlForDataTable(sql, spc, "t"); string sql2 = @" select distinct a.groupID,a.groupName from Gwtz_Ggfz a inner join Gwtz_Ggfz_Sjml b on b.groupID = a.groupID inner join Gwtz_Sjml c on c.sjmlID = b.sjmlID where 1=1 "; SqlParameterCollection spc2 = this.DB.CreateSqlParameterCollection(); if (!string.IsNullOrEmpty(searchCondition.SjmlName)) { sql2 += " and c.SjmlName like '%" + searchCondition.SjmlName + "%' "; // spc2.Add("@SjmlName", "'%" + searchCondition.SjmlName + "%'"); } DataTable dtSjz = this.DB.ExeSqlForDataTable(sql2, spc2, "t2"); DataRow[] sjzRows = dtSjz.Select("1=1"); string resultJosn = string.Empty; if (sjzRows.Length > 0) { resultJosn = @"["; for (int i = 0; i < dtSjz.Rows.Count; i++) { if (i == 0) { resultJosn += @"{""id"":" + dtSjz.Rows[i]["groupID"] + @",""name"":""" + dtSjz.Rows[i]["groupName"] + @""",""open"":""false"",""isParent"":true"; } else { resultJosn += @",{""id"":" + dtSjz.Rows[i]["groupID"] + @",""name"":""" + dtSjz.Rows[i]["groupName"] + @""",""open"":""false"",""isParent"":true"; } if (dtSjr.Select("groupID=" + dtSjz.Rows[i]["groupID"]).Length > 0) { DataTable tempdtSjr = dtSjr.Select("groupID=" + dtSjz.Rows[i]["groupID"]).CopyToDataTable(); resultJosn += @",""children"":["; for (int j = 0; j < tempdtSjr.Rows.Count; j++) { if (j == 0) { resultJosn += @"{""id"":" + tempdtSjr.Rows[j]["sjmlID"] + @",""name"":""" + tempdtSjr.Rows[j]["sjmlName"] + @""",""isLeaf"":true }"; } else { resultJosn += @",{""id"":" + tempdtSjr.Rows[j]["sjmlID"] + @",""name"":""" + tempdtSjr.Rows[j]["sjmlName"] + @""",""isLeaf"":true }"; } } resultJosn += "]"; } resultJosn += "}"; } resultJosn += "]"; } return(resultJosn); }
public string ZTreeJsonOfDxjb(GgfzInfoModel searchCondition, string dxjbId) { string sql0 = "select * from Szgkjc_Dxjb_Sjml where DxjbId=@DxjbId "; SqlParameterCollection spc = this.DB.CreateSqlParameterCollection(); spc.Add("@DxjbId", dxjbId); DataTable dtGzhf = DB.ExeSqlForDataTable(sql0, spc, "t"); string sql = @" select * from ( select distinct a.groupID,a.groupName,c.sjmlID,c.sjmlName+' 【'+ isnull(c.sjmlMobile,'') +'】' sjmlName,c.sjmlTel,c.SjmlEmail from Gwtz_Ggfz a inner join Gwtz_Ggfz_Sjml b on b.groupID = a.groupID inner join Gwtz_Sjml c on c.sjmlID = b.sjmlID where 1=1 ) t where 1=1 "; spc = this.DB.CreateSqlParameterCollection(); if (!string.IsNullOrEmpty(searchCondition.SjmlName)) { sql += " and SjmlName like @SjmlName"; spc.Add("@SjmlName", '%' + searchCondition.SjmlName + '%'); } sql += " order by groupID "; DataTable dtSjr = this.DB.ExeSqlForDataTable(sql, spc, "t"); string sql2 = @" select distinct a.groupID,a.groupName from Gwtz_Ggfz a inner join Gwtz_Ggfz_Sjml b on b.groupID = a.groupID inner join Gwtz_Sjml c on c.sjmlID = b.sjmlID where 1=1 "; SqlParameterCollection spc2 = this.DB.CreateSqlParameterCollection(); if (!string.IsNullOrEmpty(searchCondition.SjmlName)) { sql2 += " and c.SjmlName like @SjmlName"; spc2.Add("@SjmlName", '%' + searchCondition.SjmlName + '%'); } DataTable dtSjz = this.DB.ExeSqlForDataTable(sql2, spc2, "t2"); DataRow[] sjzRows = dtSjz.Select("1=1"); string resultJosn = string.Empty; if (sjzRows.Length > 0) { resultJosn = @"["; for (int i = 0; i < dtSjz.Rows.Count; i++) { if (i == 0) { resultJosn += @"{""id"":" + dtSjz.Rows[i]["groupID"] + @",""name"":""" + dtSjz.Rows[i]["groupName"] + @""",""open"":""false"""; } else { resultJosn += @",{""id"":" + dtSjz.Rows[i]["groupID"] + @",""name"":""" + dtSjz.Rows[i]["groupName"] + @""",""open"":""false"""; } if (dtSjr.Select("groupID=" + dtSjz.Rows[i]["groupID"]).Length > 0) { DataTable tempdtSjr = dtSjr.Select("groupID=" + dtSjz.Rows[i]["groupID"]).CopyToDataTable(); resultJosn += @",""children"":["; for (int j = 0; j < tempdtSjr.Rows.Count; j++) { DataRow[] rows = dtGzhf.Select("SjmlID=" + tempdtSjr.Rows[j]["sjmlID"]); if (rows.Length > 0) { if (j == 0) { resultJosn += @"{""id"":" + tempdtSjr.Rows[j]["sjmlID"] + @",""name"":""" + tempdtSjr.Rows[j]["sjmlName"] + @""",""checked"":true }"; } else { resultJosn += @",{""id"":" + tempdtSjr.Rows[j]["sjmlID"] + @",""name"":""" + tempdtSjr.Rows[j]["sjmlName"] + @""",""checked"":true }"; } } else { if (j == 0) { resultJosn += @"{""id"":" + tempdtSjr.Rows[j]["sjmlID"] + @",""name"":""" + tempdtSjr.Rows[j]["sjmlName"] + @""" }"; } else { resultJosn += @",{""id"":" + tempdtSjr.Rows[j]["sjmlID"] + @",""name"":""" + tempdtSjr.Rows[j]["sjmlName"] + @""" }"; } } } resultJosn += "]"; } resultJosn += "}"; } resultJosn += "]"; } return(resultJosn); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string type = context.Request["type"]; try { GgfzInfoModel model = new GgfzInfoModel(); object sessionAppUser = context.Session[ConfigManager.GetSignInAppUserSessionName()]; WorkUser = (AppUser)sessionAppUser; DataTable dt; // BLL = new SzgcBLL(WorkUser); bll = new SzqyBLL(WorkUser); switch (type) { case "getZzmc": json = bll.getZTreeOfZzmc(); break; case "getTxlTree": ZlctBLL zlctBLL = new ZlctBLL(WorkUser); string gzzsId = context.Request.QueryString["gzzsId"]; if (String.IsNullOrEmpty(gzzsId)) { json = zlctBLL.ZTreeJsonOfTxl(model); } else { json = zlctBLL.ZTreeJsonOfTxl(model, gzzsId); } break; case "getTxlCombox": zlctBLL = new ZlctBLL(WorkUser); dt = zlctBLL.ZComboxJsonOfTxl(); json = Dtb2Json(dt);; break; case "getTxlTree_Dxjb": zlctBLL = new ZlctBLL(WorkUser); string dxjbId = context.Request.QueryString["dxjbId"]; if (String.IsNullOrEmpty(dxjbId)) { json = zlctBLL.ZTreeJsonOfDxjb(model); } else { json = zlctBLL.ZTreeJsonOfDxjb(model, dxjbId); } break; case "getYear": GetYear(context); break; case "getMonth": GetMonth(context); break; case "ssdq": json = GetSsdq(context); break; case "QySsdq": json = this.GetQySsdq(context); break; case "xmxx": //File.AppendAllText("E:\\test.txt", "111"); json = GetXmxx(context); break; case "QueryProjectList": json = QueryProjectList(context); break; case "SetLxxmGIS": json = SetLxxmGIS(context); break; case "rysd": json = this.GetQySsdq(context); //json = GetRysd(context); break; case "roleRights": json = GetRoleRights(context); break; case "saveRoles": json = SaveRoles(context); break; case "saveRoleRights": json = SaveRoleRights(context); break; case "getUserRights": json = GetUserRights(context); break; case "getXxcjMenu": json = GetXxcjMenu(context); break; case "getIndexTopMenu": json = GetIndexTopMenu(context); break; case "xxgx_csjk": json = GetXxgx_Csjk(context); break; //往省厅上传项目信息 case "uploadToStTBProjectInfo": json = uploadToStTBProjectInfo(context); break; //往省厅上传项目补充信息 case "uploadToStTBProjectAddInfo": json = uploadToStTBProjectAddInfo(context); break; //从一站式申报平台按uuid下行安监、质监申报数据 case "downloadByUuid": json = downloadByUuid(context); break; //下载企业注册人员数据 case "downloadCorpRegStaff": json = downloadCorpRegStaff(context); break; //下载企业资质信息 case "downloadCorpCert": json = downloadCorpCert(context); break; //从部里下载企业资质信息 case "downloadCorpCertFromMohurd": json = downloadCorpCertFromMohurd(context); break; //保存合同备案-工程类型 case "saveHtbaPrjType": json = saveHtbaPrjType(context); break; //保存合同备案-联合体 case "saveHtbaUnion": json = saveHtbaUnion(context); break; } } catch (Exception ex) { json = ex.Message; } context.Response.Write(json); context.Response.End(); }