public static string getschsub(string schid)
        {
            string ret = "";

            Com.DataPack.DataRsp <Com.DataPack.UserInfo> rsp = Com.Public.UserFuncSoure(Com.SoureSession.jsid, Com.SoureSession.jstoken);
            if (rsp.code == "ERROR_TOKEN")
            {
                ret = "expire";
            }
            else
            {
                //获取学校的科目
                SchSystem.BLL.SchSub SchSubBll = new SchSystem.BLL.SchSub();
                DataTable            dtschsub  = SchSubBll.GetList("SubName", "Stat=1 and SchId='" + schid + "'").Tables[0];
                if (dtschsub.Rows.Count > 0)
                {
                    StringBuilder sbSubName = new StringBuilder();
                    foreach (DataRow drSubName in dtschsub.Rows)
                    {
                        sbSubName.Append(drSubName["SubName"] + "、");
                    }
                    ret = sbSubName.ToString().Substring(0, sbSubName.Length - 1);
                }
            }
            return(ret);
        }
Exemple #2
0
        //public string schclassinfo = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.Params["schid"] != null && Request.Params["schid"].ToString() != "")
                {
                    schid = Com.Public.SqlEncStr(Request.Params["schid"].ToString());
                }

                //获取学校的科目
                SchSystem.BLL.SchSub SchSubBll = new SchSystem.BLL.SchSub();
                DataTable            dtschsub  = SchSubBll.GetList("SubName", "Stat=1 and SchId='" + schid + "' order by SubCode").Tables[0];
                if (dtschsub.Rows.Count > 0)
                {
                    StringBuilder sbSubName = new StringBuilder();
                    foreach (DataRow drSubName in dtschsub.Rows)
                    {
                        sbSubName.Append(drSubName["SubName"] + "、");
                    }
                    schsubname = sbSubName.ToString().Substring(0, sbSubName.Length - 1);
                }

                //获取学校年级
                SchSystem.BLL.SchGradeInfo SchGradeBll = new SchSystem.BLL.SchGradeInfo();
                DataTable dtschgrade = SchGradeBll.GetList("GradeId,GradeYear,GradeName", "IsFinish=0 and SchId='" + schid + "' Order by GradeCode").Tables[0];
                schgradeinfo = Newtonsoft.Json.JsonConvert.SerializeObject(dtschgrade);

                //获取学校班级
                //SchSystem.BLL.SchClassInfo SchClassBll = new SchSystem.BLL.SchClassInfo();
                //DataTable dtschclass = SchClassBll.GetList("ClassId,GradeId,ClassName", "IsFinish=0 and SchId='" + schid + "'").Tables[0];
                //schclassinfo = Newtonsoft.Json.JsonConvert.SerializeObject(dtschclass);
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.Params["schid"] != null && Request.Params["schid"].ToString() != "")
     {
         schid = Com.Public.SqlEncStr(Request.Params["schid"].ToString());
         //年级
         SchSystem.BLL.SchGradeInfo sgiBLL = new SchSystem.BLL.SchGradeInfo();
         DataTable dtSchGrade = sgiBLL.GetList(" IsFinish=0 and SchId='" + schid + "' order by GradeCode").Tables[0];//得到年级数据列表,并且是为非毕业的年级
         //年级领导
         SchSystem.BLL.SchGradeUsers sguBLL = new SchSystem.BLL.SchGradeUsers();
         dtSchGrade.Columns.Add("GradeBoss");
         if (dtSchGrade.Rows.Count > 0)
         {
             for (int i = 0; i < dtSchGrade.Rows.Count; i++)
             {
                 dtSchGrade.Rows[i]["GradeBoss"] = sguBLL.GetNames("GradeId=" + dtSchGrade.Rows[i]["GradeId"].ToString());
             }
         }
         grades = Newtonsoft.Json.JsonConvert.SerializeObject(dtSchGrade);
         //当前学校所开设的科目
         SchSystem.BLL.SchSub schsubBll = new SchSystem.BLL.SchSub();
         DataSet dsSchSub = schsubBll.GetList("Stat=1 and SchId='" + schid + "'");
         subs = Newtonsoft.Json.JsonConvert.SerializeObject(dsSchSub);
         //获取科目教师
         SchSystem.BLL.SchSubLeader scuBll = new SchSystem.BLL.SchSubLeader();
         DataSet dssubUser = scuBll.GetListTecSub("*", "schid='" + schid + "' and Stat=1");
         subUser = Newtonsoft.Json.JsonConvert.SerializeObject(dssubUser);
         //subUser
         //当前学校的教师
         SchSystem.BLL.SchUserInfo suiBll = new SchSystem.BLL.SchUserInfo();
         DataSet dsSUI = suiBll.GetList("*", "Stat=1 and SchId='" + schid + "'");
         tecs = Newtonsoft.Json.JsonConvert.SerializeObject(dsSUI);
     }
 }
