public static string getaddcont(string napecode)
        {
            string ret = "";

            if (Com.Session.userid == null)
            {
                ret = "expire";
            }
            else
            {
                retprompt retobj = new retprompt();
                if (napecode == "prd")//學段
                {
                    SchSystem.BLL.SysPer spBll = new SchSystem.BLL.SysPer();
                    DataTable            dt    = spBll.GetList("'0' pId,PerName name,PerCode id", "Stat=1 order by convert(int,PerCode)").Tables[0];
                    retobj.retxt  = napecode;
                    retobj.retobj = dt;
                    ret           = Newtonsoft.Json.JsonConvert.SerializeObject(retobj);
                }
                else if (napecode == "grd")//年級
                {
                    SchSystem.BLL.SysGrade spBll = new SchSystem.BLL.SysGrade();
                    DataTable dt = spBll.GetList("'0' pId,GradeName name,GradeCode id", "").Tables[0];
                    retobj.retxt  = napecode;
                    retobj.retobj = dt;
                    ret           = Newtonsoft.Json.JsonConvert.SerializeObject(retobj);
                }
                else if (napecode == "sub")//科目
                {
                    SchSystem.BLL.SysSub spBll = new SchSystem.BLL.SysSub();
                    DataTable            dt    = spBll.GetList("'0' pId,SubName name,SubCode id", "Stat=1 Order by SubCode").Tables[0];
                    retobj.retxt  = napecode;
                    retobj.retobj = dt;
                    ret           = Newtonsoft.Json.JsonConvert.SerializeObject(retobj);
                }
                else if (napecode == "utp")//角色
                {
                    SchSystem.BLL.SysUType spBll = new SchSystem.BLL.SysUType();
                    DataTable dt = spBll.GetList("'0' pId,UTypeName name,UTypeCOde id", "Stat=1").Tables[0];
                    retobj.retxt  = napecode;
                    retobj.retobj = dt;
                    ret           = Newtonsoft.Json.JsonConvert.SerializeObject(retobj);
                }
                else if (napecode == "mat")//教版
                {
                    SchSystem.BLL.SysMater spBll = new SchSystem.BLL.SysMater();
                    DataTable dt = spBll.GetList("'0' pId,MaterName name,MaterCode id", "Stat=1").Tables[0];
                    retobj.retxt  = napecode;
                    retobj.retobj = dt;
                    ret           = Newtonsoft.Json.JsonConvert.SerializeObject(retobj);
                }
                else
                {
                    retobj.retxt  = napecode;
                    retobj.retobj = "";
                    ret           = Newtonsoft.Json.JsonConvert.SerializeObject(retobj);
                }
            }
            return(ret);
        }
