Пример #1
0
 public string umodelstr = "1"; //学校model
 protected void Page_Load(object sender, EventArgs e)
 {
     //先得到操作类型
     SchSystem.BLL.SchInfo   schbll    = new SchSystem.BLL.SchInfo();
     SchSystem.Model.SchInfo usermodel = new SchSystem.Model.SchInfo();
     dotype = Request.Params["dotype"].ToString();
     if (dotype == "e")//修改,不能修改用户的类型及学校参数
     {
         schid = Request.Params["schid"].ToString();
         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();
         }
     }
     else//不在添加及修改之内,则返回
     {
         Response.Write("没有可供确认的操作类型!");
         Response.End();
     }
 }
Пример #2
0
 public static Com.DataPack.DataRsp <string> schsubsave(string arr)
 {
     Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
     if (Com.Session.userid == null)
     {
         rsp.code = "expire";
         rsp.msg  = "页面已经过期,请重新登录";
     }
     else
     {
         string[] datas = arr.Split('|');
         try
         {
             if (datas.Length > 1)
             {
                 SchSystem.BLL.SchInfo schbll = new SchSystem.BLL.SchInfo();
                 schbll.UpdateSchXXTServStat(int.Parse(datas[0]), int.Parse(datas[1]));
                 rsp.code = "success";
                 rsp.msg  = "操作成功";
             }
         }
         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());
         string thstr = "";
         try
         {
             //判断是否有第三方菜单
             WebClient wbc    = new WebClient();
             string    thdstr = wbc.DownloadString(Com.Public.getKey("ThdInfo") + Com.Session.schid);
             if (thdstr.IndexOf("\"appNum\":0") == -1)//有第三方系统菜单
             {
                 thstr = " or FuncCode='22'";
             }
         }
         catch (Exception ex)
         {
         }
         SchSystem.BLL.SchInfo schinfobll = new SchSystem.BLL.SchInfo();
         DataTable             statDt     = schinfobll.GetStat("schid=" + schid + "").Tables[0];
         stat = Convert.ToInt32(statDt.Rows[0]["SonSysStat"]) == 1 ? " 正常 " : " 停用 ";
         //获取前台应
         DataTable useryyDt = Com.Public.SchMenuData("AutoId,AppCode,AppName", "", schid, "2");
         zxt = Newtonsoft.Json.JsonConvert.SerializeObject(useryyDt);
         //获取前台应用子菜单
         DataTable usermenuDt = Com.Public.SchMenuData("MenuId id,Pid pId,TextName name", thstr, schid, "0");
         usermenu = Newtonsoft.Json.JsonConvert.SerializeObject(usermenuDt);
         //获取后台管理子菜单
         DataTable adminmenuDt = Com.Public.SchMenuData("MenuId id,Pid pId,TextName name,FuncCode", thstr, schid, "1");
         adminmenu = Newtonsoft.Json.JsonConvert.SerializeObject(adminmenuDt);
     }
 }
Пример #4
0
        public static string page(string PageIndex, string PageSize, string txtname, string ustat, string cotycode, string schid)
        {
            string ret = "";

            if (Com.Session.userid == null)
            {
                ret = "expire";
            }
            else
            {
                SchSystem.BLL.SchInfo userbll = new SchSystem.BLL.SchInfo();
                if (schid == "")
                {
                    schid = "0";
                }
                //Stat:0废弃,1正常,2被删除,正常界面不显示删除,超管界面可以考虑
                string strwhere = "Stat<2 ";
                if (!string.IsNullOrEmpty(cotycode))
                {
                    strwhere += " and AreaNo = '" + Com.Public.SqlEncStr(cotycode) + "'";
                }
                if (schid != "0")
                {
                    strwhere += " and SchId = '" + Com.Public.SqlEncStr(schid) + "'";
                }
                if (!string.IsNullOrEmpty(txtname))
                {
                    strwhere += " and SchName like '%" + Com.Public.SqlEncStr(txtname) + "%'";
                }
                if (!string.IsNullOrEmpty(ustat))
                {
                    strwhere += " and Stat=" + Com.Public.SqlEncStr(ustat);
                }
                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 = userbll.GetListCols("*", strwhere, "SchName", "ASC", pages.PageIndex, pages.PageSize, ref rowc, ref pc).Tables[0];
                pages.PageCount = pc;
                pages.RowCount  = rowc;
                if (dt.Rows.Count > 0)
                {
                    dt.Columns.Add("Ustat");
                    dt.Columns.Add("Ucity");
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        dt.Rows[i]["Ustat"] = dt.Rows[i]["Stat"].ToString() == "1" ? "正常" : "停用";
                        dt.Rows[i]["Ucity"] = dt.Rows[i]["iscity"].ToString() == "1" ? "城区" : "非城区";
                    }
                    pages.list = dt;
                }
                //Newtonsoft.Json.JsonConvert();
                string ddd = Newtonsoft.Json.JsonConvert.SerializeObject(pages);
                ret = Newtonsoft.Json.JsonConvert.SerializeObject(pages);
            }
            return(ret);
        }
Пример #5
0
 public static Com.DataPack.DataRsp <string> isalone(string id, string isalone)
 {
     Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
     if (Com.Session.userid == null)
     {
         rsp.code = "expire";
         rsp.msg  = "页面已经过期,请重新登录";
     }
     else
     {
         try
         {
             if (!Com.Public.isVa(id, ""))
             {
                 rsp.code = "error";
                 rsp.msg  = "无跨界权限";
             }
             else if (id == Com.Public.getKey("adminschid"))
             {
                 rsp.code = "error";
                 rsp.msg  = "此为系统学校,不允许操作";
             }
             else
             {
                 SchSystem.BLL.SchInfo   bll   = new SchSystem.BLL.SchInfo();
                 SchSystem.Model.SchInfo model = new SchSystem.Model.SchInfo();
                 model.SchId = int.Parse(id);
                 if (isalone == "&times;")//如果传值为×时,则需要修改为单独部署
                 {
                     model.IsAlone = 1;
                 }
                 else//如果传值为√时,则需要取消单独部署
                 {
                     model.IsAlone = 0;
                 }
                 model.AloneTime = DateTime.Now;
                 model.AloneUser = Com.Session.userid;
                 if (bll.UpdateAlone(model))
                 {
                     rsp.code = "success";
                     rsp.msg  = "操作成功";
                 }
                 else
                 {
                     rsp.code = "error";
                     rsp.msg  = "操作失败";
                 }
             }
         }
         catch (Exception ex)
         {
             rsp.code = "error";
             rsp.msg  = ex.Message;
         }
     }
     return(rsp);
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            schid = Com.Public.SqlEncStr(Request.Params["schid"].ToString());
            SchSystem.Model.SchInfo usermodel = new SchSystem.Model.SchInfo();
            SchSystem.BLL.SchInfo   schbll    = new SchSystem.BLL.SchInfo();
            usermodel = schbll.GetSupportModel(int.Parse(schid));
            //获取下拉列表
            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(Com.Public.GetDrpArea("0", "", ref sareacode, false, "0"));
            sbarea.Append("</select> &nbsp; &nbsp;");
            //获取城市
            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(Com.Public.GetDrpArea("1", sareacode, ref sareacitycode, false, "0"));
            sbarea.Append("</select> &nbsp; &nbsp;");
            //获取区县
            sbarea.Append("区县:<select id=\"acoty\">");
            string sareacotycode = "";

            if (usermodel != null && usermodel.SchId > 0 && usermodel.AreaNo.Length == 6)
            {
                sareacotycode = usermodel.AreaNo;
            }
            sbarea.Append(Com.Public.GetDrpArea("2", sareacitycode, ref sareacotycode, false, "0"));
            sbarea.Append("</select> &nbsp; &nbsp;");
            //获取学校
            sbarea.Append("学校:<select id=\"asch\">");
            string sareaschid = "";

            if (usermodel != null && usermodel.SchId > 0 && usermodel.AreaNo.Length == 6)
            {
                sareaschid = usermodel.SchId.ToString();
            }
            sbarea.Append(Com.Public.GetDrpArea("3", sareacotycode, ref sareaschid, false, "0"));
            sbarea.Append("</select>&nbsp; &nbsp; ");
            areastr   = sbarea.ToString();
            sessionid = Session.SessionID;
            //OAnoticestr = string.Format(Com.Public.getKey("OAnotice"), Session.SessionID, schid);//通知公告
            OAnoticestr = Com.Public.getKey("OAnotice");
            //OAapplystr = string.Format(Com.Public.getKey("OAapply"), Session.SessionID, schid);//审批文件
            OAapplystr = Com.Public.getKey("OAapply");
        }
Пример #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Com.Session.schid == null)
            {
                Response.Redirect("Login.aspx", false); return;
            }
            UploadHeadPic = Com.Public.getKey("adminurl") + "/UploadFile.aspx?schid=" + Com.Session.schid + "&userid=" + Com.Session.usertid + "&schtype=1"; //schtype:值为0代表普通老师后台,1代表学校管理员后台
            string thstr = "";                                                                                                                               //是否有第三方菜单权限

            if (Com.Session.systype == "0")
            {
                systype    = Com.Session.systype;
                utitlename = "智慧校园平台";
                indexpage  = "jsywebindex.html";
            }
            SysListBind(thstr);
            usertname = Com.Session.uname;
            username  = Com.Session.userid;
            if (!string.IsNullOrEmpty(Com.Session.imgurl))
            {
                imgurl = Com.Public.getKey("adminurl") + "\\" + Com.Session.imgurl;
            }
            //获取学校基本数据
            SchSystem.BLL.SchInfo siBll     = new SchSystem.BLL.SchInfo();
            DataTable             dtschinfo = siBll.GetList("SchMaster,PlatformName,PlatformIco", "SchId='" + Com.Session.schid + "'").Tables[0];

            if (dtschinfo.Rows.Count > 0)
            {
                //SchMasterstr = dtschinfo.Rows[0]["SchMaster"].ToString();
                if (Com.Session.systype != "0")
                {
                    PlatformName = dtschinfo.Rows[0]["PlatformName"].ToString() + "管理后台<span style=\"font-size:75%;font-weight:normal;\">【" + Com.Session.schid + "】</span>";
                }
                else
                {
                    PlatformName = dtschinfo.Rows[0]["PlatformName"].ToString();
                }
                PlatformIco = Com.Public.getKey("adminurl") + dtschinfo.Rows[0]["PlatformIco"].ToString();
            }
            if (PlatformName == "管理后台")
            {
                PlatformName = utitlename;
            }
            if (PlatformIco == "")
            {
                PlatformIco = "<i class=\"icon-leaf\"></i>";
            }
            else
            {
                PlatformIco = "<img style='width:20px;' src='" + PlatformIco + "' />";
            }
        }
Пример #8
0
 public static Com.DataPack.DataRsp <string> udel(string id)
 {
     Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
     if (Com.Session.userid == null)
     {
         rsp.code = "expire";
         rsp.msg  = "页面已经过期,请重新登录";
     }
     else
     {
         try
         {
             if (!Com.Public.isVa(id, ""))
             {
                 rsp.code = "error";
                 rsp.msg  = "无跨界权限";
             }
             else if (id == Com.Public.getKey("adminschid"))
             {
                 rsp.code = "error";
                 rsp.msg  = "此为系统学校,不允许操作";
             }
             else
             {
                 SchSystem.BLL.SchInfo   bll   = new SchSystem.BLL.SchInfo();
                 SchSystem.Model.SchInfo model = new SchSystem.Model.SchInfo();
                 model.SchId       = int.Parse(id);
                 model.Stat        = 2;
                 model.LastRecTime = DateTime.Now;
                 model.LastRecUser = Com.Session.userid;
                 if (bll.UpdateStat(model))
                 {
                     rsp.code = "success";
                     rsp.msg  = "操作成功";
                 }
                 else
                 {
                     rsp.code = "error";
                     rsp.msg  = "操作失败";
                 }
             }
         }
         catch (Exception ex)
         {
             rsp.code = "error";
             rsp.msg  = ex.Message;
         }
     }
     return(rsp);
 }