Exemple #4
0
 /// <summary>
 /// 添加科目
 /// </summary>
 /// <param name="selsubs"></param>
 /// <param name="schid"></param>
 public static void subAdd(string selsubs, int schid)
 {
     if (selsubs != "")
     {
         SchSystem.BLL.SchSub subbll = new SchSystem.BLL.SchSub();
         subbll.DoSchSubs(Com.Session.userid, schid.ToString(), selsubs);//SchWebAdmin.Com.Session.userid
     }
 }
        public static string getSearch(string schid, string gradecode, string subcode, string ustat)
        {
            schid     = Com.Public.SqlEncStr(schid);
            gradecode = Com.Public.SqlEncStr(gradecode);
            subcode   = Com.Public.SqlEncStr(subcode);
            ustat     = Com.Public.SqlEncStr(ustat);
            string ret = "";

            Com.DataPack.DataRsp <Com.DataPack.UserInfo> rsp = Com.Public.UserFuncSoure(Com.SoureSession.jsid, Com.SoureSession.jstoken);
            if (rsp.code == "ERROR_TOKEN")
            {
                ret = "expire";
            }
            else
            {
                try
                {
                    //年级
                    SchSystem.BLL.SchGradeInfo sgiBLL = new SchSystem.BLL.SchGradeInfo();
                    DataTable dtSchGrade = sgiBLL.GetList(" IsFinish=0 and SchId=" + schid + " order by GradeCode").Tables[0];//得到年级数据列表,并且是为非毕业的年级
                    //年级领导
                    SchSystem.BLL.SchGradeUsers sguBLL = new SchSystem.BLL.SchGradeUsers();
                    dtSchGrade.Columns.Add("GradeBoss");
                    if (dtSchGrade.Rows.Count > 0)
                    {
                        for (int i = 0; i < dtSchGrade.Rows.Count; i++)
                        {
                            dtSchGrade.Rows[i]["GradeBoss"] = sguBLL.GetNames("GradeId=" + dtSchGrade.Rows[i]["GradeId"].ToString());
                        }
                    }
                    //grades = Newtonsoft.Json.JsonConvert.SerializeObject(dtSchGrade);
                    //当前学校所开设的科目
                    SchSystem.BLL.SchSub schsubBll = new SchSystem.BLL.SchSub();
                    DataSet dsSchSub = schsubBll.GetList("Stat=1 and SchId=" + schid);
                    //subs = Newtonsoft.Json.JsonConvert.SerializeObject(dsSchSub);
                    //获取科目教师
                    SchSystem.BLL.SchSubLeader scuBll = new SchSystem.BLL.SchSubLeader();
                    DataSet dssubUser = scuBll.GetListTecSub("*", "schid='" + schid + "' and Stat=1");
                    //subUser = Newtonsoft.Json.JsonConvert.SerializeObject(dssubUser);

                    searchgradsub ds = new searchgradsub();
                    ds.grade  = dtSchGrade;
                    ds.subs   = dsSchSub;
                    ds.subtec = dssubUser;
                    ret       = Newtonsoft.Json.JsonConvert.SerializeObject(ds);
                }
                catch (Exception ex)
                {
                    ret = ex.Message;
                }
            }
            return(ret);
        }
