Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //先得到操作类型
            string SysType = Request.Params["systype"].ToString();

            if (SysType == "e")//修改,不能修改用户的类型及学校参数
            {
                btname = "修改";
                id     = Request.Params["autoid"].ToString();
                SchSystem.BLL.SysMater   bll   = new SchSystem.BLL.SysMater();
                SchSystem.Model.SysMater model = bll.GetModel(int.Parse(id));
                if (model != null && model.AutoId > 0)
                {
                    code = model.MaterCode;
                    name = model.MaterName;
                    stat = model.Stat.ToString();
                }
                else
                {
                    Response.Write("无该名称!");
                    Response.End();
                }
            }
            else//不在添加及修改之内,则返回
            {
            }
        }
        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);
        }
Esempio n. 3
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.SysMater   SysMater_bll   = new SchSystem.BLL.SysMater();
             SchSystem.Model.SysMater SysMater_model = new SchSystem.Model.SysMater();
             SysMater_model.MaterName = Com.Public.SqlEncStr(Name).ToString();
             SysMater_model.Stat      = Convert.ToInt32(Com.Public.SqlEncStr(stat));
             if (AutoId != "")
             {
                 SysMater_model.AutoId = Convert.ToInt32(AutoId);
                 if (SysMater_bll.Update(SysMater_model))
                 {
                     rsp.code = "success";
                     rsp.msg  = "修改成功";
                 }
             }
             else
             {
                 DataTable dt = SysMater_bll.GetList("top 1 MaterCode", "  1=1 order by MaterCode DESC").Tables[0];
                 if (dt != null && dt.Rows.Count > 0)
                 {
                     string Code = dt.Rows[0]["MaterCode"].ToString();
                     SysMater_model.MaterCode = (int.Parse(Code) + 1).ToString("00");
                 }
                 else
                 {
                     SysMater_model.MaterCode = "01";
                 }
                 if (SysMater_bll.Add(SysMater_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)
        {
            Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
            if (Com.Session.userid == null)
            {
                rsp.code = "expire";
                rsp.msg  = "页面已经过期,请重新登录";
            }
            else
            {
                try
                {
                    SchSystem.BLL.SysMater sysmater = new SchSystem.BLL.SysMater();
                    string strwhere = "Stat<2 ";
                    Com.Public.PageModelResp pages = new Com.Public.PageModelResp();
                    pages.PageIndex = int.Parse(PageIndex);
                    pages.PageSize  = int.Parse(PageSize);
                    int rowc = 0;
                    int pc   = 0;

                    DataTable dt = sysmater.GetListCols("AutoId,MaterName,MaterCode,Stat", strwhere, "MaterCode", "ASC", pages.PageIndex, pages.PageSize, ref rowc, ref pc).Tables[0];
                    pages.PageCount = pc;
                    pages.RowCount  = rowc;
                    if (dt.Rows.Count > 0)
                    {
                        pages.list = dt;
                    }
                    rsp.data = Newtonsoft.Json.JsonConvert.SerializeObject(pages);
                }
                catch (Exception ex)
                {
                    rsp.code = "error";
                    rsp.msg  = ex.Message;
                }
            }
            return(rsp);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Params["schid"] != null && Request.Params["schid"].ToString() != "")
            {
                string schid = Com.Public.SqlEncStr(Request.Params["schid"].ToString());
                //先得到操作类型
                SchSystem.BLL.SchInfo   schbll    = new SchSystem.BLL.SchInfo();
                SchSystem.Model.SchInfo usermodel = new SchSystem.Model.SchInfo();


                if (string.IsNullOrEmpty(schid))
                {
                    Response.Write("无对应修改的记录!");
                    Response.End();
                }
                //获取修改的对应用户的
                usermodel = schbll.GetSupportModel(int.Parse(schid));
                if (usermodel != null && usermodel.SchId > 0)
                {
                    umodelstr = Newtonsoft.Json.JsonConvert.SerializeObject(usermodel);
                }
                else
                {
                    Response.Write("无该学校!");
                    Response.End();
                }


                if (!string.IsNullOrEmpty(schid))
                {
                    //获取管理员账号密码信息
                    SchSystem.BLL.SchUserInfo   suiBll        = new SchSystem.BLL.SchUserInfo();
                    SchSystem.Model.SchUserInfo modeluserinfo = suiBll.GetSupportModel(int.Parse(schid), 1);
                    if (modeluserinfo != null)
                    {
                        if (modeluserinfo.PassWord == Com.Public.StrToMD5("123456"))
                        {
                            modeluserinfo.PassWord = "******";
                        }
                    }
                    usermanagerstr = Newtonsoft.Json.JsonConvert.SerializeObject(modeluserinfo);
                    //系统科目
                    SchSystem.BLL.SysSub syssubbll = new SchSystem.BLL.SysSub();
                    DataTable            dtsub     = syssubbll.GetList("'0' pId,SubCode id,SubName name,'false' checked", "1=1 Order by SubCode").Tables[0];//Stat=1
                    //获取学校的sub
                    SchSystem.BLL.SchSub schsubbll = new SchSystem.BLL.SchSub();
                    DataTable            dtschsub  = schsubbll.GetList("'0' pId,SubCode id,SubName name,'false' checked", "Stat=1 and SchId='" + schid + "' Order by SubCode").Tables[0];
                    DataTable            dtsubmat  = dtsub.Copy();
                    if (dtsub != null && dtschsub != null && dtsub.Rows.Count > 0 && dtschsub.Rows.Count > 0)
                    {
                        for (int i = 0; i < dtsub.Rows.Count; i++)
                        {
                            DataRow[] drs = dtschsub.Select("id='" + dtsub.Rows[i]["id"].ToString() + "'");
                            if (drs.Length > 0)
                            {
                                dtsub.Rows[i]["checked"] = "true";
                            }
                        }
                    }
                    subs    = Newtonsoft.Json.JsonConvert.SerializeObject(dtsub);
                    subsmat = Newtonsoft.Json.JsonConvert.SerializeObject(dtsubmat);
                    //获取子系统:AutoId,AppCode,AppName,Stat,RecTime,RecUser,LastRecTime,LastRecUser
                    SchSystem.BLL.SchApp     schappBll     = new SchSystem.BLL.SchApp();
                    DataTable                dtschapp      = schappBll.GetList("'0' pId,AutoId id,AppName name,'false' checked,AppCode", "").Tables[0];
                    SchSystem.BLL.SchAppRole schapproleBll = new SchSystem.BLL.SchAppRole();
                    DataTable                dtschapprole  = schapproleBll.GetList("SchId='" + schid + "'").Tables[0];
                    if (dtschapp.Rows.Count > 0)
                    {
                        for (int i = 0; i < dtschapp.Rows.Count; i++)
                        {
                            DataRow[] drstr = dtschapprole.Select();
                            if (drstr.Length > 0)
                            {
                                string   approlestr    = drstr[0]["AppStr"].ToString();
                                string[] approlearr    = approlestr.Split(',');
                                int      approlearrlen = approlearr.Length;
                                for (int j = 0; j < approlearrlen; j++)
                                {
                                    if (dtschapp.Rows[i]["AppCode"].ToString() == approlearr[j])
                                    {
                                        dtschapp.Rows[i]["checked"] = "true";
                                    }
                                }
                            }
                        }
                    }
                    sonsys = Newtonsoft.Json.JsonConvert.SerializeObject(dtschapp);

                    //获取整个系统的年级
                    SchSystem.BLL.SysGrade sysgradebll = new SchSystem.BLL.SysGrade();
                    DataTable dtgrade = sysgradebll.GetList("GradeType pId,GradeCode id,GradeName name,'false' checked,'false' nochecks,'0' IsFinish,'' GradeYear,'' GradeId", " GradeCode<>'3004' and GradeCode<>'4004' Order by GradeType,GradeLv").Tables[0];
                    #region 家校互通平台子模块
                    SchSystem.BLL.SchAppXXT saxxtBll = new SchSystem.BLL.SchAppXXT();
                    DataTable dtsaxxt = saxxtBll.GetList("'0' pId,AppCode id,AppName name,'false' checked,'false' isShar", "Stat=1").Tables[0];
                    SchSystem.BLL.SchAppRoleXXT sarxxtBll = new SchSystem.BLL.SchAppRoleXXT();
                    DataTable dtsarxxt      = sarxxtBll.GetList("SchId='" + schid + "'").Tables[0];
                    DataRow[] drsarxxt      = dtsarxxt.Select();
                    string[]  approlexxtarr = { };
                    if (drsarxxt.Length > 0)
                    {
                        approlexxtarr = drsarxxt[0]["AppStr"].ToString().Split(',');
                        if (dtsaxxt.Rows.Count > 0)
                        {
                            for (int i = 0; i < dtsaxxt.Rows.Count; i++)
                            {
                                for (int j = 0; j < approlexxtarr.Length; j++)
                                {
                                    if (dtsaxxt.Rows[i]["id"].ToString() == approlexxtarr[j].ToString())
                                    {
                                        dtsaxxt.Rows[i]["checked"] = "true";
                                    }
                                }
                            }
                        }
                    }
                    sarxxttree = Newtonsoft.Json.JsonConvert.SerializeObject(dtsaxxt);
                    #endregion
                    //家校互通平台学段、科目教版
                    SchSystem.BLL.SchPerSubMatXXT spsmxxtBll = new SchSystem.BLL.SchPerSubMatXXT();
                    DataTable dtspsmxxt = spsmxxtBll.SchPerSubMatXXTV("SchId='" + schid + "' Order by convert(int,PerCode) asc").Tables[0];
                    showmaterxxttree = Newtonsoft.Json.JsonConvert.SerializeObject(dtspsmxxt);
                    //获取学校的年级
                    SchSystem.BLL.SchGradeInfo schgradebll = new SchSystem.BLL.SchGradeInfo();
                    DataTable dtschgrade = schgradebll.GetList("GradeCode id,GradeYear,GradeId", "isfinish='0' and SchId='" + schid + "'").Tables[0];

                    dtgrade.Columns["nochecks"].ColumnName = "nocheck";
                    DataRow dry = dtgrade.NewRow();
                    dry["pId"]      = "0";
                    dry["id"]       = "1";
                    dry["name"]     = "幼儿园";
                    dry["nocheck"]  = "false";
                    dry["IsFinish"] = "0";
                    dtgrade.Rows.Add(dry);
                    dry             = dtgrade.NewRow();
                    dry["pId"]      = "0";
                    dry["id"]       = "2";
                    dry["name"]     = "小学";
                    dry["nocheck"]  = "false";
                    dry["IsFinish"] = "0";
                    dtgrade.Rows.Add(dry);
                    dry             = dtgrade.NewRow();
                    dry["pId"]      = "0";
                    dry["id"]       = "3";
                    dry["name"]     = "初中";
                    dry["nocheck"]  = "false";
                    dry["IsFinish"] = "0";
                    dtgrade.Rows.Add(dry);
                    dry             = dtgrade.NewRow();
                    dry["pId"]      = "0";
                    dry["id"]       = "4";
                    dry["name"]     = "高中";
                    dry["nocheck"]  = "false";
                    dry["IsFinish"] = "0";
                    dtgrade.Rows.Add(dry);

                    if (dtgrade != null && dtschgrade != null && dtgrade.Rows.Count > 0 && dtschgrade.Rows.Count > 0) //系统年级和学校年级不等于null
                    {
                        for (int i = 0; i < dtgrade.Rows.Count; i++)                                                  //遍历实体年级行数
                        {
                            DataRow[] drs = dtschgrade.Select("id='" + dtgrade.Rows[i]["id"].ToString() + "'");       //根据系统年级id查询学校年级
                            if (drs.Length > 0)
                            {
                                dtgrade.Rows[i]["checked"]   = "true";
                                dtgrade.Rows[i]["GradeYear"] = drs[0]["GradeYear"];
                                dtgrade.Rows[i]["GradeId"]   = drs[0]["GradeId"];
                            }
                        }
                    }

                    //獲取畢業年級的年級名稱和入學年份
                    //DataTable dtres = schgradebll.GetListGradeFinish("GradeCode,GradeName,GradeYear", int.Parse(schid), int.Parse(CurrentYear)).Tables[0];
                    DataTable dtres = schgradebll.Graduated(int.Parse(schid)).Tables[0];
                    updateGrade = Newtonsoft.Json.JsonConvert.SerializeObject(dtres);

                    //获取服务资源:AutoId,AppCode,AppName,Stat,RecTime,RecUser,LastRecTime,LastRecUser
                    #region 获取服务资源
                    SchSystem.BLL.SchAppSoure schappsoureBll = new SchSystem.BLL.SchAppSoure();
                    DataTable dtschappsoure = schappsoureBll.GetList("'0' pId,AppCode id,AppName name,'false' checked,'false' isShar", "Stat=1").Tables[0];
                    SchSystem.BLL.SchAppRoleSoure sarsBll = new SchSystem.BLL.SchAppRoleSoure();
                    DataTable dtsars          = sarsBll.GetList("SchId='" + schid + "'").Tables[0];
                    DataRow[] drsarsstr       = dtsars.Select();
                    string[]  approlesourearr = { };
                    if (drsarsstr.Length > 0)
                    {
                        approlesourearr = drsarsstr[0]["AppCode"].ToString().Split('|');
                    }
                    if (dtschappsoure.Rows.Count > 0)
                    {
                        for (int i = 0; i < dtschappsoure.Rows.Count; i++)
                        {
                            //dtschappsoure.Rows[i]["name"] = dtschappsoure.Rows[i]["name"] + "【不共享】";
                            for (int j = 0; j < approlesourearr.Length; j++)
                            {
                                if (approlesourearr[j].Split(',').Length > 1)
                                {
                                    string appsourestr  = approlesourearr[j].Split(',')[0];
                                    string appsourestat = approlesourearr[j].Split(',')[1];
                                    if (dtschappsoure.Rows[i]["id"].ToString() == appsourestr)
                                    {
                                        if (appsourestat == "1")
                                        {
                                            dtschappsoure.Rows[i]["name"] = dtschappsoure.Rows[i]["name"] + "【共享】";
                                            //dtschappsoure.Rows[i]["isShar"] = "true";
                                        }
                                        else if (appsourestat == "0")
                                        {
                                            dtschappsoure.Rows[i]["name"] = dtschappsoure.Rows[i]["name"] + "【不共享】";
                                            //dtschappsoure.Rows[i]["isShar"] = "false";
                                        }
                                        dtschappsoure.Rows[i]["checked"] = "true";
                                    }
                                }
                            }
                            if (dtschappsoure.Rows[i]["checked"].ToString() == "false")
                            {
                                dtschappsoure.Rows[i]["name"] = dtschappsoure.Rows[i]["name"] + "【不共享】";
                                //dtschappsoure.Rows[i]["isShar"] = "false";
                            }
                        }
                    }
                    souretree = Newtonsoft.Json.JsonConvert.SerializeObject(dtschappsoure);
                    #endregion
                    //获取教版
                    SchSystem.BLL.SysMater smaterBll = new SchSystem.BLL.SysMater();
                    DataTable dtsmater = smaterBll.GetList("'0' pId,MaterCode id,MaterName name,'false' checked,'' subcodechk,MaterCode,'' PerCode,'' SubCode,'' SubName", "Stat=1").Tables[0];
                    SchSystem.BLL.SchPerSubMat spsmBll = new SchSystem.BLL.SchPerSubMat();
                    DataTable dtspsm = spsmBll.SchPerSubMatVMatSub("SchId='" + schid + "' Order by convert(int,PerCode) asc").Tables[0];
                    //if (dtsmater.Rows.Count > 0)
                    //{
                    //    for (int i = 0; i < dtsmater.Rows.Count; i++)
                    //    {
                    //        foreach (DataRow dr in dtspsm.Rows)
                    //        {
                    //            string ss = dtsmater.Rows[i]["MaterCode"].ToString();
                    //            string sss = dr["MaterCode"].ToString();
                    //            if (dtsmater.Rows[i]["MaterCode"].ToString() == dr["MaterCode"].ToString())
                    //            {
                    //                dtsmater.Rows[i]["checked"] = "true";
                    //                dtsmater.Rows[i]["PerCode"] = dr["PerCode"];
                    //                dtsmater.Rows[i]["SubCode"] = dr["SubCode"];
                    //                dtsmater.Rows[i]["SubName"] = dr["SubName"];
                    //            }
                    //        }
                    //    }
                    //}
                    sysmatertree  = Newtonsoft.Json.JsonConvert.SerializeObject(dtsmater);
                    showmatertree = Newtonsoft.Json.JsonConvert.SerializeObject(dtspsm);


                    grades = Newtonsoft.Json.JsonConvert.SerializeObject(dtgrade);
                    //获取下拉列表
                    StringBuilder sbarea    = new StringBuilder();
                    string[]      areanames = Com.Public.GetArea(usermodel.AreaNo.ToString()).Split('|');
                    sbarea.Append(areanames[0]);
                    sbarea.Append(areanames[1]);
                    sbarea.Append(areanames[2]);
                    areastr = sbarea.ToString();
                }
            }
        }
        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);
        }