Пример #9
0
        public static string udel(string id)
        {
            string ret = "";

            if (Com.Session.userid == null)
            {
                ret = "expire";
            }
            else
            {
                try
                {
                    if (!Com.Public.isVa(id, ""))
                    {
                        return(ret = "无跨界权限");
                    }
                    if (id == Com.Public.getKey("adminschid"))
                    {
                        ret = "此为系统学校,不允许操作";
                    }
                    else
                    {
                        SchSystem.BLL.SchInfo   bll   = new SchSystem.BLL.SchInfo();
                        SchSystem.Model.SchInfo model = new SchSystem.Model.SchInfo();
                        model.SchId       = int.Parse(id);
                        model.Stat        = 2;
                        model.LastRecTime = DateTime.Now;
                        model.LastRecUser = Com.Session.userid;
                        if (bll.UpdateStat(model))
                        {
                            ret = "success";
                        }
                        else
                        {
                            ret = "操作失败";
                        }
                    }
                }
                catch (Exception ex)
                {
                    ret = ex.Message;
                }
            }
            return(ret);
        }
 public static Com.DataPack.DataRsp <string> schsubsave(string arr)
 {
     Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
     if (Com.Session.userid == null)
     {
         rsp.code = "expire";
         rsp.msg  = "页面已经过期,请重新登录";
     }
     else
     {
         try
         {
             string[] datas = arr.Split('|');
             if (datas[1] == "1" && DateTime.Parse(datas[2]) < DateTime.Now.AddDays(-1))//开启状态,则判断时间是否准确
             {
                 rsp.code = "error";
                 rsp.msg  = "时间选择不正确";
             }
             else
             {
                 SchSystem.BLL.SchInfo schbll = new SchSystem.BLL.SchInfo();
                 if (datas[1] == "1")
                 {
                     schbll.UpdateSchXXTOpen(int.Parse(datas[0]), DateTime.Parse(datas[2]), "支撑操作开启");
                 }
                 else
                 {
                     schbll.UpdateSchXXTClose(int.Parse(datas[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 ustat, string cotycode, string schid, string aprovserch, string acityserch, string txtschid, string gradelv, string isfinish)
        {
            Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
            if (Com.Session.userid == null)
            {
                rsp.code = "expire";
                rsp.msg  = "页面已经过期,请重新登录";
            }
            else
            {
                if (schid == "")
                {
                    schid = "0";
                }
                //Stat:0废弃,1正常,2被删除,正常界面不显示删除,超管界面可以考虑
                string strwhere = "Stat<2 ";
                if (!string.IsNullOrEmpty(cotycode))
                {
                    strwhere += " and AreaNo = '" + Com.Public.SqlEncStr(cotycode) + "'";
                }
                if (!string.IsNullOrEmpty(aprovserch))
                {
                    strwhere += " and  left(AreaNo,2)= '" + Com.Public.SqlEncStr(aprovserch.Substring(0, 2)) + "'";
                }
                if (!string.IsNullOrEmpty(acityserch))
                {
                    strwhere += " and left(AreaNo,4)= '" + Com.Public.SqlEncStr(acityserch.Substring(0, 4)) + "'";
                }
                if (!string.IsNullOrEmpty(txtschid))
                {
                    strwhere += " and SchId = " + int.Parse(Com.Public.SqlEncStr(txtschid));
                }
                else
                {
                    if (schid != "0")
                    {
                        strwhere += " and SchId = '" + Com.Public.SqlEncStr(schid) + "'";
                    }
                }
                if (!string.IsNullOrEmpty(txtname))
                {
                    strwhere += " and SchName like '%" + Com.Public.SqlEncStr(txtname) + "%'";
                }
                if (!string.IsNullOrEmpty(ustat))
                {
                    strwhere += " and SonSysStat=" + Com.Public.SqlEncStr(ustat);
                }
                string currentYear = "";
                if (DateTime.Now.Month < 8)
                {
                    currentYear = (DateTime.Now.Year - 1).ToString();
                }
                else
                {
                    currentYear = DateTime.Now.Year.ToString();
                }
                if (!string.IsNullOrEmpty(gradelv))      //选择了学段
                {
                    if (!string.IsNullOrEmpty(isfinish)) //并且选择了是否有毕业班需要升级
                    {
                        string yearlv = "0";
                        if (gradelv == "1")
                        {
                            yearlv = "4";
                        }
                        else if (gradelv == "2")
                        {
                            yearlv = "5";
                        }
                        else if (gradelv == "3")
                        {
                            yearlv = "3";
                        }
                        else if (gradelv == "4")
                        {
                            yearlv = "3";
                        }
                        if (isfinish == "0")//无毕业班,需要剔除有该学段毕业班学校
                        {
                            strwhere += " and schid not in (select schid from SchGradeInfo where isfinish=0 and left(GradeCode,1)='" + Com.Public.SqlEncStr(gradelv) + "' and " + currentYear + "-GradeYear>" + yearlv + ")";
                        }
                        else//有毕业班,含有该学段且有毕业班的学校
                        {
                            strwhere += " and schid in (select schid from SchGradeInfo where isfinish=0 and left(GradeCode,1)='" + Com.Public.SqlEncStr(gradelv) + "' and " + currentYear + "-GradeYear>" + yearlv + ")";
                        }
                    }
                    else//仅选择了学段,则选择有该学段的学校
                    {
                        strwhere += " and schid in (select schid from SchGradeInfo where isfinish=0 and left(GradeCode,1)='" + Com.Public.SqlEncStr(gradelv) + "')";
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(isfinish))
                    {
                        if (isfinish == "0")//无毕业班,需要剔除含有毕业班学校
                        {
                            strwhere += " and schid not in (select schid from SchGradeInfo where (isfinish=0 or isfinish=2) and ((left(GradeCode,1)='4' and " + currentYear + "-GradeYear>3) or (left(GradeCode,1)='3' and " + currentYear + "-GradeYear>3) or (left(GradeCode,1)='2' and " + currentYear + "-GradeYear>5) or (left(GradeCode,1)='1' and " + currentYear + "-GradeYear>4)))";
                        }
                        else//有毕业班,含有毕业班的学校
                        {
                            strwhere += " and schid in (select schid from SchGradeInfo where (isfinish=0 or isfinish=2) and ((left(GradeCode,1)='4' and " + currentYear + "-GradeYear>3) or (left(GradeCode,1)='3' and " + currentYear + "-GradeYear>3) or (left(GradeCode,1)='2' and " + currentYear + "-GradeYear>5) or (left(GradeCode,1)='1' and " + currentYear + "-GradeYear>4)))";
                        }
                    }
                }
                //isfinish=0 and SchId=@SchId and ((left(GradeCode,1)='4' and @GradeYear-GradeYear>3) or (left(GradeCode,1)='3' and @GradeYear-GradeYear>3) or (left(GradeCode,1)='2' and @GradeYear-GradeYear>5) or (left(GradeCode,1)='1' and @GradeYear-GradeYear>4))
                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
                {
                    SchSystem.BLL.SchInfo userbll = new SchSystem.BLL.SchInfo();
                    //查询最近毕业年级
                    SchSystem.BLL.SchGradeInfo sgibll = new SchSystem.BLL.SchGradeInfo();
                    SchSystem.BLL.SchApp       saBll  = new SchSystem.BLL.SchApp();
                    string    dbcols = "SchId,SchName,PlatformIP,SchoolSection,SonSysStat,RecTime,SchSonSysEnableTime,SchSonSysEndDateTime,AreaNo,Stat,PlatformUrl";//,PlatformIco,SchMaster,ServiceName,Artisan,SchCreator,iscity
                    DataTable dt     = userbll.GetListCols(dbcols, strwhere, "SchName", "Asc", pages.PageIndex, pages.PageSize, ref rowc, ref pc).Tables[0];
                    pages.PageCount = pc;
                    pages.RowCount  = rowc;
                    if (dt.Rows.Count > 0)
                    {
                        dt.Columns.Add("IsUpgrade");
                        dt.Columns.Add("SHENG");
                        dt.Columns.Add("SHI");
                        dt.Columns.Add("QU");
                        dt.Columns.Add("SchoolSections");
                        dt.Columns.Add("graduated");
                        dt.Columns.Add("AppSonSys");
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            string[] areanames = Com.Public.GetArea(dt.Rows[i]["AreaNo"].ToString()).Split('|');
                            dt.Rows[i]["SHENG"] = areanames[0];
                            dt.Rows[i]["SHI"]   = areanames[1];
                            dt.Rows[i]["QU"]    = areanames[2];
                            StringBuilder sbstr = new StringBuilder();
                            string        ss    = dt.Rows[i]["SchoolSection"].ToString();
                            if (!string.IsNullOrEmpty(dt.Rows[i]["SchoolSection"].ToString()))
                            {
                                string[] str = dt.Rows[i]["SchoolSection"].ToString().Split(',');
                                for (int j = 0; j < str.Length; j++)
                                {
                                    if (str[j] == "1")
                                    {
                                        sbstr.Append("幼儿园,");
                                    }
                                    else if (str[j] == "2")
                                    {
                                        sbstr.Append("小学,");
                                    }
                                    else if (str[j] == "3")
                                    {
                                        sbstr.Append("初中,");
                                    }
                                    else if (str[j] == "4")
                                    {
                                        sbstr.Append("高中,");
                                    }
                                }
                                if (sbstr.ToString() != "")
                                {
                                    dt.Rows[i]["SchoolSections"] = sbstr.ToString().Substring(0, sbstr.ToString().Length - 1);
                                }
                                else
                                {
                                    dt.Rows[i]["SchoolSections"] = "";
                                }
                            }
                            bool resBool = false;
                            if (!string.IsNullOrEmpty(dt.Rows[i]["SchId"].ToString()))
                            {
                                resBool = sgibll.ExistsGradeFinish(int.Parse(dt.Rows[i]["SchId"].ToString()), int.Parse(currentYear));
                            }
                            if (resBool)
                            {
                                dt.Rows[i]["IsUpgrade"] = "1";
                            }
                            else
                            {
                                dt.Rows[i]["IsUpgrade"] = "0";
                            }
                            string gradecurrent = " and isfinish=1 and ((left(GradeCode,1)='4' and " + currentYear + "-GradeYear=3) or (left(GradeCode,1)='3' and " + currentYear + "-GradeYear=3) or (left(GradeCode,1)='2' and " + currentYear + "-GradeYear=6) or (left(GradeCode,1)='1' and " + currentYear + "-GradeYear=5))";
                            dt.Rows[i]["graduated"] = sgibll.GetGradedYear("SchId=" + dt.Rows[i]["SchId"].ToString() + gradecurrent);
                            //查询应用子系统
                            SchSystem.BLL.SchAppRole sarBll = new SchSystem.BLL.SchAppRole();
                            DataTable     dtsars            = sarBll.GetList("SchId='" + dt.Rows[i]["SchId"].ToString() + "'").Tables[0];
                            StringBuilder sbsars            = new StringBuilder();
                            if (dtsars.Rows.Count > 0)
                            {
                                string sarsarr = dtsars.Rows[0]["AppStr"].ToString();

                                StringBuilder sbsas = new StringBuilder();
                                DataTable     dtsas = saBll.GetList("AppName", "AppCode in (" + sarsarr + ")").Tables[0];
                                if (dtsas.Rows.Count > 0)
                                {
                                    foreach (DataRow drsas in dtsas.Rows)
                                    {
                                        sbsas.Append(drsas["AppName"] + ",");
                                    }
                                    dt.Rows[i]["AppSonSys"] = sbsas.ToString().Substring(0, sbsas.ToString().Length - 1);
                                }
                            }
                        }
                        pages.list = dt;
                    }
                    rsp.data = Newtonsoft.Json.JsonConvert.SerializeObject(pages);
                }
                catch (Exception ex)
                {
                    rsp.code = "ExcepError";
                    rsp.msg  = ex.Message;
                }
            }
            return(rsp);
        }
Пример #12
0
        public static Com.DataPack.DataRsp <string> page(string PageIndex, string PageSize, string txtname, string ustat, string cotycode, string schid, string aprovserch, string acityserch, string txtschid)
        {
            Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
            if (Com.Session.userid == null)
            {
                rsp.code = "expire";
                rsp.msg  = "页面已经过期,请重新登录";
            }
            else
            {
                try
                {
                    SchSystem.BLL.SchInfo userbll = new SchSystem.BLL.SchInfo();
                    if (schid == "")
                    {
                        schid = "0";
                    }
                    //Stat:0废弃,1正常,2被删除,正常界面不显示删除,超管界面可以考虑
                    string strwhere = "Stat<2 ";
                    if (!string.IsNullOrEmpty(cotycode))
                    {
                        strwhere += " and AreaNo = '" + Com.Public.SqlEncStr(cotycode) + "'";
                    }
                    if (!string.IsNullOrEmpty(aprovserch))
                    {
                        strwhere += " and left(AreaNo,2) = '" + Com.Public.SqlEncStr(aprovserch.Substring(0, 2)) + "'";
                    }
                    if (!string.IsNullOrEmpty(acityserch))
                    {
                        strwhere += " and left(AreaNo,4) = '" + Com.Public.SqlEncStr(acityserch.Substring(0, 4)) + "'";
                    }
                    if (!string.IsNullOrEmpty(txtschid))
                    {
                        strwhere += " and Schid='" + Com.Public.SqlEncStr(txtschid) + "' ";
                    }
                    if (!string.IsNullOrEmpty(txtname))
                    {
                        strwhere += " and SchName like '%" + Com.Public.SqlEncStr(txtname) + "%'";
                    }
                    if (!string.IsNullOrEmpty(ustat))
                    {
                        strwhere += " and Stat='1' and HomeschServStat='" + Com.Public.SqlEncStr(ustat) + "'";
                    }
                    Com.Public.PageModelResp pages = new Com.Public.PageModelResp();
                    pages.PageIndex = int.Parse(PageIndex);
                    pages.PageSize  = int.Parse(PageSize);
                    int       rowc   = 0;
                    int       pc     = 0;
                    string    dbcols = "SchId,SchName,SchoolSection,ServiceName,AreaNo,RecTime,HomeSchEnableTime,HomeSchEndTime,HomeschServStat,HomeSchPlatName,HomeSchPlatIco,HomeSchPlatUrl,HomeSchPlatIP";
                    DataTable dt     = userbll.GetListCols(dbcols, strwhere, "SchName", "ASC", pages.PageIndex, pages.PageSize, ref rowc, ref pc).Tables[0];
                    pages.PageCount = pc;
                    pages.RowCount  = rowc;
                    if (dt.Rows.Count > 0)
                    {
                        //dt.Columns.Add("Ustat");
                        dt.Columns.Add("SoureName");
                        dt.Columns.Add("SHENG");
                        dt.Columns.Add("SHI");
                        dt.Columns.Add("QU");
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            SchSystem.BLL.SchAppRoleXXT sarxxtBll = new SchSystem.BLL.SchAppRoleXXT();
                            DataTable dtsarxxt = sarxxtBll.GetList("SchId='" + dt.Rows[i]["SchId"].ToString() + "'").Tables[0];
                            if (dtsarxxt.Rows.Count > 0)
                            {
                                string[]      sarsAppCodearr = dtsarxxt.Rows[0]["AppStr"].ToString().Split(',');
                                StringBuilder sarsAppCodesb  = new StringBuilder();
                                StringBuilder sasSoureName   = new StringBuilder();
                                for (int j = 0; j < sarsAppCodearr.Length; j++)
                                {
                                    sarsAppCodesb.Append(sarsAppCodearr[j] + ",");
                                }
                                SchSystem.BLL.SchAppXXT saxxtBll = new SchSystem.BLL.SchAppXXT();
                                if (sarsAppCodesb.ToString() != "")
                                {
                                    try
                                    {
                                        DataTable dtsas = saxxtBll.GetList("AppName", "AppCode in (" + sarsAppCodesb.ToString().Substring(0, sarsAppCodesb.ToString().Length - 1) + ")").Tables[0];

                                        if (dtsas.Rows.Count > 0)
                                        {
                                            foreach (DataRow dr in dtsas.Rows)
                                            {
                                                sasSoureName.Append(dr["AppName"] + ",");
                                            }
                                            dt.Rows[i]["SoureName"] = sasSoureName.ToString().Substring(0, sasSoureName.Length - 1);
                                        }
                                    }
                                    catch (Exception e) { }
                                }
                                else
                                {
                                    dt.Rows[i]["SoureName"] = "";
                                }
                            }

                            string[] areanames = Com.Public.GetArea(dt.Rows[i]["AreaNo"].ToString()).Split('|');
                            dt.Rows[i]["SHENG"] = areanames[0];
                            dt.Rows[i]["SHI"]   = areanames[1];
                            dt.Rows[i]["QU"]    = areanames[2];
                        }
                        pages.list = dt;
                    }
                    rsp.data = Newtonsoft.Json.JsonConvert.SerializeObject(pages).Replace("\n\r", "");
                }
                catch (Exception ex)
                {
                    rsp.code = "error";
                    rsp.msg  = ex.Message;
                }
            }
            return(rsp);
        }
Пример #13
0
        public string umodelsarstr = "1"; //学校资源模块
        protected void Page_Load(object sender, EventArgs e)
        {
            //先得到操作类型
            SchSystem.BLL.SchInfo   schbll    = new SchSystem.BLL.SchInfo();
            SchSystem.Model.SchInfo usermodel = new SchSystem.Model.SchInfo();
            dotype = Request.Params["dotype"].ToString();
            if (dotype == "e")//修改,不能修改用户的类型及学校参数
            {
                schid = Request.Params["schid"].ToString();
                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);

                    //
                    SchSystem.BLL.SchAppSoure sasBll = new SchSystem.BLL.SchAppSoure();
                    DataTable dtsar = sasBll.GetList("AppCode,AppName,'false' checked", "Stat=1").Tables[0];

                    if (dtsar.Rows.Count > 0)
                    {
                        dtsar.Columns.Add("UsharStat");
                        for (int j = 0; j < dtsar.Rows.Count; j++)
                        {
                            SchSystem.BLL.SchAppRoleSoure sarsBll = new SchSystem.BLL.SchAppRoleSoure();
                            DataTable dtsars = sarsBll.GetList("SchId='" + schid + "'").Tables[0];
                            if (dtsars.Rows.Count > 0)
                            {
                                string[] sarsarr = dtsars.Rows[0]["AppCode"].ToString().Split('|');
                                for (int i = 0; i < sarsarr.Length; i++)
                                {
                                    int len = sarsarr[i].Split(',').Length;
                                    if (len > 1)
                                    {
                                        string issharstr = sarsarr[i].Split(',')[0];
                                        string isshar    = sarsarr[i].Split(',')[1];
                                        //string sss = dtsar.Rows[j]["AppCode"].ToString();
                                        if (isshar == "1" && issharstr == dtsar.Rows[j]["AppCode"].ToString())
                                        {
                                            dtsar.Rows[j]["UsharStat"] = isshar;
                                            dtsar.Rows[j]["checked"]   = "true";
                                        }
                                        else if (dtsar.Rows[j]["AppCode"].ToString() == issharstr)
                                        {
                                            dtsar.Rows[j]["checked"] = "true";
                                        }
                                    }
                                }
                            }
                        }
                    }
                    umodelsarstr = Newtonsoft.Json.JsonConvert.SerializeObject(dtsar);
                    //
                }
                else
                {
                    Response.Write("无该学校!");
                    Response.End();
                }
            }
            else//不在添加及修改之内,则返回
            {
                Response.Write("没有可供确认的操作类型!");
                Response.End();
            }
        }
        public string publicKey = "";//公钥

        //需要根据不同情况建立或修改的不同学校用户和不同类型的用户,本学校用户唯一,不需要全系统唯一
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //公钥
                publicKey = Model.PublicProperty.PublicKey.Replace("\r\n", ",");
                //权限组的增删改
                isadd  = true;
                isedit = true;
                isdel  = true;
                islook = true;
                //先得到操作类型
                dotype = Request.Params["dotype"].ToString();
                string uid   = "0"; //修改时的用户ID
                string uname = "";  //修改时的用户账号
                if (dotype == "a")  //添加
                {
                    schid   = Request.Params["schid"].ToString();
                    systype = Request.Params["systype"].ToString();
                    if (string.IsNullOrEmpty(schid) || string.IsNullOrEmpty(systype))    //如果没有对应参数中任意一个
                    {
                        Response.Write("学校ID为空或者添加的类型为空!");
                        Response.End();
                    }
                }
                else if (dotype == "e")//修改,不能修改用户的类型及学校参数
                {
                    btnname = "修改";
                    uid     = Request.Params["uid"].ToString();
                    if (string.IsNullOrEmpty(uid))
                    {
                        Response.Write("无对应修改的用户!");
                        Response.End();
                    }
                    //获取修改的对应用户的
                    SchSystem.BLL.SchUserInfo   userbll   = new SchSystem.BLL.SchUserInfo();
                    SchSystem.Model.SchUserInfo usermodel = userbll.GetModel(int.Parse(uid));
                    if (usermodel != null && usermodel.UserId > 0)
                    {
                        //给默认的屏蔽密码,管理员不能随便修改,只能重置为123456
                        if (!string.IsNullOrEmpty(usermodel.PassWord))               //密码不为空
                        {
                            if (usermodel.PassWord == Com.Public.StrToMD5("123456")) //初始密码
                            {
                                usermodel.PassWord = "******";
                            }
                            else//非初始密码
                            {
                                usermodel.PassWord = "******";
                            }
                        }
                        else//密码为空
                        {
                            usermodel.PassWord = "";
                        }
                        umodelstr = Newtonsoft.Json.JsonConvert.SerializeObject(usermodel);
                        schid     = usermodel.SchId.ToString();
                        systype   = usermodel.SysType.ToString();
                        uname     = usermodel.UserName;
                    }
                    else
                    {
                        Response.Write("无该用户!");
                        Response.End();
                    }
                }
                else//不在添加及修改之内,则返回
                {
                    Response.Write("没有可供确认的操作类型!");
                    Response.End();
                }

                SchSystem.BLL.SchInfo schbll = new SchSystem.BLL.SchInfo();
                schname = schbll.GetSchName(int.Parse(schid));
                if (!string.IsNullOrEmpty(schid) && !string.IsNullOrEmpty(systype))
                {
                    //获取整个学校的科目
                    subs = Com.Public.GetDrp("sub", schid, "1", false, "", "");

                    //获取整个学校的部门
                    SchSystem.BLL.SchDepartInfo dptbll = new SchSystem.BLL.SchDepartInfo();
                    DataTable dtdept = dptbll.GetList("Pid pId,DepartId id,DepartName name,'false' checked", "SchId=" + schid + " and Stat=1 Order by OrderId").Tables[0];
                    //获取该用户的关联部门
                    SchSystem.BLL.SchUserDeptV udeptvbll = new SchSystem.BLL.SchUserDeptV();
                    string udeptids = udeptvbll.GetIds(" UserId='" + uid + "' and stat=1 and schid=" + schid);
                    if (!string.IsNullOrEmpty(udeptids) && dtdept != null)
                    {
                        string[] ids = udeptids.Split(',');
                        for (int i = 0; i < dtdept.Rows.Count; i++)
                        {
                            string id = dtdept.Rows[i]["id"].ToString();
                            if (ids.Contains(id))
                            {
                                dtdept.Rows[i]["checked"] = "true";
                            }
                        }
                    }

                    depts = Newtonsoft.Json.JsonConvert.SerializeObject(dtdept);
                    //获取角色菜单
                    SchSystem.BLL.SchRoleSoure rolebll = new SchSystem.BLL.SchRoleSoure();
                    DataTable dtrole = rolebll.GetList("RoleId id,null pId,RoleName name,'false' checked", "Stat=1 and SchId=" + schid + " and SysType='" + systype + "'  Order by RoleName").Tables[0];

                    //获取该用户关联的角色
                    SchSystem.BLL.SchUserRoleSoureV urolevbll = new SchSystem.BLL.SchUserRoleSoureV();
                    string uroleids = urolevbll.GetIds(" UserId='" + uid + "' and stat=1 and schid=" + schid);
                    if (!string.IsNullOrEmpty(uroleids) && dtrole != null)
                    {
                        string[] ids = uroleids.Split(',');
                        for (int i = 0; i < dtrole.Rows.Count; i++)
                        {
                            string id = dtrole.Rows[i]["id"].ToString();
                            if (ids.Contains(id))
                            {
                                dtrole.Rows[i]["checked"] = "true";
                            }
                        }
                    }
                    roles = Newtonsoft.Json.JsonConvert.SerializeObject(dtrole);
                    //获取功能树,查询条件需要根据用户种类和状态等,后面需要改
                    //根据学校拥有的子系统
                    SchSystem.BLL.SchAppRole schapprolebll = new SchSystem.BLL.SchAppRole();
                    string appstr = schapprolebll.GetAppStr(int.Parse(schid));
                    if (appstr != "")
                    {
                        appstr = " and (AppCode=1 or AppCode=2 or AppCode in (" + appstr + ")) ";
                    }
                    SchSystem.BLL.SchMenuInfoUserFuncSoure funcbll = new SchSystem.BLL.SchMenuInfoUserFuncSoure();

                    DataTable dtfunc = funcbll.GetList("MenuId id,Pid pId,TextName name,FuncCode funcode,'false' checked", " Stat=1 " + appstr + " Order by OrderId").Tables[0];
                    funcstr = Newtonsoft.Json.JsonConvert.SerializeObject(dtfunc);
                    //获取特殊权限功能树
                    //SchSystem.BLL.SchMenuInfoUser smieBll = new SchSystem.BLL.SchMenuInfoUser();
                    SchSystem.BLL.SchMenuInfoUserFuncSoure smieBll = new SchSystem.BLL.SchMenuInfoUserFuncSoure();
                    DataTable dtsmie = smieBll.GetList("MenuId id,Pid pId,TextName name,FuncCode funcode,'false' checked", " Stat=1 " + appstr + "  Order by OrderId").Tables[0];
                    MenuInfoExt = Newtonsoft.Json.JsonConvert.SerializeObject(dtsmie);
                }
            }
        }
Пример #15
0
        //获取学校系统管理或者普通应用菜单列表
        public static DataTable SchMenuData(string cols, string thstr, string schid, string systype)
        {
            if (schid == "")
            {
                schid = Com.Session.schid;
            }
            //查询学校的子系统、资源服务模块状态
            SchSystem.BLL.SchInfo siBll     = new SchSystem.BLL.SchInfo();
            DataTable             dtschinfo = siBll.GetList("SonSysStat,SourceSerStat,HomeschServStat", "SchId='" + schid + "'").Tables[0];
            string SonSysStat    = dtschinfo.Rows[0]["SonSysStat"].ToString();
            string SourceSerStat = dtschinfo.Rows[0]["SourceSerStat"].ToString();
            string SourceXXTStat = dtschinfo.Rows[0]["HomeschServStat"].ToString();

            DataTable dt = new DataTable();

            SchSystem.BLL.SchAppRole schapprolebll = new SchSystem.BLL.SchAppRole();
            string appstr = schapprolebll.GetAppStr(int.Parse(schid));

            if (appstr != "")
            {
                appstr = "  AppCode in (" + appstr + ")";
            }

            //0普通前台通用菜单,1学校管理后台菜单
            if (systype == "0")
            {
                string sqlstr = "";
                //获取正常的
                if (appstr == "")
                {
                    sqlstr = " Stat=1 and (AppCode=1 or AppCode=2  " + thstr + ")";
                }
                else
                {
                    sqlstr = " Stat=1 and (AppCode=1 or AppCode=2 or " + appstr + " " + thstr + ")";
                }

                //获取菜单表
                SchSystem.BLL.SchMenuInfoUser menuuserbll = new SchSystem.BLL.SchMenuInfoUser();
                dt = menuuserbll.GetList(cols, sqlstr + " order by OrderId ").Tables[0];
                if (dt.Rows.Count > 0)
                {
                    DataRow row = dt.NewRow();
                    row["id"]   = 1;
                    row["pId"]  = 0;
                    row["name"] = "首页";
                    dt.Rows.InsertAt(row, 0);
                }
            }
            else if (systype == "1")
            {
                string sqlstr = "";
                //获取正常的
                if (appstr == "")
                {
                    sqlstr = " Stat=1 and (AppCode=0 or AppCode=1 or AppCode=2 " + thstr + ") ";
                }
                else
                {
                    sqlstr = " Stat=1 and (AppCode=0 or AppCode=1 or AppCode=2 or " + appstr + "" + thstr + ") ";
                }

                if (SonSysStat == "0" || SonSysStat == "")                                                            //子系统状态为0时,不显示管理平台菜单
                {
                    sqlstr += " and FuncCode<>22 and Pid<> (select MenuId from SchMenuInfoAdmin where FuncCode=22) "; //id是MenuId的别名
                }
                if (SourceSerStat == "0" || SourceSerStat == "")                                                      //资源服务状态为0时,不显示资源平台菜单
                {
                    sqlstr += " and FuncCode<>23 and Pid<> (select MenuId from SchMenuInfoAdmin where FuncCode=23) ";
                }
                if (SourceXXTStat == "0" || SourceXXTStat == "")//家校互通服务状态为0时,不显示资源平台菜单
                {
                    sqlstr += " and FuncCode<>29 and Pid<> (select MenuId from SchMenuInfoAdmin where FuncCode=29) ";
                }

                SchSystem.BLL.SchMenuInfoAdmin menuuserbll = new SchSystem.BLL.SchMenuInfoAdmin();
                dt = menuuserbll.GetList(cols, sqlstr + " order by OrderId").Tables[0];
                //if (SonSysStat == "0" || SonSysStat == "")//子系统状态为0时,不显示管理平台菜单
                //{
                //    DataRow[] dr = dt.Select("FuncCode=22");//通过FuncCode查找管理平台MenuId
                //    int Manageid = int.Parse(dr[0]["id"].ToString());//id是MenuId的别称
                //    dt = DataRowToDataTable(dt, "FuncCode<>22 and pId<>" + Manageid);//查找出不属于管理平台的菜单项,并转换为DataTable

                //}
                //if (SourceSerStat == "0" || SourceSerStat == "")//资源服务状态为0时,不显示资源平台菜单
                //{
                //    DataRow[] dr = dt.Select("FuncCode=23");//通过FuncCode查找资源平台MenuId
                //    int Sourceid = int.Parse(dr[0]["id"].ToString());//id是MenuId的别称
                //    dt = DataRowToDataTable(dt, "FuncCode<>23 and pId<>" + Sourceid);//查找出不属于资源平台的菜单项,并转换为DataTable
                //}
                //if (SourceXXTStat == "0" || SourceXXTStat == "")//家校互通服务状态为0时,不显示资源平台菜单
                //{
                //    DataRow[] dr = dt.Select("FuncCode=29");//通过FuncCode查找家校互通平台MenuId
                //    int XXTid = int.Parse(dr[0]["id"].ToString());//id是MenuId的别称
                //    dt = DataRowToDataTable(dt, "FuncCode<>29 and pId<>" + XXTid);//查找出不属于家校互通平台的菜单项,并转换为DataTable
                //}
            }
            else
            {
                //获取子系统
                if (appstr != "")
                {
                    string sqlstr = "Stat=1 and (" + appstr + ")";
                    SchSystem.BLL.SchApp schappbll = new SchSystem.BLL.SchApp();
                    dt = schappbll.GetList(cols, sqlstr).Tables[0];
                }
            }

            return(dt);
        }
        public static string schsave(string dotype, string schid, string schname, string schaddr, string schmaster, string schmasterpst, string schmastertel, string iscity, string schstat, string selgrades, string selsubs, string areano, string schnote)
        {
            string ret = "";

            if (Com.Session.userid == null)
            {
                ret = "expire";
            }
            else
            {
                try
                {
                    //学校名不能为空,
                    if (string.IsNullOrEmpty(schname))
                    {
                        ret += "学校名称不能为空!";
                    }
                    if (!Com.Public.isVa(schid, ""))
                    {
                        ret += "无跨界权限;";
                    }
                    if (ret == "")
                    {
                        SchSystem.BLL.SchInfo   schbll   = new SchSystem.BLL.SchInfo();
                        SchSystem.Model.SchInfo schmodel = new SchSystem.Model.SchInfo();
                        schmodel.LastRecTime   = DateTime.Now;
                        schmodel.LastRecUser   = Com.Session.userid;
                        schmodel.SchAddr       = schaddr;
                        schmodel.SchMaster     = schmaster;
                        schmodel.MasterPostion = schmasterpst;
                        schmodel.SchName       = schname;
                        schmodel.SchTel        = schmastertel;
                        schmodel.IsCity        = int.Parse(iscity);
                        schmodel.Stat          = int.Parse(schstat);
                        schmodel.AreaNo        = areano;
                        schmodel.SchNote       = schnote;
                        if (dotype == "e")
                        {
                            schmodel.SchId = int.Parse(schid);
                            schbll.UpdateSch(schmodel);
                        }
                        if (dotype == "a")
                        {
                            schmodel.RecTime = DateTime.Now;
                            schmodel.RecUser = Com.Session.userid;
                            schid            = schbll.Add(schmodel).ToString();
                        }
                        if (int.Parse(schid) > 0)
                        {
                            //添加年级及科目
                            SchSystem.BLL.SchGradeInfo gradebll = new SchSystem.BLL.SchGradeInfo();
                            gradebll.DoSchGrades(Com.Session.userid, schid, selgrades);
                            //添加科目
                            SchSystem.BLL.SchSub subbll = new SchSystem.BLL.SchSub();
                            subbll.DoSchSubs(Com.Session.userid, schid, selsubs);
                        }
                        ret = "success";
                    }
                }
                catch (Exception ex)
                {
                    ret = ex.Message;
                }
            }
            return(ret);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            usertname = Com.Session.uname;
            if (Com.Session.systype == "2")
            {
                returl = "<div class=\"nav-search\" id=\"nav-search\"><a class=\"btn btn-danger btn-sm pull-right\" href=\"javascript:window.history.go(-1);\"><i class=\"icon-reply icon-only\"></i></a></div>";
            }

            if (!IsPostBack)
            {
                if (Com.Session.systype != "2")
                {
                    systype = Com.Session.systype;
                }
                //先得到操作类型
                SchSystem.BLL.SchInfo   schbll    = new SchSystem.BLL.SchInfo();
                SchSystem.Model.SchInfo usermodel = new SchSystem.Model.SchInfo();
                dotype = Request.Params["dotype"].ToString();
                if (dotype == "a")//添加
                {
                }
                else if (dotype == "e")//修改,不能修改用户的类型及学校参数
                {
                    btnname = "修改";
                    schid   = Request.Params["schid"].ToString();
                    //判断跨界操作的可能性
                    if (!Com.Public.isVa(schid, ""))
                    {
                        Response.Write("出错,用户非法跨界操作!");
                        Response.End();
                    }
                    if (string.IsNullOrEmpty(schid))
                    {
                        Response.Write("无对应修改的记录!");
                        Response.End();
                    }
                    //获取修改的对应用户的
                    usermodel = schbll.GetModel(int.Parse(schid));
                    if (usermodel != null && usermodel.SchId > 0)
                    {
                        umodelstr = Newtonsoft.Json.JsonConvert.SerializeObject(usermodel);
                    }
                    else
                    {
                        Response.Write("无该学校!");
                        Response.End();
                    }
                    if (Com.Session.systype != "2")
                    {
                        btnname = "开始编辑";
                    }
                }
                else//不在添加及修改之内,则返回
                {
                    Response.Write("没有可供确认的操作类型!");
                    Response.End();
                }


                if (!string.IsNullOrEmpty(schid))
                {
                    //系统科目
                    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
                    //获取学校的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];


                    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);
                    schsubs = Newtonsoft.Json.JsonConvert.SerializeObject(dtschsub);
                    //获取整个系统的年级
                    SchSystem.BLL.SysGrade sysgradebll = new SchSystem.BLL.SysGrade();
                    DataTable dtgrade = sysgradebll.GetList("GradeType pId,GradeCode id,GradeName name,'false' checked,'false' nochecks", " 1=1 Order by GradeType,GradeLv").Tables[0];

                    //获取学校的sub
                    SchSystem.BLL.SchGradeInfo schgradebll = new SchSystem.BLL.SchGradeInfo();
                    DataTable dtschgrade = schgradebll.GetList("GradeCode id", "isfinish='0' and SchId='" + schid + "'").Tables[0];
                    if (dtgrade != null && dtschgrade != null && dtgrade.Rows.Count > 0 && dtschgrade.Rows.Count > 0)
                    {
                        for (int i = 0; i < dtgrade.Rows.Count; i++)
                        {
                            DataRow[] drs = dtschgrade.Select("id='" + dtgrade.Rows[i]["id"].ToString() + "'");
                            if (drs.Length > 0)
                            {
                                dtgrade.Rows[i]["checked"] = "true";
                            }
                        }
                    }
                    dtgrade.Columns["nochecks"].ColumnName = "nocheck";
                    DataRow dry = dtgrade.NewRow();
                    dry["pId"]     = "0";
                    dry["id"]      = "1";
                    dry["name"]    = "幼儿园";
                    dry["nocheck"] = "false";
                    DataRow[] drs1 = dtgrade.Select("pId='1' and checked='false'");
                    if (drs1.Length == 0)
                    {
                        dry["checked"] = "true";
                    }
                    dtgrade.Rows.Add(dry);
                    dry            = dtgrade.NewRow();
                    dry["pId"]     = "0";
                    dry["id"]      = "2";
                    dry["name"]    = "小学";
                    dry["nocheck"] = "false";
                    DataRow[] drs2 = dtgrade.Select("pId='2' and checked='false'");
                    if (drs2.Length == 0)
                    {
                        dry["checked"] = "true";
                    }
                    dtgrade.Rows.Add(dry);
                    dry            = dtgrade.NewRow();
                    dry["pId"]     = "0";
                    dry["id"]      = "3";
                    dry["name"]    = "初中";
                    dry["nocheck"] = "false";
                    DataRow[] drs3 = dtgrade.Select("pId='3' and checked='false'");
                    if (drs3.Length == 0)
                    {
                        dry["checked"] = "true";
                    }
                    dtgrade.Rows.Add(dry);
                    dry            = dtgrade.NewRow();
                    dry["pId"]     = "0";
                    dry["id"]      = "4";
                    dry["name"]    = "高中";
                    dry["nocheck"] = "false";
                    DataRow[] drs4 = dtgrade.Select("pId='4' and checked='false'");
                    if (drs4.Length == 0)
                    {
                        dry["checked"] = "true";
                    }
                    dtgrade.Rows.Add(dry);
                    grades = Newtonsoft.Json.JsonConvert.SerializeObject(dtgrade);
                    //获取下拉列表
                    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(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(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(Com.Public.GetDrpArea("2", sareacitycode, ref sareacotycode, false));
                    sbarea.Append("</select>");
                    areastr = sbarea.ToString();
                }
            }
        }
Пример #18
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            DataRsp rsp    = new DataRsp();
            string  Action = context.Request.Form["Action"];

            if (Action == "null")
            {
                context.Response.Write(PublicProperty.PublicKey);
            }
            else if (Action == "Login")//登录
            {
                string str = "";
                //解密 RSA
                RSACryptoService rsa = new RSACryptoService(PublicProperty.PrivateKey, PublicProperty.PublicKey);
                try
                {
                    string usernameEncode = context.Request.Form["UserName"];
                    string uname          = Com.Public.SqlEncStr(rsa.Decrypt(usernameEncode));
                    //获取到学校ID,判断该学校是否正常
                    //bool isschcor = false;
                    SchSystem.BLL.SchUserInfo userbll = new SchSystem.BLL.SchUserInfo();
                    SchSystem.BLL.SchInfo     schbll  = new SchSystem.BLL.SchInfo();
                    //if (Com.Public.getKey("issch") == "1")//单学校登录
                    //{
                    //    string appschid = Com.Public.getKey("appschid");
                    //    //判断该学校是否正常
                    //    isschcor = schbll.Exists(int.Parse(appschid), 1);
                    //}
                    //else//统一登录
                    //{
                    //    SchSystem.Model.SchUserInfo usermodel = userbll.GetModelByUname(uname);
                    //    if (usermodel != null && usermodel.UserId > 0)
                    //    {
                    //        isschcor = schbll.Exists(usermodel.SchId, 1);
                    //    }
                    //}
                    //if (!isschcor)
                    //{
                    //    rsp.RspCode = "6";
                    //    rsp.RspTxt = "该学校已经被关闭或者账号不存在,请联系系统管理人员!";
                    //}
                    //else
                    //{
                    string pwdEncode = context.Request.Form["PassWord"];
                    string txtCode   = context.Request.Form["TxtCode"];  //IsCookies
                    //string IsCookies = context.Request.Form["IsCookies"];
                    string txtcode = rsa.Decrypt(txtCode);
                    //string iscookies = rsa.Decrypt(IsCookies);
                    //bool iscook =false;
                    //if (iscookies == "1") iscook = true;
                    if (recode(txtcode, context))
                    {
                        if (!string.IsNullOrEmpty(uname))
                        {
                            string pwd = Com.Public.SqlEncStr(rsa.Decrypt(pwdEncode));
                            Com.Session.userpw = pwd;
                            Com.Session.usertp = "0";
                            string pwdmd5 = Com.Public.StrToMD5(pwd);
                            //查询所登录的用户名和密码是否一致。如果一致,则返回true;否则,返回false。
                            bool result = false;
                            if (Com.Public.getKey("issch") == "1")    //分学校部署,需要在本学校中
                            {
                                result = userbll.Exists("UserName='******' and PassWord='******' and Stat=1 and AccStat=1 and SysType=0 and schid=" + Com.Public.getKey("appschid"));
                            }
                            else    //总平台不允许分学校部署的用户登录,则加上schid所在学校限制
                            {
                                result = userbll.Exists("UserName='******' and PassWord='******' and Stat=1 and AccStat=1 and SysType=0 and schid not in (select schid from SchInfo where IsAlone=1)");
                            }
                            if (result == true)
                            {
                                //用户登录处理函数
                                str = Com.Public.UserLoginDo(uname, false, Com.Public.getKey("appschid"));

                                if (str == "1" && pwd == "123456")
                                {
                                    rsp.RspCode = "2";
                                    rsp.RspTxt  = context.Request.Url.Authority + context.Request.ApplicationPath + "/userpwdedit.aspx";
                                    //str = "2";//默认初始化密码,需要先修改密码
                                }
                                else
                                {
                                    rsp.RspCode = "1";
                                    rsp.RspTxt  = context.Request.Url.Authority + context.Request.ApplicationPath + "/index.aspx";
                                }
                            }
                            else
                            {
                                rsp.RspCode = "3";
                                rsp.RspTxt  = "账号或密码错误,请联系系统管理员!";
                                //str = "3";//账号或密码错误,或者被停用,请联系管理员
                            }
                        }
                        else
                        {
                            rsp.RspCode = "4";
                            rsp.RspTxt  = "用户名不能为空";
                            //str = "4";//用户名不能为空
                        }
                    }
                    else
                    {
                        rsp.RspCode = "5";
                        rsp.RspTxt  = "验证码错误";
                        //str = "5";//验证码错误
                    }
                    //}
                }
                catch (Exception ex)
                {
                    rsp.RspCode = "9";
                    rsp.RspTxt  = ex.Message;
                }
                context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(rsp));
            }
            else if (Action == "out")//退出
            {
                /*PublicMethod.Clear();*/

                context.Session.Clear();
                context.Session.Abandon();
                context.Response.Clear();
                //清除cookies
                Com.CookieHelper.ClearCookie("uname");
                rsp.RspCode = "success";
                rsp.RspTxt  = "Login.aspx";
                if (Com.Public.getKey("isyssch") == "1")
                {
                    rsp.RspTxt = "LoginYs.aspx";
                }
                context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(rsp));
            }
        }
        public static Com.DataPack.DataRsp <string> page(string PageIndex, string PageSize, string txtname, string ustat, string cotycode, string aprovserch, string acityserch, string schname)
        {
            Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
            if (Com.Session.userid == null)
            {
                rsp.code = "expire";
                rsp.msg  = "页面已经过期,请重新登录";
            }
            else
            {
                try
                {
                    SchSystem.BLL.SchInfo userbll = new SchSystem.BLL.SchInfo();

                    //Stat:0废弃,1正常,2被删除,正常界面不显示删除,超管界面可以考虑
                    string strwhere = "Stat<2 ";
                    if (!string.IsNullOrEmpty(cotycode))
                    {
                        strwhere += " and AreaNo = '" + Com.Public.SqlEncStr(cotycode) + "'";
                    }
                    if (!string.IsNullOrEmpty(aprovserch))
                    {
                        strwhere += " and left(AreaNo,2) = '" + Com.Public.SqlEncStr(aprovserch.Substring(0, 2)) + "'";
                    }
                    if (!string.IsNullOrEmpty(acityserch))
                    {
                        strwhere += " and left(AreaNo,4) = '" + Com.Public.SqlEncStr(acityserch.Substring(0, 4)) + "'";
                    }
                    if (!string.IsNullOrEmpty(schname))
                    {
                        strwhere += " and SchName like '%" + Com.Public.SqlEncStr(schname) + "%'";
                    }
                    if (!string.IsNullOrEmpty(txtname))
                    {
                        strwhere += " and SchId  = '" + Com.Public.SqlEncStr(txtname) + "'";
                    }
                    if (!string.IsNullOrEmpty(ustat))
                    {
                        strwhere += " and HomeschServStat=" + Com.Public.SqlEncStr(ustat);
                    }
                    string currentYear = "";
                    if (DateTime.Now.Month < 8)
                    {
                        currentYear = (DateTime.Now.Year - 1).ToString();
                    }
                    else
                    {
                        currentYear = DateTime.Now.Year.ToString();
                    }
                    Com.Public.PageModelResp pages = new Com.Public.PageModelResp();
                    pages.PageIndex = int.Parse(PageIndex);
                    pages.PageSize  = int.Parse(PageSize);
                    int       rowc   = 0;
                    int       pc     = 0;
                    string    dbcols = "SchId,SchName,HomeSchPlatName,HomeSchPlatUrl,HomeSchPlatIco,HomeSchPlatIP,SchMaster,SchoolSection,ServiceName,Artisan,SchCreator,RecTime,HomeschServStat,AreaNo";
                    DataTable dt     = userbll.GetListCols(dbcols, strwhere, "SchName", "ASC", pages.PageIndex, pages.PageSize, ref rowc, ref pc).Tables[0];
                    pages.PageCount = pc;
                    pages.RowCount  = rowc;
                    if (dt.Rows.Count > 0)
                    {
                        dt.Columns.Add("SHENG");
                        dt.Columns.Add("SHI");
                        dt.Columns.Add("QU");
                        dt.Columns.Add("graduated");
                        dt.Columns.Add("SoureName");
                        dt.Columns.Add("SchSubNames");
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            string[] areanames = Com.Public.GetArea(dt.Rows[i]["AreaNo"].ToString()).Split('|');
                            dt.Rows[i]["SHENG"] = areanames[0];
                            dt.Rows[i]["SHI"]   = areanames[1];
                            dt.Rows[i]["QU"]    = areanames[2];
                            //查询最近毕业年级
                            SchSystem.BLL.SchGradeInfo sgibll = new SchSystem.BLL.SchGradeInfo();
                            //dt.Rows[i]["graduated"] = sgibll.GetGradedYear("SchId=" + dt.Rows[i]["SchId"].ToString() + " and IsFinish=1");
                            string gradecurrent = " and isfinish=1 and ((left(GradeCode,1)='4' and " + currentYear + "-GradeYear=3) or (left(GradeCode,1)='3' and " + currentYear + "-GradeYear=3) or (left(GradeCode,1)='2' and " + currentYear + "-GradeYear=6) or (left(GradeCode,1)='1' and " + currentYear + "-GradeYear=5))";
                            dt.Rows[i]["graduated"] = sgibll.GetGradedYear("SchId=" + dt.Rows[i]["SchId"].ToString() + gradecurrent);
                            //查询子模块
                            SchSystem.BLL.SchAppRoleXXT sarxxtBll = new SchSystem.BLL.SchAppRoleXXT();
                            DataTable dtsarxxt = sarxxtBll.GetList("SchId='" + dt.Rows[i]["SchId"].ToString() + "'").Tables[0];
                            if (dtsarxxt.Rows.Count > 0)
                            {
                                string[]      sarsAppCodearr = dtsarxxt.Rows[0]["AppStr"].ToString().Split(',');
                                StringBuilder sarsAppCodesb  = new StringBuilder();
                                StringBuilder sasSoureName   = new StringBuilder();
                                for (int j = 0; j < sarsAppCodearr.Length; j++)
                                {
                                    sarsAppCodesb.Append(sarsAppCodearr[j] + ",");
                                }
                                SchSystem.BLL.SchAppXXT saxxtBll = new SchSystem.BLL.SchAppXXT();
                                if (sarsAppCodesb.ToString() != "")
                                {
                                    try
                                    {
                                        DataTable dtsas = saxxtBll.GetList("AppName", "AppCode in (" + sarsAppCodesb.ToString().Substring(0, sarsAppCodesb.ToString().Length - 1) + ")").Tables[0];

                                        if (dtsas.Rows.Count > 0)
                                        {
                                            foreach (DataRow dr in dtsas.Rows)
                                            {
                                                sasSoureName.Append(dr["AppName"] + ",");
                                            }
                                            dt.Rows[i]["SoureName"] = sasSoureName.ToString().Substring(0, sasSoureName.Length - 1);
                                        }
                                    }
                                    catch (Exception e) { }
                                }
                                else
                                {
                                    dt.Rows[i]["SoureName"] = "";
                                }
                            }
                            //查询科目
                            SchSystem.BLL.SchSub ssBll = new SchSystem.BLL.SchSub();
                            dt.Rows[i]["SchSubNames"] = ssBll.GetSubNames("Stat=1 and SchId='" + dt.Rows[i]["SchId"].ToString() + "'");
                        }
                        pages.list = dt;
                    }
                    rsp.data = Newtonsoft.Json.JsonConvert.SerializeObject(pages);
                }
                catch (Exception ex)
                {
                    rsp.code = "error";
                    rsp.msg  = ex.Message;
                }
            }
            return(rsp);
        }