Exemple #2
0
 public static Com.DataPack.DataRsp <string> save(string Name, string stat, string AutoId)
 {
     Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
     if (Com.Session.userid == null)
     {
         rsp.code = "expire";
         rsp.msg  = "页面已经过期,请重新登录";
     }
     else
     {
         try
         {
             SchSystem.BLL.SysUType   SysUType_bll   = new SchSystem.BLL.SysUType();
             SchSystem.Model.SysUType SysUType_model = new SchSystem.Model.SysUType();
             SysUType_model.UTypeName = Com.Public.SqlEncStr(Name.Trim()).ToString();
             SysUType_model.Stat      = Convert.ToInt32(Com.Public.SqlEncStr(stat));
             if (AutoId != "")
             {
                 SysUType_model.AutoId = Convert.ToInt32(AutoId);
                 if (SysUType_bll.Update(SysUType_model))
                 {
                     rsp.code = "success";
                     rsp.msg  = "修改成功";
                 }
             }
             else
             {
                 DataTable dt = SysUType_bll.GetList("top 1 UTypeCode", " 1=1 order by UTypeCode DESC").Tables[0];
                 if (dt != null && dt.Rows.Count > 0)
                 {
                     string Code = dt.Rows[0]["UTypeCode"].ToString();
                     SysUType_model.UTypeCode = (int.Parse(Code) + 1).ToString("00");
                 }
                 else
                 {
                     SysUType_model.UTypeCode = "01";
                 }
                 if (SysUType_bll.Add(SysUType_model) != 0)
                 {
                     rsp.code = "success";
                     rsp.msg  = "添加成功";
                 }
             }
         }
         catch (Exception ex)
         {
             rsp.code = "error";
             rsp.msg  = ex.Message;
         }
     }
     return(rsp);
 }
        public static Com.DataPack.DataRsp <string> page(string PageIndex, string PageSize, string txtname, string BusinessType, string txtcode, string txtrange, string txtbusplat)
        {
            Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
            if (Com.Session.userid == null)
            {
                rsp.code = "expire";
                rsp.msg  = "你现在登录已过期,请重新登录!";
            }
            else
            {
                SchSystem.BLL.ServFunc sfcBll = new SchSystem.BLL.ServFunc();

                string strwhere = "1=1";
                if (!string.IsNullOrEmpty(txtname))
                {
                    strwhere += " and FuncName='" + txtname + "'";
                }
                if (!string.IsNullOrEmpty(txtcode))
                {
                    strwhere += " and FuncCode='" + txtcode + "'";
                }
                if (!string.IsNullOrEmpty(txtrange))
                {
                    strwhere += "and FuncRange='" + txtrange + "'";
                }
                if (!string.IsNullOrEmpty(txtbusplat))
                {
                    strwhere += " and FuncSyss like '%'+(select SysCode from ServSys where SysName='" + txtbusplat + "')+'%'";
                }
                if (!string.IsNullOrEmpty(BusinessType))
                {
                    strwhere += " and ServType.TypeCode='" + BusinessType + "'";
                }
                Com.Public.PageModelResp pages = new Com.Public.PageModelResp();
                pages.PageIndex = int.Parse(PageIndex);
                pages.PageSize  = int.Parse(PageSize);
                int rowc = 0;
                int pc   = 0;
                try
                {
                    string    dbcols = "ServFunc.AutoId,FuncName,FuncCode,ServFunc.TypeCode,FuncRange,FuncSet,FuncNote,FuncSyss,FuncDes,TypeName";
                    DataTable dt     = sfcBll.GetListCols(dbcols, strwhere, "ServFunc.AutoId", "DESC", pages.PageIndex, pages.PageSize, ref rowc, ref pc).Tables[0];
                    pages.PageCount = pc;
                    pages.RowCount  = rowc;
                    if (dt.Rows.Count > 0)
                    {
                        dt.Columns.Add("FuncSyssName");
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            //所属业务平台
                            string FuncSyss = dt.Rows[i]["FuncSyss"].ToString();
                            if (FuncSyss != "")
                            {
                                string[] FuncSyssArr = FuncSyss.Split(',');
                                string   FuncSysstr  = "";
                                foreach (string s in FuncSyssArr)
                                {
                                    FuncSysstr += "'" + s + "',";
                                }
                                FuncSyss = FuncSysstr.Substring(0, FuncSysstr.Length - 1);
                            }
                            dt.Rows[i]["FuncSyssName"] = sfcBll.GetFuncNames("SysCode in (" + FuncSyss + ")");
                            //附加设置信息
                            string autoid = dt.Rows[i]["AutoId"].ToString();
                            SchSystem.BLL.ServFuncExt sfeBll = new SchSystem.BLL.ServFuncExt();
                            DataTable     dtsfext            = sfeBll.GetList("*", "FuncId='" + autoid + "'").Tables[0];
                            StringBuilder sbstr = new StringBuilder();
                            //string perstr = "", substr = "", gradestr = "", utname = "", matstr = "";
                            if (dtsfext.Rows.Count > 0)
                            {
                                for (int j = 0; j < dtsfext.Rows.Count; j++)
                                {
                                    if (dtsfext.Rows[j]["NapeCode"].ToString() == "prd")
                                    {
                                        SchSystem.BLL.SysPer spBll = new SchSystem.BLL.SysPer();
                                        DataTable            dtres = spBll.GetList("PerName", "PerCode in(" + dtsfext.Rows[j]["NapeCodes"].ToString() + ") order by convert(int,PerCode)").Tables[0];
                                        sbstr.Append("学段:");
                                        for (int z = 0; z < dtres.Rows.Count; z++)
                                        {
                                            sbstr.Append(dtres.Rows[z]["PerName"].ToString() + ",");
                                        }
                                        sbstr.ToString().Substring(0, sbstr.ToString().Length - 1);
                                    }
                                    if (dtsfext.Rows[j]["NapeCode"].ToString() == "grd")
                                    {
                                        SchSystem.BLL.SysGrade sgBll = new SchSystem.BLL.SysGrade();
                                        DataTable dtres = sgBll.GetList("GradeName", "GradeCode in(" + dtsfext.Rows[j]["NapeCodes"].ToString() + ")").Tables[0];
                                        sbstr.Append("年级:");
                                        for (int z = 0; z < dtres.Rows.Count; z++)
                                        {
                                            sbstr.Append(dtres.Rows[z]["GradeName"].ToString() + ",");
                                        }
                                        sbstr.ToString().Substring(0, sbstr.ToString().Length - 1);
                                    }
                                    if (dtsfext.Rows[j]["NapeCode"].ToString() == "sub")
                                    {
                                        SchSystem.BLL.SysSub ssBll = new SchSystem.BLL.SysSub();
                                        DataTable            dtres = ssBll.GetList("SubName", "SubCode in(" + dtsfext.Rows[j]["NapeCodes"].ToString() + ")").Tables[0];
                                        sbstr.Append("科目:");
                                        for (int z = 0; z < dtres.Rows.Count; z++)
                                        {
                                            sbstr.Append(dtres.Rows[z]["SubName"].ToString() + ",");
                                        }
                                        sbstr.ToString().Substring(0, sbstr.ToString().Length - 1);
                                    }
                                    if (dtsfext.Rows[j]["NapeCode"].ToString() == "utp")
                                    {
                                        SchSystem.BLL.SysUType sutBll = new SchSystem.BLL.SysUType();
                                        DataTable dtres = sutBll.GetList("UTypeName", "UTypeCode in(" + dtsfext.Rows[j]["NapeCodes"].ToString() + ")").Tables[0];
                                        sbstr.Append("角色:");
                                        for (int z = 0; z < dtres.Rows.Count; z++)
                                        {
                                            sbstr.Append(dtres.Rows[z]["UTypeName"].ToString() + ",");
                                        }
                                        sbstr.ToString().Substring(0, sbstr.ToString().Length - 1);
                                    }
                                    if (dtsfext.Rows[j]["NapeCode"].ToString() == "mat")
                                    {
                                        SchSystem.BLL.SysMater smBll = new SchSystem.BLL.SysMater();
                                        DataTable dtres = smBll.GetList("MaterName", "MaterCode in(" + dtsfext.Rows[j]["NapeCodes"].ToString() + ")").Tables[0];
                                        sbstr.Append("教版:");
                                        for (int z = 0; z < dtres.Rows.Count; z++)
                                        {
                                            sbstr.Append(dtres.Rows[z]["MaterName"].ToString() + ",");
                                        }
                                        sbstr.ToString().Substring(0, sbstr.ToString().Length - 1);
                                    }
                                }
                                dt.Rows[i]["FuncSet"] = sbstr.ToString();
                            }
                        }

                        pages.list = dt;
                    }
                }
                catch (Exception ex)
                {
                    rsp.code = "excepError";
                    rsp.msg  = ex.Message;
                }
                rsp.RspData = Newtonsoft.Json.JsonConvert.SerializeObject(pages);
            }
            return(rsp);
        }
