Exemple #1
0
        private static string DataTableToJsJson(DataTable dt)
        {
            var reJson = new StringBuilder();

            reJson.Append("[");
            if (dt != null && dt.Rows.Count > 0)
            {
                var jsbmbll     = new EDRS.BLL.XT_QX_JSBM(request);
                var bmMoldelist = jsbmbll.DataTableToList(dt);

                foreach (var bmtemp in bmMoldelist)
                {
                    reJson.Append("{\"id\":\"" + bmtemp.JSBM + "\",");
                    reJson.Append("\"text\":\"" + bmtemp.JSMC + "\",");
                    reJson.Append("\"lx\":\"js\"");

                    reJson.Append("},");
                }
            }
            var strjson = reJson.ToString();

            strjson = strjson.Substring(0, strjson.Length - 1);

            strjson += "]";
            return(strjson);
        }
Exemple #2
0
        /// <summary>
        /// 根据部门ID 获取部门下角色集合
        /// </summary>
        /// <param name="bmid">部门ID</param>
        /// <returns>角色集合</returns>
        private static DataTable GetJsNodeBybm(string bmid)
        {
            var bll = new EDRS.BLL.XT_QX_JSBM(request);

            var sbwhere      = new StringBuilder();
            var objectValues = new object[1];

            sbwhere.Append(" and BMBM=:BMBM ");
            objectValues[0] = bmid;

            var ds = bll.GetList(sbwhere.ToString(), objectValues);

            return(ds.Tables.Count > 0 ? ds.Tables[0] : new DataTable());
        }
Exemple #3
0
        private static string DataTableToJson(DataTable dt)
        {
            var reJson = new StringBuilder();

            reJson.Append("[");
            if (dt != null && dt.Rows.Count > 0)
            {
                var dwbmbll     = new EDRS.BLL.XT_ZZJG_DWBM(request);
                var bmbmbll     = new EDRS.BLL.XT_ZZJG_BMBM(request);
                var jsbmbll     = new EDRS.BLL.XT_QX_JSBM(request);
                var dwMoldelist = dwbmbll.DataTableToList(dt);

                foreach (var xtZzjgDwbm in dwMoldelist)
                {
                    reJson.Append("{\"id\":\"" + xtZzjgDwbm.DWBM + "\",");
                    reJson.Append("\"text\":\"" + xtZzjgDwbm.DWMC + "\",");
                    reJson.Append("\"lx\":\"dw\"");
                    //获取当前单位下的子单位
                    dt = GetDwNode(xtZzjgDwbm.DWBM);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        reJson.Append(",\"state\":\"closed\",");
                        var childrenstr = DataTableToJson(dt);
                        reJson.Append("\"children\":" + childrenstr);
                    }

                    //获取当前单位下的部门
                    var bmdt = GetBmNodeBydw(xtZzjgDwbm.DWBM);
                    if (bmdt != null && bmdt.Rows.Count > 0)
                    {
                        var strBmJsons = ",\"children\":" + DataTableToBmJson(bmdt);
                        reJson.Append(strBmJsons);
                    }
                    reJson.Append("},");
                }
            }
            var strjson = reJson.ToString();

            strjson  = strjson.Substring(0, strjson.Length - 1);
            strjson += "]";
            return(strjson);
        }
Exemple #4
0
        private static string DataTableToBmJson(DataTable dt)
        {
            var reJson = new StringBuilder();

            reJson.Append("[");
            if (dt != null && dt.Rows.Count > 0)
            {
                var bmbmbll     = new EDRS.BLL.XT_ZZJG_BMBM(request);
                var jsbmbll     = new EDRS.BLL.XT_QX_JSBM(request);
                var bmMoldelist = bmbmbll.DataTableToList(dt);

                foreach (var bmtemp in bmMoldelist)
                {
                    reJson.Append("{\"id\":\"" + bmtemp.DWBM + "\",");
                    reJson.Append("\"text\":\"" + bmtemp.BMMC + "\",");
                    reJson.Append("\"lx\":\"bm\"");
                    //获取当前单位下的子单位
                    dt = GetBmNodeBybmParentid(bmtemp.BMBM);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        reJson.Append(",\"state\":\"closed\",");
                        var childrenstr = DataTableToBmJson(dt);
                        reJson.Append("\"children\":" + childrenstr);
                    }

                    //获取当前单位下的角色
                    var jsdt = GetJsNodeBybm(bmtemp.BMBM);
                    if (jsdt != null && jsdt.Rows.Count > 0)
                    {
                        var strJsJsons = ",\"children\":" + DataTableToJsJson(jsdt);
                    }
                    reJson.Append("},");
                }
            }
            var strjson = reJson.ToString();

            strjson = strjson.Substring(0, strjson.Length - 1);

            strjson += "]";
            return(strjson);
        }