Пример #20
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="TypeCode"></param>
        /// <param name="pAreaCode"></param>
        /// <param name="sAreaCode"></param>
        /// <param name="addall"></param>
        /// <param name="listoredit">區分是否為列表頁面和編輯頁面(1代表列表頁面;0代表編輯頁面)</param>
        /// <returns></returns>
        public static string GetDrpArea(string TypeCode, string pAreaCode, ref string sAreaCode, bool addall, string listoredit = "1")
        {
            DataTable     dt = new DataTable();
            StringBuilder sb = new StringBuilder();

            SchSystem.BLL.SysArea      bll      = new SchSystem.BLL.SysArea();
            SchSystem.BLL.SchInfo      bllsch   = new SchSystem.BLL.SchInfo();
            SchSystem.BLL.SchGradeInfo bllgrade = new SchSystem.BLL.SchGradeInfo();
            SchSystem.BLL.SchClassInfo bllclass = new SchSystem.BLL.SchClassInfo();
            string sqlstr = "";

            if (TypeCode == "0")//取省份
            {
                sqlstr = "";
            }
            else if (TypeCode == "1")//取城市
            {
                if (pAreaCode.Length == 6)
                {
                    sqlstr = " and left(AreaCode,2)='" + pAreaCode.Substring(0, 2) + "'";
                }
                else
                {
                    sqlstr = " and AreaCode='" + pAreaCode + "'";
                }
            }
            else if (TypeCode == "2")//取区县
            {
                if (pAreaCode.Length == 6)
                {
                    sqlstr = " and left(AreaCode,4)='" + pAreaCode.Substring(0, 4) + "'";
                }
                else
                {
                    sqlstr = " and AreaCode='" + pAreaCode + "'";
                }
            }
            if (addall)
            {
                sb.Append("<option value=\"\" selected=\"selected\">全部</option>");
            }
            if (TypeCode == "0" || TypeCode == "1" || TypeCode == "2")
            {
                //dt = bll.GetList("AreaCode ID,AreaName Name", "Stat=1 and TypeCode='" + TypeCode + "' " + sqlstr + " Order by AreaName").Tables[0];
                dt = bll.GetList("AreaCode ID,AreaName Name", "TypeCode='" + TypeCode + "' " + sqlstr + " Order by AreaName").Tables[0]; //获取全部省份
            }
            else if (TypeCode == "3")                                                                                                    //学校
            {
                dt = bllsch.GetList("SchId ID,SchName Name", "Stat=1 and AreaNo='" + pAreaCode + "' Order by SchName").Tables[0];
            }
            else if (TypeCode == "4")//年级
            {
                schids = pAreaCode;
                dt     = bllgrade.GetList("GradeId ID ,GradeName Name", "IsFinish=0 and SchId='" + pAreaCode + "' Order by GradeCode").Tables[0];
            }
            else if (TypeCode == "5")//班级
            {
                string strWhere = "";
                if (Com.Session.systype != "2")
                {
                    strWhere += " and schid ='" + Com.Session.schid + "'";
                }
                else
                {
                    strWhere += " and schid ='" + schids + "'";
                }
                dt = bllclass.GetList("ClassId ID, ClassName Name", "IsFinish=0 and GradeId='" + pAreaCode + "'" + strWhere + " Order by ClassName").Tables[0];
            }
            if (dt.Rows.Count > 0)
            {
                if (addall && listoredit == "1")
                {
                    sAreaCode = "";
                }
                else
                {
                    if (string.IsNullOrEmpty(sAreaCode))
                    {
                        sAreaCode = dt.Rows[0]["ID"].ToString();
                    }
                }
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    //if (sAreaCode == "" && i == 0)
                    //{
                    //    sb.Append("<option value=\"" + dt.Rows[i]["ID"].ToString() + "\" selected=\"selected\">" + dt.Rows[i]["Name"].ToString() + "</option>");
                    //}
                    //else
                    //{
                    // selected="selected"

                    if (dt.Rows[i]["ID"].ToString() == sAreaCode)
                    {
                        sb.Append("<option value=\"" + dt.Rows[i]["ID"].ToString() + "\" selected=\"selected\">" + dt.Rows[i]["Name"].ToString() + "</option>");
                    }
                    else
                    {
                        sb.Append("<option value=\"" + dt.Rows[i]["ID"].ToString() + "\">" + dt.Rows[i]["Name"].ToString() + "</option>");
                    }
                    //}
                }
            }
            return(sb.ToString());
        }