Exemple #6
0
        //获取科目信息
        public static string GetSubName(string subcode, string schid)
        {
            string ret = "";

            SchSystem.BLL.SchSub subbll = new SchSystem.BLL.SchSub();
            DataTable            dt     = subbll.GetList("SubName", "SchId=" + schid + " and stat=1 and subcode=" + subcode).Tables[0];

            if (dt != null && dt.Rows.Count > 0)
            {
                ret = dt.Rows[0]["SubName"].ToString();
            }
            return(ret);
        }
        public static string getschsub(string schid)
        {
            string ret = "";

            //获取学校的科目
            SchSystem.BLL.SchSub SchSubBll = new SchSystem.BLL.SchSub();
            DataTable            dtschsub  = SchSubBll.GetList("SubName", "Stat=1 and SchId='" + schid + "'").Tables[0];

            if (dtschsub.Rows.Count > 0)
            {
                StringBuilder sbSubName = new StringBuilder();
                foreach (DataRow drSubName in dtschsub.Rows)
                {
                    sbSubName.Append(drSubName["SubName"] + "、");
                }
                ret = sbSubName.ToString().Substring(0, sbSubName.Length - 1);
            }
            return(ret);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                islook = true;
                if (Com.Session.appeditstat == "0" && Com.Session.systype == "1")
                {
                    isadd  = false;
                    isedit = false;
                    isdel  = false;
                }
                else
                {
                    isadd  = true;
                    isedit = true;
                    isdel  = true;
                }
                //不是超管获取本学校的
                if (Com.Session.systype != "2")
                {
                    schid = Com.Session.schid;
                }
                else//超管还要加省市区学校下拉,后面需要更改
                {
                    //第一次加载,获取省市区,获取第一个省份下的所有学校
                    StringBuilder sbarea = new StringBuilder();
                    //获取省份
                    sbarea.Append("省:<select id=\"aprov\">");
                    string sareacode = "";
                    sbarea.Append(Com.Public.GetDrpArea("0", "", ref sareacode, false));
                    sbarea.Append("</select>");
                    //获取城市
                    sbarea.Append("市:<select id=\"acity\">");
                    string sareacitycode = "";
                    sbarea.Append(Com.Public.GetDrpArea("1", sareacode, ref sareacitycode, false));
                    sbarea.Append("</select>");
                    //获取区县
                    sbarea.Append("区:<select id=\"acoty\">");
                    string sareacotycode = "";
                    sbarea.Append(Com.Public.GetDrpArea("2", sareacitycode, ref sareacotycode, false));
                    cotycode = sareacotycode;
                    sbarea.Append("</select>");
                    sbarea.Append("学校:<select id=\"asch\">");
                    string sareaschid = "";
                    sbarea.Append(Com.Public.GetDrpArea("3", sareacotycode, ref sareaschid, false));
                    if (sareaschid != "")
                    {
                        schid = sareaschid;
                    }
                    sbarea.Append("</select>");
                    areastr = sbarea.ToString();
                }

                //获取学校的科目
                SchSystem.BLL.SchSub SchSubBll = new SchSystem.BLL.SchSub();
                DataTable            dtschsub  = SchSubBll.GetList("SubName", "Stat=1 and SchId='" + schid + "'").Tables[0];
                if (dtschsub.Rows.Count > 0)
                {
                    StringBuilder sbSubName = new StringBuilder();
                    foreach (DataRow drSubName in dtschsub.Rows)
                    {
                        sbSubName.Append(drSubName["SubName"] + "、");
                    }
                    schsubname = sbSubName.ToString().Substring(0, sbSubName.Length - 1);
                }

                //获取学校年级
                SchSystem.BLL.SchGradeInfo SchGradeBll = new SchSystem.BLL.SchGradeInfo();
                DataTable dtschgrade = SchGradeBll.GetList("GradeId,GradeYear,GradeName", "IsFinish=0 and SchId='" + schid + "' Order by GradeCode ASC").Tables[0];
                schgradeinfo = Newtonsoft.Json.JsonConvert.SerializeObject(dtschgrade);

                //获取学校班级
                //SchSystem.BLL.SchClassInfo SchClassBll = new SchSystem.BLL.SchClassInfo();
                //DataTable dtschclass = SchClassBll.GetList("ClassId,GradeId,ClassName", "IsFinish=0 and SchId='" + schid + "'").Tables[0];
                //schclassinfo = Newtonsoft.Json.JsonConvert.SerializeObject(dtschclass);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string jsid    = Request.Params["sid"].ToString();
            string jstoken = Request.Params["token"].ToString();

            Com.SoureSession.jsid    = jsid;
            Com.SoureSession.jstoken = jstoken;
            Com.DataPack.DataRsp <Com.DataPack.UserInfo> rsp = Com.Public.UserFuncSoure(jsid, jstoken);
            if (rsp.code == "ERROR_TOKEN")
            {
                Response.Write("登录已失效!");
                Response.End();
            }
            else if (!IsPostBack)
            {
                if (Com.SoureSession.Souresystype == "1" || Com.SoureSession.Souresystype == "2")//超级管理员和学校管理员
                {
                    islook = true;
                    if (Com.SoureSession.Souresystype == "1")
                    {
                        isadd  = false;
                        isedit = false;
                        isdel  = false;
                    }
                    else
                    {
                        isadd  = true;
                        isedit = true;
                        isdel  = true;
                    }
                }
                else//普通老师
                {
                    isadd  = false;
                    isedit = false;
                    isdel  = false;
                    islook = true;//学科/年级/班级任课权限
                }
                //isGradeClassAuth = Com.Public.IsUserVal(Com.Session.userrolestr, 2) ? true : false;//学科/年级/班级任课权限

                //不是超管获取本学校的
                if (Com.SoureSession.Souresystype != "2")
                {
                    schid = Com.SoureSession.Soureschid;
                }
                else//超管还要加省市区学校下拉,后面需要更改
                {
                    //第一次加载,获取省市区,获取第一个省份下的所有学校
                    StringBuilder sbarea = new StringBuilder();
                    //获取省份
                    sbarea.Append("省:<select id=\"aprov\">");
                    string sareacode = "";
                    sbarea.Append(Com.Public.GetDrpArea("0", "", ref sareacode, false));
                    sbarea.Append("</select>");
                    //获取城市
                    sbarea.Append("市:<select id=\"acity\">");
                    string sareacitycode = "";
                    sbarea.Append(Com.Public.GetDrpArea("1", sareacode, ref sareacitycode, false));
                    sbarea.Append("</select>");
                    //获取区县
                    sbarea.Append("区:<select id=\"acoty\">");
                    string sareacotycode = "";
                    sbarea.Append(Com.Public.GetDrpArea("2", sareacitycode, ref sareacotycode, false));
                    cotycode = sareacotycode;
                    sbarea.Append("</select>");
                    sbarea.Append("学校:<select id=\"asch\">");
                    string sareaschid = "";
                    sbarea.Append(Com.Public.GetDrpArea("3", sareacotycode, ref sareaschid, false));
                    if (sareaschid != "")
                    {
                        schid = sareaschid;
                    }
                    sbarea.Append("</select>");
                    areastr = sbarea.ToString();
                    systype = Com.SoureSession.Souresystype;
                }
                //当前学校年级:IsFinish状态,1代表已毕业;0代表未毕业
                // SchSystem.BLL.SchGradeInfo sgiBll = new SchSystem.BLL.SchGradeInfo();
                //DataSet dsSchGrade = sgiBll.GetList("IsFinish=0 and SchId=" + schid);
                //年级
                SchSystem.BLL.SchGradeInfo sgiBLL = new SchSystem.BLL.SchGradeInfo();
                DataTable dtSchGrade = sgiBLL.GetList(" IsFinish=0 and SchId='" + schid + "' order by GradeCode").Tables[0];//得到年级数据列表,并且是为非毕业的年级
                //年级领导
                SchSystem.BLL.SchGradeUsers sguBLL = new SchSystem.BLL.SchGradeUsers();
                dtSchGrade.Columns.Add("GradeBoss");
                if (dtSchGrade.Rows.Count > 0)
                {
                    for (int i = 0; i < dtSchGrade.Rows.Count; i++)
                    {
                        dtSchGrade.Rows[i]["GradeBoss"] = sguBLL.GetNames("GradeId=" + dtSchGrade.Rows[i]["GradeId"].ToString());
                    }
                }
                grades = Newtonsoft.Json.JsonConvert.SerializeObject(dtSchGrade);
                //当前学校所开设的科目
                SchSystem.BLL.SchSub schsubBll = new SchSystem.BLL.SchSub();
                DataSet dsSchSub = schsubBll.GetList("Stat=1 and SchId='" + schid + "'");
                subs = Newtonsoft.Json.JsonConvert.SerializeObject(dsSchSub);
                //获取科目教师
                SchSystem.BLL.SchSubLeader scuBll = new SchSystem.BLL.SchSubLeader();
                DataSet dssubUser = scuBll.GetListTecSub("*", "schid='" + schid + "' and Stat=1");
                subUser = Newtonsoft.Json.JsonConvert.SerializeObject(dssubUser);
                //subUser
                //当前学校的教师
                SchSystem.BLL.SchUserInfo suiBll = new SchSystem.BLL.SchUserInfo();
                DataSet dsSUI = suiBll.GetList("*", "Stat=1 and SchId='" + schid + "'");
                tecs = Newtonsoft.Json.JsonConvert.SerializeObject(dsSUI);
            }
        }