Exemple #4
0
        public static string getServFunc(string ordpack)
        {
            string ret = "";

            if (Com.Session.userid == null)
            {
                ret = "expire";
            }
            else
            {
                retprompt retobj = new retprompt();
                //根據套餐代碼查詢功能代碼
                SchSystem.BLL.ServBus sbBll = new SchSystem.BLL.ServBus();
                string funcstr = sbBll.GetList("FuncStr", "ServiceId='" + ordpack + "'").Tables[0].Rows[0]["FuncStr"].ToString();
                string funcs   = "";
                if (!string.IsNullOrEmpty(funcstr))
                {
                    string[] funcstrarr = funcstr.Split(',');
                    foreach (string str in funcstrarr)
                    {
                        funcs += "'" + str + "',";
                    }
                }
                //根據功能代碼查詢功能名稱以及編號
                SchSystem.BLL.ServFunc sfBll = new SchSystem.BLL.ServFunc();
                DataTable dtServFunc         = sfBll.GetList("AutoId,FuncName,FuncCode", "FuncCode in (" + funcs.Substring(0, funcs.Length - 1) + ")").Tables[0];

                retobj.retxt  = "servfunc";
                retobj.retobj = dtServFunc;
                //根據功能AutoId查詢功能擴展數據
                SchSystem.BLL.ServFuncExt sfeBll = new SchSystem.BLL.ServFuncExt();
                DataTable dtServFuncExt          = sfeBll.GetList("FuncId,NapeCode,NapeCodes,NapeC,'' Title", "FuncId in(select AutoId from ServFunc where FuncCode in(" + funcs.Substring(0, funcs.Length - 1) + "))").Tables[0];
                retobj.servfuncext = dtServFuncExt;
                Dictionary <string, object> listDic = new Dictionary <string, object>();
                if (dtServFuncExt.Rows.Count > 0)
                {
                    for (int i = 0; i < dtServFuncExt.Rows.Count; i++)
                    {
                        for (int j = 0; j < dtServFunc.Rows.Count; j++)
                        {
                            if (dtServFuncExt.Rows[i]["FuncId"].ToString() == dtServFunc.Rows[j]["AutoId"].ToString())
                            {
                                SchSystem.BLL.ServUserForExt sufeBll = new SchSystem.BLL.ServUserForExt();
                                DataTable dtsufe = sufeBll.GetList("Fcode,NapeCode,NapeCodes", "UserForId in (select AutoId from ServUserFor where ServiceId='" + ordpack + "')").Tables[0];
                                if (dtServFuncExt.Rows[i]["NapeCode"].ToString() == "prd")
                                {
                                    SchSystem.BLL.SysPer spBll    = new SchSystem.BLL.SysPer();
                                    DataTable            dtSysPer = spBll.GetList("'0' pId,PerName name,PerCode id,'false' checked,'true' chkDisabled", "Stat=1 and PerCode in (" + dtServFuncExt.Rows[i]["NapeCodes"].ToString() + ") order by convert(int,PerCode)").Tables[0];
                                    dtServFuncExt.Rows[i]["Title"] = "学段";
                                    string prdtxt = "prd_" + dtServFuncExt.Rows[i]["FuncId"].ToString();
                                    //
                                    if (dtSysPer.Rows.Count > 0)
                                    {
                                        for (int y = 0; y < dtSysPer.Rows.Count; y++)
                                        {
                                            if (dtsufe.Rows.Count > 0)
                                            {
                                                for (int z = 0; z < dtsufe.Rows.Count; z++)
                                                {
                                                    if (dtsufe.Rows[z]["Fcode"].ToString() == dtServFunc.Rows[j]["FuncCode"].ToString() && dtServFuncExt.Rows[i]["NapeCode"].ToString() == dtsufe.Rows[z]["NapeCode"].ToString())
                                                    {
                                                        if (!string.IsNullOrEmpty(dtsufe.Rows[z]["NapeCodes"].ToString()))
                                                        {
                                                            string[] ncarr = dtsufe.Rows[z]["NapeCodes"].ToString().Split(',');
                                                            for (int x = 0; x < ncarr.Length; x++)
                                                            {
                                                                if (ncarr[x].ToString() == dtSysPer.Rows[y]["id"].ToString())
                                                                {
                                                                    dtSysPer.Rows[y]["checked"] = true;
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    //
                                    listDic.Add(prdtxt, dtSysPer);
                                }
                                if (dtServFuncExt.Rows[i]["NapeCode"].ToString() == "mat")
                                {
                                    SchSystem.BLL.SysMater smBll = new SchSystem.BLL.SysMater();
                                    DataTable dtSysMat           = smBll.GetList("'0' pId,MaterName name,MaterCode id,'false' checked,'true' chkDisabled", "Stat=1 and MaterCode in (" + dtServFuncExt.Rows[i]["NapeCodes"].ToString() + ")").Tables[0];
                                    dtServFuncExt.Rows[i]["Title"] = "教版";
                                    string prdtxt = "mat_" + dtServFuncExt.Rows[i]["FuncId"].ToString();
                                    //
                                    if (dtSysMat.Rows.Count > 0)
                                    {
                                        for (int y = 0; y < dtSysMat.Rows.Count; y++)
                                        {
                                            if (dtsufe.Rows.Count > 0)
                                            {
                                                for (int z = 0; z < dtsufe.Rows.Count; z++)
                                                {
                                                    if (dtsufe.Rows[z]["Fcode"].ToString() == dtServFunc.Rows[j]["FuncCode"].ToString() && dtServFuncExt.Rows[i]["NapeCode"].ToString() == dtsufe.Rows[z]["NapeCode"].ToString())
                                                    {
                                                        if (!string.IsNullOrEmpty(dtsufe.Rows[z]["NapeCodes"].ToString()))
                                                        {
                                                            string[] ncarr = dtsufe.Rows[z]["NapeCodes"].ToString().Split(',');
                                                            for (int x = 0; x < ncarr.Length; x++)
                                                            {
                                                                if (ncarr[x].ToString() == dtSysMat.Rows[y]["id"].ToString())
                                                                {
                                                                    dtSysMat.Rows[y]["checked"] = true;
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    //
                                    listDic.Add(prdtxt, dtSysMat);
                                }
                                if (dtServFuncExt.Rows[i]["NapeCode"].ToString() == "sub")
                                {
                                    SchSystem.BLL.SysSub ssBll    = new SchSystem.BLL.SysSub();
                                    DataTable            dtSysSub = ssBll.GetList("'0' pId,SubName name,SubCode id,'false' checked,'true' chkDisabled", "Stat=1 and SubCode in (" + dtServFuncExt.Rows[i]["NapeCodes"].ToString() + ")").Tables[0];
                                    dtServFuncExt.Rows[i]["Title"] = "科目";
                                    string prdtxt = "sub_" + dtServFuncExt.Rows[i]["FuncId"].ToString();
                                    //
                                    if (dtSysSub.Rows.Count > 0)
                                    {
                                        for (int y = 0; y < dtSysSub.Rows.Count; y++)
                                        {
                                            if (dtsufe.Rows.Count > 0)
                                            {
                                                for (int z = 0; z < dtsufe.Rows.Count; z++)
                                                {
                                                    if (dtsufe.Rows[z]["Fcode"].ToString() == dtServFunc.Rows[j]["FuncCode"].ToString() && dtServFuncExt.Rows[i]["NapeCode"].ToString() == dtsufe.Rows[z]["NapeCode"].ToString())
                                                    {
                                                        if (!string.IsNullOrEmpty(dtsufe.Rows[z]["NapeCodes"].ToString()))
                                                        {
                                                            string[] ncarr = dtsufe.Rows[z]["NapeCodes"].ToString().Split(',');
                                                            for (int x = 0; x < ncarr.Length; x++)
                                                            {
                                                                if (ncarr[x].ToString() == dtSysSub.Rows[y]["id"].ToString())
                                                                {
                                                                    dtSysSub.Rows[y]["checked"] = true;
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    //
                                    listDic.Add(prdtxt, dtSysSub);
                                }
                                if (dtServFuncExt.Rows[i]["NapeCode"].ToString() == "grd")
                                {
                                    SchSystem.BLL.SysGrade sgBll = new SchSystem.BLL.SysGrade();
                                    DataTable dtSysGrade         = sgBll.GetList("'0' pId,GradeName name,GradeCode id,'false' checked,'true' chkDisabled", "GradeCode in (" + dtServFuncExt.Rows[i]["NapeCodes"].ToString() + ")").Tables[0];
                                    dtServFuncExt.Rows[i]["Title"] = "年级";
                                    string prdtxt = "grd_" + dtServFuncExt.Rows[i]["FuncId"].ToString();
                                    //
                                    if (dtSysGrade.Rows.Count > 0)
                                    {
                                        for (int y = 0; y < dtSysGrade.Rows.Count; y++)
                                        {
                                            if (dtsufe.Rows.Count > 0)
                                            {
                                                for (int z = 0; z < dtsufe.Rows.Count; z++)
                                                {
                                                    if (dtsufe.Rows[z]["Fcode"].ToString() == dtServFunc.Rows[j]["FuncCode"].ToString() && dtServFuncExt.Rows[i]["NapeCode"].ToString() == dtsufe.Rows[z]["NapeCode"].ToString())
                                                    {
                                                        if (!string.IsNullOrEmpty(dtsufe.Rows[z]["NapeCodes"].ToString()))
                                                        {
                                                            string[] ncarr = dtsufe.Rows[z]["NapeCodes"].ToString().Split(',');
                                                            for (int x = 0; x < ncarr.Length; x++)
                                                            {
                                                                if (ncarr[x].ToString() == dtSysGrade.Rows[y]["id"].ToString())
                                                                {
                                                                    dtSysGrade.Rows[y]["checked"] = true;
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    //
                                    listDic.Add(prdtxt, dtSysGrade);
                                }
                                if (dtServFuncExt.Rows[i]["NapeCode"].ToString() == "utp")
                                {
                                    SchSystem.BLL.SysUType sutBll = new SchSystem.BLL.SysUType();
                                    DataTable dtSysUType          = sutBll.GetList("'0' pId,UTypeName name,UTypeCode id,'false' checked,'true' chkDisabled", "Stat=1 and UTypeCode in (" + dtServFuncExt.Rows[i]["NapeCodes"].ToString() + ")").Tables[0];
                                    dtServFuncExt.Rows[i]["Title"] = "角色";
                                    string prdtxt = "utp_" + dtServFuncExt.Rows[i]["FuncId"].ToString();
                                    //
                                    if (dtSysUType.Rows.Count > 0)
                                    {
                                        for (int y = 0; y < dtSysUType.Rows.Count; y++)
                                        {
                                            if (dtsufe.Rows.Count > 0)
                                            {
                                                for (int z = 0; z < dtsufe.Rows.Count; z++)
                                                {
                                                    if (dtsufe.Rows[z]["Fcode"].ToString() == dtServFunc.Rows[j]["FuncCode"].ToString() && dtServFuncExt.Rows[i]["NapeCode"].ToString() == dtsufe.Rows[z]["NapeCode"].ToString())
                                                    {
                                                        if (!string.IsNullOrEmpty(dtsufe.Rows[z]["NapeCodes"].ToString()))
                                                        {
                                                            string[] ncarr = dtsufe.Rows[z]["NapeCodes"].ToString().Split(',');
                                                            for (int x = 0; x < ncarr.Length; x++)
                                                            {
                                                                if (ncarr[x].ToString() == dtSysUType.Rows[y]["id"].ToString())
                                                                {
                                                                    dtSysUType.Rows[y]["checked"] = true;
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    //
                                    listDic.Add(prdtxt, dtSysUType);
                                }
                            }
                        }
                    }
                    retobj.sysext = listDic;
                }
                ret = Newtonsoft.Json.JsonConvert.SerializeObject(retobj);
            }
            return(ret);
        }
        public static string getaddcont(string napecode)
        {
            string ret = "";

            if (Com.Session.userid == null)
            {
                ret = "expire";
            }
            else
            {
                SchSystem.BLL.ServFuncExt sfeBll = new SchSystem.BLL.ServFuncExt();
                DataTable dtServFuncExt          = sfeBll.GetList("FuncId,NapeCode,NapeCodes,NapeC", "FuncId='" + funcid + "' and NapeCode='" + napecode + "'").Tables[0];
                retprompt retobj = new retprompt();
                if (napecode == "prd")//學段
                {
                    SchSystem.BLL.SysPer spBll = new SchSystem.BLL.SysPer();
                    DataTable            dt    = spBll.GetList("'0' pId,PerName name,PerCode id,'false' checked", "Stat=1 order by convert(int,PerCode)").Tables[0];
                    if (dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            if (dtServFuncExt.Rows.Count > 0)
                            {
                                if (dtServFuncExt.Rows[0]["NapeCodes"].ToString() != "")
                                {
                                    string[] NapeCodesArr = dtServFuncExt.Rows[0]["NapeCodes"].ToString().Split(',');
                                    for (int j = 0; j < NapeCodesArr.Length; j++)
                                    {
                                        if (dt.Rows[i]["id"].ToString() == NapeCodesArr[j].ToString())
                                        {
                                            dt.Rows[i]["checked"] = "true";
                                        }
                                    }
                                }
                            }
                        }
                    }
                    retobj.retxt  = napecode;
                    retobj.retobj = dt;
                    ret           = Newtonsoft.Json.JsonConvert.SerializeObject(retobj);
                }
                else if (napecode == "grd")//年級
                {
                    SchSystem.BLL.SysGrade spBll = new SchSystem.BLL.SysGrade();
                    DataTable dt = spBll.GetList("'0' pId,GradeName name,GradeCode id,'false' checked", "").Tables[0];
                    if (dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            if (dtServFuncExt.Rows.Count > 0)
                            {
                                if (dtServFuncExt.Rows[0]["NapeCodes"].ToString() != "")
                                {
                                    string[] NapeCodesArr = dtServFuncExt.Rows[0]["NapeCodes"].ToString().Split(',');
                                    for (int j = 0; j < NapeCodesArr.Length; j++)
                                    {
                                        if (dt.Rows[i]["id"].ToString() == NapeCodesArr[j].ToString())
                                        {
                                            dt.Rows[i]["checked"] = "true";
                                        }
                                    }
                                }
                            }
                        }
                    }
                    retobj.retxt  = napecode;
                    retobj.retobj = dt;
                    ret           = Newtonsoft.Json.JsonConvert.SerializeObject(retobj);
                }
                else if (napecode == "sub")//科目
                {
                    SchSystem.BLL.SysSub spBll = new SchSystem.BLL.SysSub();
                    DataTable            dt    = spBll.GetList("'0' pId,SubName name,SubCode id,'false' checked", "Stat=1 Order by SubCode").Tables[0];
                    if (dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            if (dtServFuncExt.Rows.Count > 0)
                            {
                                if (dtServFuncExt.Rows[0]["NapeCodes"].ToString() != "")
                                {
                                    string[] NapeCodesArr = dtServFuncExt.Rows[0]["NapeCodes"].ToString().Split(',');
                                    for (int j = 0; j < NapeCodesArr.Length; j++)
                                    {
                                        if (dt.Rows[i]["id"].ToString() == NapeCodesArr[j].ToString())
                                        {
                                            dt.Rows[i]["checked"] = "true";
                                        }
                                    }
                                }
                            }
                        }
                    }
                    retobj.retxt  = napecode;
                    retobj.retobj = dt;
                    ret           = Newtonsoft.Json.JsonConvert.SerializeObject(retobj);
                }
                else if (napecode == "utp")//角色
                {
                    SchSystem.BLL.SysUType spBll = new SchSystem.BLL.SysUType();
                    DataTable dt = spBll.GetList("'0' pId,UTypeName name,UTypeCOde id,'false' checked", "Stat=1").Tables[0];
                    if (dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            if (dtServFuncExt.Rows.Count > 0)
                            {
                                if (dtServFuncExt.Rows[0]["NapeCodes"].ToString() != "")
                                {
                                    string[] NapeCodesArr = dtServFuncExt.Rows[0]["NapeCodes"].ToString().Split(',');
                                    for (int j = 0; j < NapeCodesArr.Length; j++)
                                    {
                                        if (dt.Rows[i]["id"].ToString() == NapeCodesArr[j].ToString())
                                        {
                                            dt.Rows[i]["checked"] = "true";
                                        }
                                    }
                                }
                            }
                        }
                    }
                    retobj.retxt  = napecode;
                    retobj.retobj = dt;
                    ret           = Newtonsoft.Json.JsonConvert.SerializeObject(retobj);
                }
                else if (napecode == "mat")//教版
                {
                    SchSystem.BLL.SysMater spBll = new SchSystem.BLL.SysMater();
                    DataTable dt = spBll.GetList("'0' pId,MaterName name,MaterCode id,'false' checked", "Stat=1").Tables[0];
                    if (dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            if (dtServFuncExt.Rows.Count > 0)
                            {
                                if (dtServFuncExt.Rows[0]["NapeCodes"].ToString() != "")
                                {
                                    string[] NapeCodesArr = dtServFuncExt.Rows[0]["NapeCodes"].ToString().Split(',');
                                    for (int j = 0; j < NapeCodesArr.Length; j++)
                                    {
                                        if (dt.Rows[i]["id"].ToString() == NapeCodesArr[j].ToString())
                                        {
                                            dt.Rows[i]["checked"] = "true";
                                        }
                                    }
                                }
                            }
                        }
                    }
                    retobj.retxt  = napecode;
                    retobj.retobj = dt;
                    ret           = Newtonsoft.Json.JsonConvert.SerializeObject(retobj);
                }
                else
                {
                    retobj.retxt  = napecode;
                    retobj.retobj = "";
                    ret           = Newtonsoft.Json.JsonConvert.SerializeObject(retobj);
                }
            }
            return(ret);
        }