Пример #21
0
        //需要根据不同情况建立或修改的不同学校用户和不同类型的用户,本学校用户唯一,不需要全系统唯一
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (true)//如果没对应权限,及判断用户类型是否跨界,主要防止非法篡改数据出现
            //{
            //    Response.Write("无对应权限");
            //    Response.End();
            //}
            if (!IsPostBack)
            {
                //先得到操作类型
                dotype    = Com.Public.SqlEncStr(Request.Params["dotype"].ToString());
                schid     = Com.Public.SqlEncStr(Request.Params["schid"].ToString());
                gradecode = Com.Public.SqlEncStr(Request.Params["gradecode"].ToString());
                if (string.IsNullOrEmpty(schid) || string.IsNullOrEmpty(gradecode))//如果没有对应参数中任意一个
                {
                    Response.Write("参数错误!");
                    Response.End();
                }
                if (dotype == "a")
                {
                }
                else if (dotype == "e")//修改,不能修改用户的类型及学校参数
                {
                    btnname = "保存";
                    classid = Com.Public.SqlEncStr(Request.Params["classid"].ToString());
                    if (string.IsNullOrEmpty(classid))
                    {
                        Response.Write("无对应修改的记录!");
                        Response.End();
                    }
                    //获取修改的对应用户的
                    SchSystem.BLL.SchClassInfo   sgibll   = new SchSystem.BLL.SchClassInfo();
                    SchSystem.Model.SchClassInfo sgimodel = sgibll.GetModel(int.Parse(classid));
                    if (sgimodel != null && sgimodel.ClassId > 0)
                    {
                        umodelstr = Newtonsoft.Json.JsonConvert.SerializeObject(sgimodel);
                    }
                    else
                    {
                        Response.Write("无该记录!");
                        Response.End();
                    }
                }
                else//不在添加及修改之内,则返回
                {
                    Response.Write("没有可供确认的操作类型!");
                    Response.End();
                }

                /*//判断跨界操作的可能性
                 * if (!Com.Public.isVa(schid, systype))
                 * {
                 *  Response.Write("出错,用户非法跨界操作!");
                 *  Response.End();
                 * }*/
                SchSystem.BLL.SchInfo schbll = new SchSystem.BLL.SchInfo();
                schname = schbll.GetSchName(int.Parse(schid));
                #region 获取当前学校的老师
                //当前班级任课老师及班主任
                SchSystem.BLL.SchClassUser userclassbll = new SchSystem.BLL.SchClassUser();
                DataTable dtclassuser = userclassbll.GetList("UserName id,SubCode subcode,UserTname name,IsMs isms", "ClassId=" + Com.Public.SqlEncStr(classid)).Tables[0];

                //当前学校老师
                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];
                //DataRow[] dtRow = dtuser.Select();
                StringBuilder sb = new StringBuilder();
                //DataView dv = dtuser.DefaultView;
                //DataTable datadpt = dv.ToTable(true, "Pid,DeptId,DepartName");
                SchSystem.BLL.SchDepartInfo dptbll = new SchSystem.BLL.SchDepartInfo();
                DataTable dt        = dptbll.GetList(" 'd_'+convert(varchar(20),Pid) pId,'d_'+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().Replace("d_", "") + "'");
                        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"]  = "d_" + item["DeptId"].ToString();
                                dtdptuser.Rows.Add(dr);
                            }
                        }
                    }
                    deptusers = Newtonsoft.Json.JsonConvert.SerializeObject(dtdptuser);
                    //DataRow[] drs = dt.Select("Pid=0");
                    //foreach (DataRow dr in drs)
                    //{
                    //    string nodeID = dr["ID"].ToString();
                    //    string nodeText = dr["Name"].ToString();


                    //    nodeText = "├" + nodeText;
                    //    string blank = "&nbsp;&nbsp;&nbsp;&nbsp;";
                    //    sb.Append("<option value=\"p_" + nodeID + "\">" + nodeText + "</option>");
                    //    DataRow[] drusers = dtuser.Select("DeptId='" + nodeID + "'");
                    //    if (drusers != null && drusers.Length > 0)
                    //    {
                    //        foreach (DataRow druser in drusers)
                    //        {
                    //            sb.Append("<option style=\"color:blue\" value=\"u_" + druser["UserId"].ToString() + "\">" + blank + "&nbsp;&nbsp;&nbsp;&nbsp;" + druser["UserTname"].ToString() + "</option>");
                    //        }
                    //    }
                    //    BindSon(sb, nodeID, dt, blank, dtuser);
                    //}
                }
                //depts = sb.ToString();
                deptss  = Newtonsoft.Json.JsonConvert.SerializeObject(dtclassuser);
                subsdrp = Com.Public.GetDrp("sub", schid, "1", false, "", "");
                #endregion

                #region 获取年级领导
                SchSystem.BLL.SchGradeUsers usergradebll = new SchSystem.BLL.SchGradeUsers();
                gradeboss = usergradebll.GetNames("GradeId='" + Com.Public.SqlEncStr(gradecode) + "'");
                gradesdrp = Com.Public.GetDrp("grade", schid, "0", false, "", "");
                #endregion
            }
        }