Exemple #10
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)
        {
            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();
                }
            }
        }
        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);
        }
        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);
        }
        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();
                }
            }
        }
Exemple #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                usertname = Com.Session.uname;

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

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

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

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


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

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

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

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

                dtgrade.Rows.Add(dry);

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

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

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

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

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

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

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

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

                deptsuser = Newtonsoft.Json.JsonConvert.SerializeObject(dtdptuser);
            }
        }
Exemple #16
0
        public static string GetDrp(string drptype, string schid, string stat, bool addall, string selfid, string selid)
        {
            drptype = SqlEncStr(drptype);
            schid   = SqlEncStr(schid);
            stat    = SqlEncStr(stat);
            selfid  = SqlEncStr(selfid);
            DataTable     dt = new DataTable();
            StringBuilder sb = new StringBuilder();

            if (schid == "")
            {
                schid = "0";
            }
            //获取部门
            if (drptype == "dpt")
            {
                SchSystem.BLL.SchDepartInfo dptbll = new SchSystem.BLL.SchDepartInfo();
                dt = dptbll.GetList("Pid,DepartId ID,DepartName Name", "SchId=" + schid + " and Stat=" + stat + " Order by OrderId,DepartName").Tables[0];
            }
            else if (drptype == "sub")
            {
                SchSystem.BLL.SchSub subbll = new SchSystem.BLL.SchSub();
                dt = subbll.GetList("0 Pid,SubCode ID,SubName Name", "SchId=" + schid + " and Stat=" + stat + " Order by OrderId,SubName").Tables[0];
            }
            else if (drptype == "grade")
            {
                SchSystem.BLL.SchGradeInfo subbll = new SchSystem.BLL.SchGradeInfo();
                if (stat == "")
                {
                    dt = subbll.GetList("0 Pid,GradeId ID,GradeName Name", "SchId=" + schid + " Order by GradeCode").Tables[0];
                }
                else
                {
                    dt = subbll.GetList("0 Pid,GradeId ID,GradeName Name", "SchId=" + schid + " and IsFinish=" + stat + " Order by GradeCode").Tables[0];
                }
            }
            if (addall)
            {
                sb.Append("<option value=\'0\'>全部</option>");
            }
            if (dt.Rows.Count > 0)
            {
                string    childrenids = "";
                DataRow[] drs         = dt.Select("Pid=0");
                foreach (DataRow dr in drs)
                {
                    string nodeID   = dr["ID"].ToString();
                    string nodeText = dr["Name"].ToString();
                    if (nodeID != selfid)
                    {
                        //GetSonId(nodeID, dt, ref childrenids);
                        if (drptype == "dpt")
                        {
                            nodeText = "├" + nodeText;
                        }
                        if (dr["ID"].ToString() == selid)
                        {
                            sb.Append("<option value=\"" + nodeID + "\" selected=\"selected\" childrenids=\"\">" + nodeText + "</option>");
                        }
                        else
                        {
                            sb.Append("<option value=\"" + nodeID + "\" childrenids=\"\">" + nodeText + "</option>");
                        }
                        if (drptype == "dpt")
                        {
                            string blank = "&nbsp;&nbsp;&nbsp;&nbsp;";

                            BindSon(sb, nodeID, dt, blank, selid, selfid);
                        }
                    }
                }
            }
            return(sb.ToString());
        }