Esempio n. 7
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);
        }
Esempio n. 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                usertname = Com.Session.uname;

                //先得到操作类型
                SchSystem.BLL.SchInfo   schbll    = new SchSystem.BLL.SchInfo();
                SchSystem.Model.SchInfo usermodel = new SchSystem.Model.SchInfo();

                SchSystem.BLL.SysSub syssubbll = new SchSystem.BLL.SysSub();
                DataTable            dtsub     = syssubbll.GetList("'0' pId,SubCode id,SubName name,'false' checked", "Stat=1 Order by SubCode").Tables[0];//Stat=1
                DataTable            dtsubmat  = dtsub.Copy();
                //获取学校的sub
                SchSystem.BLL.SchSub schsubbll = new SchSystem.BLL.SchSub();
                DataTable            dtschsub  = schsubbll.GetList("'0' pId,SubCode id,SubName name,'false' checked", "Stat=1 and SchId='" + schid + "' Order by SubCode").Tables[0];
                subs    = Newtonsoft.Json.JsonConvert.SerializeObject(dtsub);
                subsmat = Newtonsoft.Json.JsonConvert.SerializeObject(dtsubmat);

                treeNodekinderstr = Newtonsoft.Json.JsonConvert.SerializeObject(dtschsub);
                //获取子系统:AutoId,AppCode,AppName,Stat,RecTime,RecUser,LastRecTime,LastRecUser
                SchSystem.BLL.SchApp schappBll = new SchSystem.BLL.SchApp();
                DataTable            dtschapp  = schappBll.GetList("'0' pId,AppCode id,AppName name,'false' checked,AppCode", "Stat=1 and AppCode not in (1,2)").Tables[0];
                sonsys = Newtonsoft.Json.JsonConvert.SerializeObject(dtschapp);

                //获取整个系统的年级
                SchSystem.BLL.SysGrade sysgradebll = new SchSystem.BLL.SysGrade();
                DataTable dtgrade = sysgradebll.GetList("GradeType pId,GradeCode id,GradeName name,'false' checked,'false' nochecks,'0' IsFinish", " GradeCode<>'3004' and GradeCode<>'4004' Order by GradeType,GradeLv").Tables[0];
                //获取学校类型
                SchSystem.BLL.SysPer sysperbll = new SchSystem.BLL.SysPer();
                DataTable            dtper     = sysperbll.GetList("PerName Name,PerCode ID", " Stat=1 Order by convert(int,PerCode)").Tables[0];
                if (dtper.Rows.Count > 0)
                {
                    StringBuilder sb = new StringBuilder();
                    for (int i = 0; i < dtper.Rows.Count; i++)
                    {
                        if (dtper.Rows[i]["ID"].ToString() == percode)
                        {
                            sb.Append("<option value=\"" + dtper.Rows[i]["ID"].ToString() + "\" selected=\"selected\">" + dtper.Rows[i]["Name"].ToString() + "</option>");
                        }
                        else
                        {
                            sb.Append("<option value=\"" + dtper.Rows[i]["ID"].ToString() + "\">" + dtper.Rows[i]["Name"].ToString() + "</option>");
                        }
                        //}
                    }
                    percodes = sb.ToString();
                }


                dtgrade.Columns["nochecks"].ColumnName = "nocheck";
                DataRow dry = dtgrade.NewRow();
                dry["pId"]      = "0";
                dry["id"]       = "1";
                dry["name"]     = "幼儿园";
                dry["nocheck"]  = "false";
                dry["IsFinish"] = "0";

                dtgrade.Rows.Add(dry);
                dry             = dtgrade.NewRow();
                dry["pId"]      = "0";
                dry["id"]       = "2";
                dry["name"]     = "小学";
                dry["nocheck"]  = "false";
                dry["IsFinish"] = "0";

                dtgrade.Rows.Add(dry);
                dry             = dtgrade.NewRow();
                dry["pId"]      = "0";
                dry["id"]       = "3";
                dry["name"]     = "初中";
                dry["nocheck"]  = "false";
                dry["IsFinish"] = "0";

                dtgrade.Rows.Add(dry);
                dry             = dtgrade.NewRow();
                dry["pId"]      = "0";
                dry["id"]       = "4";
                dry["name"]     = "高中";
                dry["nocheck"]  = "false";
                dry["IsFinish"] = "0";

                dtgrade.Rows.Add(dry);

                //if (dtgrade != null && dtschgrade != null && dtgrade.Rows.Count > 0 && dtschgrade.Rows.Count > 0)//系统年级和学校年级不等于null
                //{
                //    for (int i = 0; i < dtgrade.Rows.Count; i++)//遍历实体年级行数
                //    {
                //        DataRow[] drs = dtschgrade.Select("id='" + dtgrade.Rows[i]["id"].ToString() + "'");//根据系统年级id查询学校年级
                //        if (drs.Length > 0)
                //        {
                //            //string ss = drs[0]["id"].ToString();
                //            //dtgrade.Rows[i]["checked"] = "true";
                //            //DataRow[] drss = dtgrade.Select("id='"+ss+"'");
                //            //int ss = int.Parse(drss["pId"].ToString());
                //        }
                //    }
                //}

                grades = Newtonsoft.Json.JsonConvert.SerializeObject(dtgrade);

                //获取资源平台服务资源:AutoId,AppCode,AppName,Stat,RecTime,RecUser,LastRecTime,LastRecUser
                SchSystem.BLL.SchAppSoure schappsoureBll = new SchSystem.BLL.SchAppSoure();
                DataTable dtschappsoure = schappsoureBll.GetList("'0' pId,AppCode id,AppName name,'false' checked,AppCode", "Stat=1").Tables[0];
                if (dtschappsoure.Rows.Count > 0)
                {
                    for (int i = 0; i < dtschappsoure.Rows.Count; i++)
                    {
                        dtschappsoure.Rows[i]["name"] = dtschappsoure.Rows[i]["name"] + "【不共享】";
                    }
                }
                souretree = Newtonsoft.Json.JsonConvert.SerializeObject(dtschappsoure);

                //获取教版
                SchSystem.BLL.SysMater smaterBll = new SchSystem.BLL.SysMater();
                DataTable dtsmater = smaterBll.GetList("'0' pId,AutoId id,MaterName name,'false' checked,MaterCode", "Stat=1").Tables[0];
                sysmatertree = Newtonsoft.Json.JsonConvert.SerializeObject(dtsmater);

                //获取家校互通服务资源:AutoId,AppCode,AppName,Stat,RecTime,RecUser,LastRecTime,LastRecUser
                SchSystem.BLL.SchAppXXT schappxxtBll = new SchSystem.BLL.SchAppXXT();
                DataTable dtschappxxt = schappxxtBll.GetList("'0' pId,AppCode id,AppName name,'false' checked,AppCode", "Stat=1").Tables[0];
                //if (dtschappsoure.Rows.Count > 0)
                //{
                //    for (int i = 0; i < dtschappsoure.Rows.Count; i++)
                //    {
                //        dtschappsoure.Rows[i]["name"] = dtschappsoure.Rows[i]["name"] + "【不共享】";
                //    }
                //}
                homeschtree = Newtonsoft.Json.JsonConvert.SerializeObject(dtschappxxt);

                //获取下拉列表
                StringBuilder sbarea = new StringBuilder();
                //获取省份
                sbarea.Append("<select id=\"aprov\">");
                string sareacode = "";
                if (usermodel != null && usermodel.SchId > 0 && usermodel.AreaNo.Length == 6)
                {
                    sareacode = usermodel.AreaNo.Substring(0, 2) + "0000";
                }
                sbarea.Append(SchWebAdmin.Com.Public.GetDrpArea("0", "", ref sareacode, false));
                sbarea.Append("</select>");
                //获取城市
                sbarea.Append("<select id=\"acity\">");
                string sareacitycode = "";
                if (usermodel != null && usermodel.SchId > 0 && usermodel.AreaNo.Length == 6)
                {
                    sareacitycode = usermodel.AreaNo.Substring(0, 4) + "00";
                }
                sbarea.Append(SchWebAdmin.Com.Public.GetDrpArea("1", sareacode, ref sareacitycode, false));
                sbarea.Append("</select>");
                //获取区县
                sbarea.Append("<select id=\"acoty\">");
                string sareacotycode = "";
                if (usermodel != null && usermodel.SchId > 0 && usermodel.AreaNo.Length == 6)
                {
                    sareacotycode = usermodel.AreaNo;
                }
                sbarea.Append(SchWebAdmin.Com.Public.GetDrpArea("2", sareacitycode, ref sareacotycode, false));
                sbarea.Append("</select>");
                areastr = sbarea.ToString();

                //根据部门分类查询人员信息
                //当前学校老师
                SchSystem.BLL.SchUserDeptV userbll = new SchSystem.BLL.SchUserDeptV();
                DataTable dtuser = userbll.GetList("DeptId,DepartName,UserId,UserTname", "Stat=1 and Ustat=1 and SchId=" + Com.Public.SqlEncStr(schid)).Tables[0];
                SchSystem.BLL.SchDepartInfo dptbll = new SchSystem.BLL.SchDepartInfo();
                DataTable dt        = dptbll.GetList("Pid pId,convert(varchar(20),DepartId) id,DepartName name,'0' isms,'' subcode,'false' checked,'true' nochecks", "SchId=" + schid + " and Stat=1 Order by OrderId,DepartName").Tables[0];
                DataTable dtdptuser = dt.Clone();
                dtdptuser.Columns["nochecks"].ColumnName = "nocheck";
                if (dt.Rows.Count > 0)
                {
                    //合并人员到部门表
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        dtdptuser.Rows.Add(dt.Rows[i].ItemArray);
                        //获取该部门下的人员
                        DataRow[] drss = dtuser.Select("DeptId='" + dt.Rows[i]["id"].ToString() + "'");
                        if (drss.Length > 0)
                        {
                            foreach (DataRow item in drss)
                            {
                                DataRow dr = dtdptuser.NewRow();

                                dr["id"]   = item["UserId"].ToString();
                                dr["name"] = item["UserTname"].ToString();
                                dr["pId"]  = item["DeptId"].ToString();
                                if (dr["name"].ToString() == usermodel.Artisan.ToString())
                                {
                                    dr["checked"] = true;
                                }
                                dtdptuser.Rows.Add(dr);
                            }
                        }
                    }
                }

                deptsuser = Newtonsoft.Json.JsonConvert.SerializeObject(dtdptuser);
            }
        }
        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);
        }