Пример #22
0
        //需要根据不同情况建立或修改的不同学校用户和不同类型的用户,本学校用户唯一,不需要全系统唯一
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (true)//如果没对应权限,及判断用户类型是否跨界,主要防止非法篡改数据出现
            //{
            //    Response.Write("无对应权限");
            //    Response.End();
            //}
            if (!IsPostBack)
            {
                //不是超管获取本学校的
                if (Com.Session.systype != "2")
                {
                    schid   = Com.Session.schid;
                    systype = "0";
                }
                else
                {
                    schid = Request.Params["schid"].ToString();
                    if (string.IsNullOrEmpty(schid))//如果没有对应参数中任意一个
                    {
                        Response.Write("学校ID为空或者添加的类型为空!");
                        Response.End();
                    }
                }
                SchSystem.BLL.SchSub ssBll = new SchSystem.BLL.SchSub();
                //先得到操作类型
                dotype = Com.Public.SqlEncStr(Request.Params["dotype"].ToString());
                string subid = "0"; //修改时的用户ID
                string uname = "";  //修改时的用户账号
                if (dotype == "e")  //修改,不能修改用户的类型及学校参数
                {
                    btnname = "保存";
                    subid   = Com.Public.SqlEncStr(Request.Params["subid"].ToString());
                    if (string.IsNullOrEmpty(subid))
                    {
                        Response.Write("无对应修改的用户!");
                        Response.End();
                    }
                    //获取修改的对应用户的
                    SchSystem.Model.SchSub ssModel = ssBll.GetModelSub(subid, schid);
                    if (ssModel != null && ssModel.SubId > 0)
                    {
                        umodelstr = Newtonsoft.Json.JsonConvert.SerializeObject(ssModel);
                        schid     = ssModel.SchId.ToString();
                    }
                    else
                    {
                        Response.Write("无该科目!");
                        Response.End();
                    }
                }
                else//不在添加及修改之内,则返回
                {
                    Response.Write("没有可供确认的操作类型!");
                    Response.End();
                }
                //判断跨界操作的可能性
                if (!Com.Public.isVa(schid, systype))
                {
                    Response.Write("出错,用户非法跨界操作!");
                    Response.End();
                }
                #region
                SchSystem.BLL.SchInfo schbll = new SchSystem.BLL.SchInfo();
                schname = schbll.GetSchName(int.Parse(schid));
                SchSystem.BLL.SchDepartInfo sdiBll = new SchSystem.BLL.SchDepartInfo();
                //获取部门列表
                DataTable dtdpt = sdiBll.GetList("Pid pId,convert(varchar(20),DepartId) id,DepartName name,'false' checked,'true' nochecks", "SchId=" + schid + " and Stat=1 Order by OrderId").Tables[0];
                dtdpt.Columns["nochecks"].ColumnName = "nocheck";
                DataTable dtdptuser = dtdpt.Clone();
                if (dtdpt.Rows.Count > 0)
                {
                    //获取该年级组长
                    SchSystem.BLL.SchSubLeader sslBll = new SchSystem.BLL.SchSubLeader();
                    DataTable dtgradeuser             = sslBll.GetList("UserName", "SubCode=" + subid).Tables[0];
                    //获取该学校的所有人员
                    SchSystem.BLL.SchUserDeptV userbll = new SchSystem.BLL.SchUserDeptV();
                    DataTable dtuser = userbll.GetList("DeptId ,UserId,UserTname", "Stat=1 and Ustat=1 and SchId=" + Com.Public.SqlEncStr(schid)).Tables[0];
                    //合并人员到部门表
                    for (int i = 0; i < dtdpt.Rows.Count; i++)
                    {
                        dtdptuser.Rows.Add(dtdpt.Rows[i].ItemArray);
                        //获取该部门下的人员
                        DataRow[] drs = dtuser.Select("DeptId='" + dtdpt.Rows[i]["id"].ToString() + "'");
                        if (drs.Length > 0)
                        {
                            foreach (DataRow item in drs)
                            {
                                //如果是被绑定了,则勾选
                                DataRow[] drsgrade = dtgradeuser.Select("UserName='******'");
                                DataRow   dr       = dtdptuser.NewRow();
                                dr["id"]   = "sub_" + item["UserId"].ToString();
                                dr["name"] = item["UserTname"].ToString();
                                dr["pId"]  = item["DeptId"].ToString();
                                if (drsgrade.Length > 0)
                                {
                                    dr["checked"] = "true";
                                }
                                dtdptuser.Rows.Add(dr);
                            }
                        }
                    }
                }

                depart = Newtonsoft.Json.JsonConvert.SerializeObject(dtdptuser);
                #endregion
            }
        }
        //需要根据不同情况建立或修改的不同学校用户和不同类型的用户,本学校用户唯一,不需要全系统唯一
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (true)//如果没对应权限,及判断用户类型是否跨界,主要防止非法篡改数据出现
            //{
            //    Response.Write("无对应权限");
            //    Response.End();
            //}
            if (!IsPostBack)
            {
                //先得到操作类型
                dotype    = Com.Public.SqlEncStr(Request.Params["dotype"].ToString());
                schid     = Com.Public.SqlEncStr(Request.Params["schid"].ToString());
                gradecode = Com.Public.SqlEncStr(Request.Params["gradecode"].ToString());
                if (string.IsNullOrEmpty(schid) || string.IsNullOrEmpty(gradecode))//如果没有对应参数中任意一个
                {
                    Response.Write("参数错误!");
                    Response.End();
                }
                if (dotype == "a")
                {
                }
                else if (dotype == "e")//修改,不能修改用户的类型及学校参数
                {
                    btnname = "修改";
                    classid = Com.Public.SqlEncStr(Request.Params["classid"].ToString());
                    if (string.IsNullOrEmpty(classid))
                    {
                        Response.Write("无对应修改的记录!");
                        Response.End();
                    }
                    //获取修改的对应用户的
                    SchSystem.BLL.SchClassInfo   sgibll   = new SchSystem.BLL.SchClassInfo();
                    SchSystem.Model.SchClassInfo sgimodel = sgibll.GetModel(int.Parse(classid));
                    if (sgimodel != null && sgimodel.ClassId > 0)
                    {
                        umodelstr = Newtonsoft.Json.JsonConvert.SerializeObject(sgimodel);
                    }
                    else
                    {
                        Response.Write("无该记录!");
                        Response.End();
                    }
                }
                else//不在添加及修改之内,则返回
                {
                    Response.Write("没有可供确认的操作类型!");
                    Response.End();
                }

                /*//判断跨界操作的可能性
                 * if (!Com.Public.isVa(schid, systype))
                 * {
                 *  Response.Write("出错,用户非法跨界操作!");
                 *  Response.End();
                 * }*/
                #region 获取部门人员列表
                SchSystem.BLL.SchInfo schbll = new SchSystem.BLL.SchInfo();
                schname = schbll.GetSchName(int.Parse(schid));
                //获取年级领导
                SchSystem.BLL.SchGradeUsers usergradebll = new SchSystem.BLL.SchGradeUsers();
                gradeboss = usergradebll.GetNames("GradeId in ( select GradeId from SchGradeInfo where GradeCode=" + Com.Public.SqlEncStr(gradecode) + " and schid=" + schid + ")");
                gradesdrp = Com.Public.GetDrp("grade", schid, "0", false, "", "");
                SchSystem.BLL.SchDepartInfo sdiBll = new SchSystem.BLL.SchDepartInfo();
                //获取部门列表
                DataTable dtdpt = sdiBll.GetList("Pid pId,convert(varchar(20),DepartId) id,DepartName name,'false' checked,'true' nochecks,'0' isms,'' subcode", "SchId=" + Com.Public.SqlEncStr(schid) + " and Stat=1 Order by OrderId").Tables[0];
                dtdpt.Columns["nochecks"].ColumnName = "nocheck";
                DataTable     dtdptuser = dtdpt.Clone();
                StringBuilder sb        = new StringBuilder();
                if (dtdpt.Rows.Count > 0)
                {
                    SchSystem.BLL.SchClassUser userclassbll = new SchSystem.BLL.SchClassUser();
                    DataTable dtclassuser = userclassbll.GetList("UserName,SubCode,IsMs", "ClassId=" + Com.Public.SqlEncStr(classid)).Tables[0];
                    //获取该学校的所有人员
                    SchSystem.BLL.SchUserDeptV userbll = new SchSystem.BLL.SchUserDeptV();
                    DataTable dtuser = userbll.GetList("DeptId ,UserName,UserTname", "Stat=1 and Ustat=1 and SchId=" + Com.Public.SqlEncStr(schid)).Tables[0];
                    //合并人员到部门表
                    for (int i = 0; i < dtdpt.Rows.Count; i++)
                    {
                        dtdptuser.Rows.Add(dtdpt.Rows[i].ItemArray);
                        //获取该部门下的人员
                        DataRow[] drs = dtuser.Select("DeptId='" + dtdpt.Rows[i]["id"].ToString() + "'");
                        if (drs.Length > 0)
                        {
                            foreach (DataRow item in drs)
                            {
                                DataRow dr = dtdptuser.NewRow();
                                dr["id"]   = "u_" + item["UserName"].ToString();
                                dr["name"] = item["UserTname"].ToString();
                                dr["pId"]  = item["DeptId"].ToString();
                                //如果是被绑定了,则勾选
                                DataRow[] drsclassuser = dtclassuser.Select("UserName='******'");
                                if (drsclassuser.Length > 0)
                                {
                                    dr["isms"]    = drsclassuser[0]["IsMs"].ToString();
                                    dr["subcode"] = drsclassuser[0]["SubCode"].ToString();
                                    dr["checked"] = "true";
                                }
                                dtdptuser.Rows.Add(dr);
                            }
                        }
                    }
                }
                SchSystem.BLL.SchUserInfo sui = new SchSystem.BLL.SchUserInfo();
                DataTable dtsui = sui.GetList("*", "Stat=1 and SchId=" + Com.Public.SqlEncStr(schid)).Tables[0];
                DataRow[] drsui = dtsui.Select();

                foreach (DataRow item in drsui)
                {
                    sb.Append("<option value=\"u_" + item["UserName"].ToString() + "\">" + item["UserTname"].ToString() + "</option>");
                }
                tec     = sb.ToString();
                depts   = Newtonsoft.Json.JsonConvert.SerializeObject(dtdptuser);
                subsdrp = Com.Public.GetDrp("sub", schid, "1", false, "", "");
                #endregion
                #region 获取部门人员列表

                /*SchSystem.BLL.SchInfo schbll = new SchSystem.BLL.SchInfo();
                 * schname = schbll.GetSchName(int.Parse(schid));
                 * //获取年级领导
                 * SchSystem.BLL.SchGradeUsers usergradebll = new SchSystem.BLL.SchGradeUsers();
                 * gradeboss = usergradebll.GetNames("GradeId in ( select GradeId from SchGradeInfo where GradeCode=" + Com.Public.SqlEncStr(gradecode) + " and schid=" + schid + ")");
                 * gradesdrp = Com.Public.GetDrp("grade", schid, "0", false, "", "");
                 * SchSystem.BLL.SchDepartInfo sdiBll = new SchSystem.BLL.SchDepartInfo();
                 * //获取部门列表
                 * DataTable dtdpt = sdiBll.GetList("Pid pId,convert(varchar(20),DepartId) id,DepartName name,'false' checked,'false' checked,'true' nochecks,'0' isms,'' subcode", "SchId=" + Com.Public.SqlEncStr(schid) + " and Stat=1 Order by OrderId").Tables[0];
                 * dtdpt.Columns["nochecks"].ColumnName = "nocheck";
                 * DataTable dtdptuser = dtdpt.Clone();
                 * StringBuilder sb = new StringBuilder();
                 * if (dtdpt.Rows.Count > 0)
                 * {
                 *  SchSystem.BLL.SchClassUser userclassbll = new SchSystem.BLL.SchClassUser();
                 *  DataTable dtclassuser = userclassbll.GetList("UserName,SubCode,IsMs", "ClassId=" + Com.Public.SqlEncStr(classid)).Tables[0];
                 *  //获取该学校的所有人员
                 *  SchSystem.BLL.SchUserDeptV userbll = new SchSystem.BLL.SchUserDeptV();
                 *  DataTable dtuser = userbll.GetList("DeptId ,UserName,UserTname", "Stat=1 and Ustat=1 and SchId=" + Com.Public.SqlEncStr(schid)).Tables[0];
                 *  //合并人员到部门表
                 *  int z = 0;
                 *  for (int i = 0; i < dtdpt.Rows.Count; i++)
                 *  {
                 *
                 *      dtdptuser.Rows.Add(dtdpt.Rows[i].ItemArray);
                 *      //获取该部门下的人员
                 *      DataRow[] drs = dtuser.Select("DeptId='" + dtdpt.Rows[i]["id"].ToString() + "'");
                 *      if (drs.Length > 0)
                 *      {
                 *          foreach (DataRow item in drs)
                 *          {
                 *              sb.Append("<option value=\"u_"+z+"_" + item["UserName"].ToString() + "\">" + item["UserTname"].ToString() + "</option>");
                 *              DataRow dr = dtdptuser.NewRow();
                 *              dr["id"] = "u_" + z + "_" + item["UserName"].ToString();
                 *              dr["name"] = item["UserTname"].ToString();
                 *              dr["pId"] = item["DeptId"].ToString();
                 *              //如果是被绑定了,则勾选
                 *              DataRow[] drsclassuser = dtclassuser.Select("UserName='******'");
                 *              if (drsclassuser.Length > 0)
                 *              {
                 *                  dr["isms"] = drsclassuser[0]["IsMs"].ToString();
                 *                  dr["subcode"] = drsclassuser[0]["SubCode"].ToString();
                 *                  dr["checked"] = "true";
                 *              }z++;
                 *              dtdptuser.Rows.Add(dr);
                 *
                 *          }
                 *      }
                 *  }
                 *
                 * }
                 * tec = sb.ToString();
                 * depts = Newtonsoft.Json.JsonConvert.SerializeObject(dtdptuser);
                 * subsdrp = Com.Public.GetDrp("sub", schid, "1", false, "", "");*/
                #endregion
            }
        }
        public static Com.DataPack.DataRsp <string> page(string PageIndex, string PageSize, string txtname, string ustat, string cotycode, string schid, string aprovserch, string acityserch, string txtschid)
        {
            Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
            if (Com.Session.userid == null)
            {
                rsp.code = "expire";
                rsp.msg  = "页面已经过期,请重新登录";
            }
            else
            {
                try
                {
                    SchSystem.BLL.SchInfo      userbll     = new SchSystem.BLL.SchInfo();
                    SchSystem.BLL.SchGradeInfo schgradebll = new SchSystem.BLL.SchGradeInfo();
                    string strwhere = "Stat<2 ";
                    if (!string.IsNullOrEmpty(cotycode))
                    {
                        strwhere += " and AreaNo = '" + Com.Public.SqlEncStr(cotycode) + "'";
                    }
                    if (!string.IsNullOrEmpty(aprovserch))
                    {
                        strwhere += " and left(AreaNo,2) = '" + Com.Public.SqlEncStr(aprovserch.Substring(0, 2)) + "'";
                    }
                    if (!string.IsNullOrEmpty(acityserch))
                    {
                        strwhere += " and left(AreaNo,4) = '" + Com.Public.SqlEncStr(acityserch.Substring(0, 4)) + "'";
                    }
                    if (!string.IsNullOrEmpty(txtschid))
                    {
                        strwhere += " and SchId = " + int.Parse(Com.Public.SqlEncStr(txtschid));
                    }
                    else
                    {
                        if (schid != "0")
                        {
                            strwhere += " and SchId = '" + Com.Public.SqlEncStr(schid) + "'";
                        }
                    }
                    if (!string.IsNullOrEmpty(ustat))
                    {
                        if (ustat == "1")
                        {
                            strwhere += " and schid in (select schid from SchThdInfo)";
                        }
                        else
                        {
                            strwhere += " and schid not in (select schid from SchThdInfo)";
                        }
                    }
                    //"schid in (select schid from SchThdInfo)"
                    if (!string.IsNullOrEmpty(txtname))
                    {
                        strwhere += " and SchName like '%" + Com.Public.SqlEncStr(txtname) + "%'";
                    }
                    Com.Public.PageModelResp pages = new Com.Public.PageModelResp();
                    pages.PageIndex = int.Parse(PageIndex);
                    pages.PageSize  = int.Parse(PageSize);
                    int rowc = 0; int pc = 0;

                    SchSystem.BLL.SchThdInfo thdbll = new SchSystem.BLL.SchThdInfo();
                    string    clos = "SchId,SchName,AreaNo";
                    DataTable dt   = userbll.GetListCols(clos, strwhere, "SchName", "", pages.PageIndex, pages.PageSize, ref rowc, ref pc).Tables[0];
                    pages.PageCount = pc;
                    pages.RowCount  = rowc;
                    if (dt.Rows.Count > 0)
                    {
                        dt.Columns.Add("Ustat");
                        dt.Columns.Add("SHENG");
                        dt.Columns.Add("SHI");
                        dt.Columns.Add("QU");
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            bool thdbool = thdbll.Exists(int.Parse(dt.Rows[i]["SchId"].ToString()));
                            if (thdbool)
                            {
                                dt.Rows[i]["Ustat"] = "有";
                            }
                            else
                            {
                                dt.Rows[i]["Ustat"] = "无";
                            }
                            string[] areanames = Com.Public.GetArea(dt.Rows[i]["AreaNo"].ToString()).Split('|');
                            dt.Rows[i]["SHENG"] = areanames[0];
                            dt.Rows[i]["SHI"]   = areanames[1];
                            dt.Rows[i]["QU"]    = areanames[2];
                        }
                        pages.list = dt;
                    }
                    rsp.data = Newtonsoft.Json.JsonConvert.SerializeObject(pages);
                }
                catch (Exception ex)
                {
                    rsp.code = "error";
                    rsp.msg  = ex.Message;
                }
            }
            return(rsp);
        }