Exemple #17
0
 public static Com.DataPack.DataRsp <string> page(string PageIndex, string PageSize, string txtname, string ustat, string cotycode, string schid, string aprovserch, string acityserch)
 {
     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 (schid != "")
             {
                 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);
             }
             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,PlatformName,PlatformUrl,PlatformIco,PlatformIP,SchMaster,SchoolSection,ServiceName,Artisan,SchCreator,RecTime,Stat,iscity,SonSysStat,AreaNo,SchType";
             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("ManagerAcount");
                 dt.Columns.Add("InitialPwd");
                 dt.Columns.Add("graduated");
                 dt.Columns.Add("AppSonSys");
                 dt.Columns.Add("SchSubNames");
                 dt.Columns.Add("SchTypeName");
                 SchSystem.BLL.SysPer bllper = new SchSystem.BLL.SysPer();
                 DataTable            dtper  = bllper.GetList("PerName,PerCode", " Stat=1 ").Tables[0];
                 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];
                     DataRow[] dtr = dtper.Select("PerCode='" + dt.Rows[i]["SchType"].ToString() + "'");
                     if (dtr.Length > 0)
                     {
                         dt.Rows[i]["SchTypeName"] = dtr[0]["PerName"].ToString();
                     }
                     else
                     {
                         dt.Rows[i]["SchTypeName"] = "";
                     }
                     //获取管理员账号密码信息
                     SchSystem.BLL.SchUserInfo   suiBll        = new SchSystem.BLL.SchUserInfo();
                     SchSystem.Model.SchUserInfo modeluserinfo = suiBll.GetSupportModel(int.Parse(dt.Rows[i]["SchId"].ToString()), 1);
                     if (modeluserinfo != null)
                     {
                         if (modeluserinfo.UserName != "" && modeluserinfo.UserName != null)
                         {
                             dt.Rows[i]["ManagerAcount"] = modeluserinfo.UserName;
                         }
                         if (modeluserinfo.PassWord != "" && modeluserinfo.PassWord != null)
                         {
                             dt.Rows[i]["InitialPwd"] = 1;
                         }
                     }
                     else
                     {
                         dt.Rows[i]["ManagerAcount"] = "";
                         dt.Rows[i]["InitialPwd"]    = "";
                     }
                     //查询最近毕业年级
                     string currentYear = "";
                     if (DateTime.Now.Month < 8)
                     {
                         currentYear = (DateTime.Now.Year - 1).ToString();
                     }
                     else
                     {
                         currentYear = DateTime.Now.Year.ToString();
                     }
                     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.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();
                         SchSystem.BLL.SchApp saBll = new SchSystem.BLL.SchApp();
                         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);
                         }
                     }
                     //查询科目
                     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);
 }