Пример #25
0
        //用户登录判断
        public static string UserLoginDo(string uname, bool iscookies, string schid)
        {
            string str = "";

            SchSystem.BLL.SchUserInfo userbll = new SchSystem.BLL.SchUserInfo();
            //查询登录用户记录数据
            DataTable SchUserInfoDs = userbll.GetList("UserId,UserName,UserTname,SchId,SysType,ImgUrl", "UserName='******' and Stat=1 and AccStat=1 and SchId=" + schid).Tables[0];

            if (SchUserInfoDs.Rows.Count > 0)
            {
                SchSystem.BLL.SchUserRoleV userroleV = new SchSystem.BLL.SchUserRoleV();
                DataTable dtroles = userroleV.GetList("UserName='******' and Stat=1 and AccStat=1 and SchId=" + schid).Tables[0];
                //if (dtroles.Rows.Count > 0)
                //{
                //设置Session信息
                Com.Session.usertid = SchUserInfoDs.Rows[0]["UserId"].ToString();
                Com.Session.userid  = SchUserInfoDs.Rows[0]["UserName"].ToString();
                Com.Session.uname   = SchUserInfoDs.Rows[0]["UserTname"].ToString();
                Com.Session.schid   = SchUserInfoDs.Rows[0]["SchId"].ToString();
                Com.Session.systype = SchUserInfoDs.Rows[0]["SysType"].ToString();
                Com.Session.imgurl  = SchUserInfoDs.Rows[0]["ImgUrl"].ToString();
                //合并普通权限串
                Com.Session.userrolestr = Com.Public.UserRoleStr(dtroles);
                //合并特殊权限串
                Com.Session.userrolestrext = Com.Public.UserRoleExtStr(dtroles);
                Com.Session.ulogintime     = DateTime.Now.ToString("yyyyMMddHHmmss");
                //设置cookies
                if (iscookies)
                {
                    CookieHelper.SetCookie("uname", uname, DateTime.Now.AddDays(7));
                }
                //获取老师身份
                if (Com.Session.usertp == "0")
                {
                    string tectype = "0";
                    //1年级主任,2科任组长,3班主任,4科任老师
                    SchSystem.BLL.SchGradeUserV bllgrade = new SchSystem.BLL.SchGradeUserV();
                    if (bllgrade.Exists(Com.Session.usertid))
                    {
                        tectype += ",1";
                    }
                    SchSystem.BLL.SchUserSubV bllsub = new SchSystem.BLL.SchUserSubV();
                    if (bllsub.Exists(Com.Session.usertid))
                    {
                        tectype += ",2";
                    }
                    SchSystem.BLL.SchClassUser bllclasssub = new SchSystem.BLL.SchClassUser();
                    if (bllclasssub.ExistsV(0, 1, Com.Session.usertid, 1))
                    {
                        tectype += ",3";
                    }
                    if (bllclasssub.ExistsV(0, 1, Com.Session.usertid, 0))
                    {
                        tectype += ",4";
                    }
                    Com.Session.usertectp = tectype;
                }
                //获取该学校的系统编辑状态
                SchSystem.BLL.SchInfo   schbll   = new SchSystem.BLL.SchInfo();
                SchSystem.Model.SchInfo schmodel = schbll.GetModel(int.Parse(Com.Session.schid));
                Com.Session.appeditstat = schmodel.SonSysStat.ToString();
                str = "1";
                //}
                // else
                // {
                //     str = "该账号没有相应的权限或者对应角色被屏蔽,请联系管理员进行分配处理";
                //  }
            }
            else
            {
                str = "该账号被屏蔽或不存在";
            }

            return(str);
        }
Пример #26
0
        public static string GetDrpAreaStu(string TypeCode, string pAreaCode, ref string sAreaCode, bool addall)
        {
            DataTable     dt = new DataTable();
            StringBuilder sb = new StringBuilder();

            SchSystem.BLL.SysArea      bll      = new SchSystem.BLL.SysArea();
            SchSystem.BLL.SchInfo      bllsch   = new SchSystem.BLL.SchInfo();
            SchSystem.BLL.SchGradeInfo bllgrade = new SchSystem.BLL.SchGradeInfo();
            SchSystem.BLL.SchClassInfo bllclass = new SchSystem.BLL.SchClassInfo();

            string sqlstr = "";

            if (TypeCode == "0")//取省份
            {
                sqlstr = "";
            }
            else if (TypeCode == "1" && pAreaCode != "")//取城市
            {
                if (pAreaCode.Length == 6)
                {
                    sqlstr = " and left(AreaCode,2)='" + pAreaCode.Substring(0, 2) + "'";
                }
                else
                {
                    sqlstr = " and AreaCode='" + Com.Public.SqlEncStr(pAreaCode) + "'";
                }
            }
            else if (TypeCode == "2" && pAreaCode != "")//取区县
            {
                if (pAreaCode.Length == 6)
                {
                    sqlstr = " and left(AreaCode,4)='" + pAreaCode.Substring(0, 4) + "'";
                }
                else
                {
                    sqlstr = " and AreaCode='" + Com.Public.SqlEncStr(pAreaCode) + "'";
                }
            }
            if (addall)
            {
                sb.Append("<option value=\"-1\"  selected=\"selected\">全部</option>");
            }
            if (TypeCode == "0" || TypeCode == "1" || TypeCode == "2")
            {
                //dt = bll.GetList("AreaCode ID,AreaName Name", "Stat=1 and TypeCode='" + TypeCode + "' " + sqlstr + " Order by AreaName").Tables[0];
                dt = bll.GetList("AreaCode ID,AreaName Name", "TypeCode='" + Com.Public.SqlEncStr(TypeCode) + "' " + sqlstr + " Order by AreaName").Tables[0]; //获取全部省份
            }
            else if (TypeCode == "3")                                                                                                                          //学校
            {
                dt = bllsch.GetList("SchId ID,SchName Name", "Stat=1 and AreaNo='" + Com.Public.SqlEncStr(pAreaCode) + "' Order by SchName").Tables[0];
            }
            else if (TypeCode == "4")//年级
            {
                //普通老师
                if (Com.Session.systype == "0")
                {
                    if (Com.Public.IsUserVal(Com.Session.userrolestr, 2))//有查询权限,则全校
                    {
                        dt = bllgrade.GetList("GradeId ID ,GradeName Name", "IsFinish=0 and SchId='" + Com.Public.SqlEncStr(pAreaCode) + "' Order by GradeCode").Tables[0];
                    }
                    else
                    {
                        dt = bllgrade.GetList("GradeId ID ,GradeName Name", "IsFinish=0 and SchId='" + Com.Public.SqlEncStr(pAreaCode) + "' and (GradeId in (select GradeId FROM SchGradeUsers where UserName="******") or GradeId in (select GradeId FROM SchClassUserV where UserName="******")) Order by GradeCode").Tables[0];
                    }
                }
                else//学校超管
                {
                    dt = bllgrade.GetList("GradeId ID ,GradeName Name", "IsFinish=0 and SchId='" + Com.Public.SqlEncStr(pAreaCode) + "' Order by GradeCode").Tables[0];
                }
            }
            else if (TypeCode == "5")//班级
            {
                if (pAreaCode == "")
                {
                    pAreaCode = "0";
                }
                //普通老师
                if (Com.Session.systype == "0")
                {
                    if (Com.Public.IsUserVal(Com.Session.userrolestr, 2))//有查询权限,则全校
                    {
                        dt = bllclass.GetList("ClassId ID, ClassName Name", "IsFinish=0 and GradeId='" + Com.Public.SqlEncStr(pAreaCode) + "' Order by ClassName").Tables[0];
                    }
                    else
                    {
                        dt = bllclass.GetList("ClassId ID, ClassName Name", "IsFinish=0 and GradeId='" + Com.Public.SqlEncStr(pAreaCode) + "' and (GradeId in (select GradeId FROM SchGradeUsers where UserName="******") or ClassId in (select ClassId FROM SchClassUserV where UserName="******")) Order by ClassName").Tables[0];
                    }
                }
                else//学校超管
                {
                    dt = bllclass.GetList("ClassId ID, ClassName Name", "IsFinish=0 and GradeId='" + Com.Public.SqlEncStr(pAreaCode) + "' Order by ClassName").Tables[0];
                }
            }
            if (dt.Rows.Count > 0)
            {
                if (sAreaCode == "")//输出第一个节点
                {
                    sAreaCode = dt.Rows[0]["ID"].ToString();
                }

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (sAreaCode == "" && i == 0)
                    {
                        sb.Append("<option value=\"" + dt.Rows[i]["ID"].ToString() + "\" selected=\"selected\">" + dt.Rows[i]["Name"].ToString() + "</option>");
                    }
                    else
                    {
                        // selected="selected"
                        if (dt.Rows[i]["ID"].ToString() == sAreaCode)
                        {
                            sb.Append("<option value=\"" + dt.Rows[i]["ID"].ToString() + "\">" + dt.Rows[i]["Name"].ToString() + "</option>");
                        }
                        else
                        {
                            sb.Append("<option value=\"" + dt.Rows[i]["ID"].ToString() + "\">" + dt.Rows[i]["Name"].ToString() + "</option>");
                        }
                    }
                }
            }
            return(sb.ToString());
        }
Пример #27
0
 public static Com.DataPack.DataRsp <string> page(string PageIndex, string PageSize, string txtname, string ustat, string cotycode, string schid, string aprovserch, string acityserch, string txtschid)
 {
     Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
     if (Com.Session.userid == null)
     {
         rsp.code = "expire";
         rsp.msg  = "页面已经过期,请重新登录";
     }
     else
     {
         try
         {
             SchSystem.BLL.SchInfo userbll = new SchSystem.BLL.SchInfo();
             if (schid == "")
             {
                 schid = "0";
             }
             //Stat:0废弃,1正常,2被删除,正常界面不显示删除,超管界面可以考虑
             string strwhere = "Stat<2 ";
             if (!string.IsNullOrEmpty(cotycode))
             {
                 strwhere += " and AreaNo = '" + Com.Public.SqlEncStr(cotycode) + "'";
             }
             if (!string.IsNullOrEmpty(aprovserch))
             {
                 strwhere += " and left(AreaNo,2) = '" + Com.Public.SqlEncStr(aprovserch.Substring(0, 2)) + "'";
             }
             if (!string.IsNullOrEmpty(acityserch))
             {
                 strwhere += " and left(AreaNo,4) = '" + Com.Public.SqlEncStr(acityserch.Substring(0, 4)) + "'";
             }
             if (!string.IsNullOrEmpty(txtschid))
             {
                 strwhere += " and SchId = " + int.Parse(Com.Public.SqlEncStr(txtschid));
             }
             else
             {
                 if (schid != "0")
                 {
                     strwhere += " and SchId = '" + Com.Public.SqlEncStr(schid) + "'";
                 }
             }
             if (!string.IsNullOrEmpty(txtname))
             {
                 strwhere += " and SchName like '%" + Com.Public.SqlEncStr(txtname) + "%'";
             }
             if (!string.IsNullOrEmpty(ustat))
             {
                 strwhere += " and Stat='1' and SonSysStat='" + Com.Public.SqlEncStr(ustat) + "'";
             }
             string currentYear = "";
             if (DateTime.Now.Month < 8)
             {
                 currentYear = (DateTime.Now.Year - 1).ToString();
             }
             else
             {
                 currentYear = DateTime.Now.Year.ToString();
             }
             Com.Public.PageModelResp pages = new Com.Public.PageModelResp();
             pages.PageIndex = int.Parse(PageIndex);
             pages.PageSize  = int.Parse(PageSize);
             int       rowc   = 0;
             int       pc     = 0;
             string    dbcols = "SchId,SchName,PlatformIP,AloneUser,AreaNo,AloneTime,PlatformUrl,IsAlone";
             DataTable dt     = userbll.GetListCols(dbcols, strwhere, "SchName", "ASC", pages.PageIndex, pages.PageSize, ref rowc, ref pc).Tables[0];
             pages.PageCount = pc;
             pages.RowCount  = rowc;
             if (dt.Rows.Count > 0)
             {
                 dt.Columns.Add("SHENG");
                 dt.Columns.Add("SHI");
                 dt.Columns.Add("QU");
                 for (int i = 0; i < dt.Rows.Count; i++)
                 {
                     string[] areanames = Com.Public.GetArea(dt.Rows[i]["AreaNo"].ToString()).Split('|');
                     dt.Rows[i]["SHENG"] = areanames[0];
                     dt.Rows[i]["SHI"]   = areanames[1];
                     dt.Rows[i]["QU"]    = areanames[2];
                 }
                 pages.list = dt;
             }
             rsp.data = Newtonsoft.Json.JsonConvert.SerializeObject(pages).Replace("\n\r", "");
         }
         catch (Exception ex)
         {
             rsp.code = "error";
             rsp.msg  = ex.Message;
         }
     }
     return(rsp);
 }
        //需要根据不同情况建立或修改的不同学校用户和不同类型的用户,本学校用户唯一,不需要全系统唯一
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (true)//如果没对应权限,及判断用户类型是否跨界,主要防止非法篡改数据出现
            //{
            //    Response.Write("无对应权限");
            //    Response.End();
            //}
            if (!IsPostBack)
            {
                //先得到操作类型
                dotype = Com.Public.SqlEncStr(Request.Params["dotype"].ToString());
                string gradeid = "0"; //修改时的用户ID
                string uname   = "";  //修改时的用户账号
                if (dotype == "e")    //修改,不能修改用户的类型及学校参数
                {
                    btnname = "保存";
                    gradeid = Com.Public.SqlEncStr(Request.Params["gradeid"].ToString());
                    if (string.IsNullOrEmpty(gradeid))
                    {
                        Response.Write("无对应修改的用户!");
                        Response.End();
                    }
                    //获取修改的对应用户的
                    SchSystem.BLL.SchGradeInfo   sgibll   = new SchSystem.BLL.SchGradeInfo();
                    SchSystem.Model.SchGradeInfo sgimodel = sgibll.GetModel(int.Parse(gradeid));
                    if (sgimodel != null && sgimodel.GradeId > 0)
                    {
                        umodelstr = Newtonsoft.Json.JsonConvert.SerializeObject(sgimodel);
                        schid     = sgimodel.SchId.ToString();
                    }
                    else
                    {
                        Response.Write("无该用户!");
                        Response.End();
                    }
                }
                else//不在添加及修改之内,则返回
                {
                    Response.Write("没有可供确认的操作类型!");
                    Response.End();
                }
                //判断跨界操作的可能性
                if (!Com.Public.isVa(schid, systype))
                {
                    Response.Write("出错,用户非法跨界操作!");
                    Response.End();
                }
                #region
                SchSystem.BLL.SchInfo schbll = new SchSystem.BLL.SchInfo();
                schname = schbll.GetSchName(int.Parse(schid));
                SchSystem.BLL.SchDepartInfo sdiBll = new SchSystem.BLL.SchDepartInfo();
                //获取部门列表
                DataTable dtdpt = sdiBll.GetList("Pid pId,convert(varchar(20),DepartId) id,DepartName name,'false' checked,'true' nochecks", "SchId=" + schid + " and Stat=1 Order by OrderId").Tables[0];
                dtdpt.Columns["nochecks"].ColumnName = "nocheck";
                DataTable dtdptuser = dtdpt.Clone();
                if (dtdpt.Rows.Count > 0)
                {
                    //获取该年级下关联的领导
                    SchSystem.BLL.SchGradeUsers usergradebll = new SchSystem.BLL.SchGradeUsers();
                    DataTable dtgradeuser = usergradebll.GetList("UserName", "GradeId=" + gradeid).Tables[0];
                    //获取该学校的所有人员
                    SchSystem.BLL.SchUserDeptV userbll = new SchSystem.BLL.SchUserDeptV();
                    DataTable dtuser = userbll.GetList("DeptId ,UserId id,UserTname name,'false' checked,'true' nochecks", "Stat=1 and Ustat=1 and SchId=" + Com.Public.SqlEncStr(schid)).Tables[0];

                    foreach (DataRow item in dtuser.Select())
                    {
                        DataRow[] drsgrade = dtgradeuser.Select("UserName='******'");

                        if (drsgrade.Length > 0)
                        {
                            item["checked"] = "true";
                        }
                    }
                    schuser = Newtonsoft.Json.JsonConvert.SerializeObject(dtuser);
                }

                depart = Newtonsoft.Json.JsonConvert.SerializeObject(dtdpt);
                #endregion
            }
        }
Пример #29
0
        public string subs      = "";  //相应学校科目表及个人科目,json
        //需要根据不同情况建立或修改的不同学校用户和不同类型的用户,本学校用户唯一,不需要全系统唯一
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (true)//如果没对应权限,及判断用户类型是否跨界,主要防止非法篡改数据出现
            //{
            //    Response.Write("无对应权限");
            //    Response.End();
            //}
            if (!IsPostBack)
            {
                //先得到操作类型
                dotype = Request.Params["dotype"].ToString();
                string uid   = "0"; //修改时的用户ID
                string uname = "";  //修改时的用户账号
                if (dotype == "a")  //添加
                {
                    //根据登录人员的身份,需要得到不同的参数
                    if (Com.SoureSession.Souresystype == "2")//超管,两个关键参数均需要确认
                    {
                        schid   = Request.Params["schid"].ToString();
                        systype = Request.Params["systype"].ToString();
                        if (string.IsNullOrEmpty(schid) || string.IsNullOrEmpty(systype))//如果没有对应参数中任意一个
                        {
                            Response.Write("学校ID为空或者添加的类型为空!");
                            Response.End();
                        }
                    }
                    else//本学校超管或本学校有权限的用户,只能操作普通用户
                    {
                        schid   = Com.SoureSession.Soureschid;
                        systype = "0";
                    }
                }
                else if (dotype == "e" || dotype == "s")//修改或查看,不能修改用户的类型及学校参数
                {
                    btnname = "修改";
                    uid     = Request.Params["uid"].ToString();
                    if (string.IsNullOrEmpty(uid))
                    {
                        Response.Write("无对应修改的用户!");
                        Response.End();
                    }
                    //获取修改的对应用户的
                    SchSystem.BLL.SchUserInfo   userbll   = new SchSystem.BLL.SchUserInfo();
                    SchSystem.Model.SchUserInfo usermodel = userbll.GetModel(int.Parse(uid));
                    if (usermodel != null && usermodel.UserId > 0)
                    {
                        umodelstr = Newtonsoft.Json.JsonConvert.SerializeObject(usermodel);
                        schid     = usermodel.SchId.ToString();
                        systype   = usermodel.SysType.ToString();
                        uname     = usermodel.UserName;
                    }
                    else
                    {
                        Response.Write("无该用户!");
                        Response.End();
                    }
                }
                else//不在添加及修改之内,则返回
                {
                    Response.Write("没有可供确认的操作类型!");
                    Response.End();
                }
                //判断跨界操作的可能性
                if (!Com.Public.isVa(schid, systype))
                {
                    Response.Write("出错,用户非法跨界操作!");
                    Response.End();
                }
                SchSystem.BLL.SchInfo schbll = new SchSystem.BLL.SchInfo();
                schname = schbll.GetSchName(int.Parse(schid));
                if (!string.IsNullOrEmpty(schid) && !string.IsNullOrEmpty(systype))
                {
                    //获取整个学校的科目
                    subs = Com.Public.GetDrp("sub", schid, "1", false, "", "");

                    //获取整个学校的部门
                    SchSystem.BLL.SchDepartInfo dptbll = new SchSystem.BLL.SchDepartInfo();
                    DataTable dtdept = dptbll.GetList("Pid pId,DepartId id,DepartName name,'false' checked", "SchId=" + schid + " and Stat=1 Order by OrderId").Tables[0];
                    //获取该用户的关联部门
                    SchSystem.BLL.SchUserDeptV udeptvbll = new SchSystem.BLL.SchUserDeptV();
                    string udeptids = udeptvbll.GetIds(" UserId='" + uid + "' and stat=1 and schid=" + schid);
                    if (!string.IsNullOrEmpty(udeptids) && dtdept != null)
                    {
                        string[] ids = udeptids.Split(',');
                        for (int i = 0; i < dtdept.Rows.Count; i++)
                        {
                            string id = dtdept.Rows[i]["id"].ToString();
                            if (ids.Contains(id))
                            {
                                dtdept.Rows[i]["checked"] = "true";
                            }
                        }
                    }

                    depts = Newtonsoft.Json.JsonConvert.SerializeObject(dtdept);
                    //获取角色菜单
                    SchSystem.BLL.SchRole rolebll = new SchSystem.BLL.SchRole();
                    DataTable             dtrole  = rolebll.GetList("RoleId id,null pId,RoleName name,'false' checked", "Stat=1 and SchId=" + schid + " and SysType='" + systype + "'  Order by RoleName").Tables[0];
                    if (dtrole.Rows.Count == 0)
                    {
                        //给个默认根节点
                        DataRow dr = dtrole.NewRow();
                        dr["id"]      = "0";
                        dr["pId"]     = DBNull.Value;
                        dr["name"]    = "权限组";
                        dr["checked"] = "false";
                        dtrole.Rows.Add(dr);
                    }
                    //获取该用户关联的角色
                    SchSystem.BLL.SchUserRoleV urolevbll = new SchSystem.BLL.SchUserRoleV();
                    string uroleids = urolevbll.GetIds(" UserId='" + uid + "' and stat=1 and schid=" + schid);
                    if (!string.IsNullOrEmpty(uroleids) && dtrole != null)
                    {
                        string[] ids = uroleids.Split(',');
                        for (int i = 0; i < dtrole.Rows.Count; i++)
                        {
                            string id = dtrole.Rows[i]["id"].ToString();
                            if (ids.Contains(id))
                            {
                                dtrole.Rows[i]["checked"] = "true";
                            }
                        }
                    }
                    roles = Newtonsoft.Json.JsonConvert.SerializeObject(dtrole);
                    //获取功能树,查询条件需要根据用户种类和状态等,后面需要改
                    //根据学校拥有的子系统
                    SchSystem.BLL.SchAppRole schapprolebll = new SchSystem.BLL.SchAppRole();
                    string appstr = schapprolebll.GetAppStr(int.Parse(schid));
                    if (appstr != "")
                    {
                        appstr = " and (AppCode=1 or AppCode=2 or AppCode in (" + appstr + ")) ";
                    }
                    SchSystem.BLL.SchMenuInfoUserFunc funcbll = new SchSystem.BLL.SchMenuInfoUserFunc();

                    DataTable dtfunc = funcbll.GetList("MenuId id,Pid pId,TextName name,FuncCode funcode,'false' checked", " Stat=1 " + appstr + " Order by OrderId").Tables[0];
                    funcstr = Newtonsoft.Json.JsonConvert.SerializeObject(dtfunc);
                }
            }
        }
        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();
                }
            }
        }