public static string adddpt(string schid, string dptname, string pid, string stat)
        {
            schid   = Com.Public.SqlEncStr(schid);
            dptname = Com.Public.SqlEncStr(dptname);
            pid     = Com.Public.SqlEncStr(pid);
            stat    = Com.Public.SqlEncStr(stat);
            string ret = "";

            if (Com.Session.userid == null)
            {
                ret = "expire";
            }
            else
            {
                try
                {
                    SchSystem.BLL.SchDepartInfo bll = new SchSystem.BLL.SchDepartInfo();
                    DataTable dtTopOrderOne         = bll.GetList("top 1 OrderId", "Schid='" + schid + "' and Pid='" + pid + "' Order By OrderId Desc").Tables[0];
                    DataRow[] drTopOrderOne         = dtTopOrderOne.Select();
                    int       OrderId = 0;
                    if (dtTopOrderOne.Rows.Count == 0)//如果子类为空,设置OrderId默认值为0;
                    {
                        OrderId = 0;
                    }
                    else//否则,获取最大值并加1
                    {
                        foreach (DataRow item in drTopOrderOne)
                        {
                            OrderId = Convert.ToInt32(item["OrderId"]) + 1;
                        }
                    }
                    SchSystem.Model.SchDepartInfo model = new SchSystem.Model.SchDepartInfo();
                    model.RecTime = DateTime.Now;
                    model.RecUser = Com.Session.userid;
                    model.SchId   = int.Parse(schid);

                    model.OrderId = OrderId;

                    if (pid.ToString() == "null")
                    {
                        model.Pid = Convert.ToInt32(0);
                    }
                    else
                    {
                        model.Pid = int.Parse(pid);
                    }
                    model.Stat        = int.Parse(stat);
                    model.DepartName  = Com.Public.SqlEncStr(dptname);
                    model.LastRecTime = DateTime.Now;
                    model.LastRecUser = Com.Session.userid;
                    int id = bll.Add(model);
                    ret = id.ToString();
                }
                catch (Exception ex)
                {
                    ret = ex.Message;
                }
            }
            return(ret);
        }
        public static string MoveUpDown(string dptid, string moveType)
        {
            dptid    = Com.Public.SqlEncStr(dptid);
            moveType = Com.Public.SqlEncStr(moveType);
            string ret = "";

            if (Com.Session.userid == null)
            {
                ret = "expire";
            }
            else
            {
                if (moveType == "up")//上移
                {
                    moveType = "1";
                }
                else if (moveType == "down")//下移
                {
                    moveType = "0";
                }
                SchSystem.BLL.SchDepartInfo dptbll = new SchSystem.BLL.SchDepartInfo();
                int s = dptbll.ChangeOrderBy(dptid, moveType);
                if (s > 0)
                {
                    ret = "success";
                }
                else if (s == 0)
                {
                    ret = "success01";
                }
            }
            return(ret);
        }
        public static string MoveUpDown(string dptid, string moveType)
        {
            dptid    = Com.Public.SqlEncStr(dptid);
            moveType = Com.Public.SqlEncStr(moveType);
            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
            {
                if (moveType == "up")//上移
                {
                    moveType = "1";
                }
                else if (moveType == "down")//下移
                {
                    moveType = "0";
                }
                SchSystem.BLL.SchDepartInfo dptbll = new SchSystem.BLL.SchDepartInfo();
                int s = dptbll.ChangeOrderBy(dptid, moveType);
                if (s > 0)
                {
                    ret = "success";
                }
                else if (s == 0)
                {
                    ret = "success01";
                }
            }
            return(ret);
        }
        public static string updpt(string schid, string id, string dptname, string pid, string stat)
        {
            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.SchDepartInfo   bll   = new SchSystem.BLL.SchDepartInfo();
                    SchSystem.Model.SchDepartInfo model = new SchSystem.Model.SchDepartInfo();
                    model.DepartId    = int.Parse(id);
                    model.Pid         = int.Parse(pid);
                    model.Stat        = int.Parse(stat);
                    model.DepartName  = Com.Public.SqlEncStr(dptname);
                    model.LastRecTime = DateTime.Now;
                    model.LastRecUser = Com.SoureSession.Soureuserid;
                    bll.Update(model);
                    ret = "success";
                }
                catch (Exception ex)
                {
                    ret = ex.Message;
                }
            }
            return(ret);
        }
        public static string updpt(string schid, string id, string dptname, string pid, string stat)
        {
            string ret = "";

            if (Com.Session.userid == null)
            {
                ret = "expire";
            }
            else
            {
                try
                {
                    SchSystem.BLL.SchDepartInfo   bll   = new SchSystem.BLL.SchDepartInfo();
                    SchSystem.Model.SchDepartInfo model = new SchSystem.Model.SchDepartInfo();
                    model.DepartId    = int.Parse(id);
                    model.Pid         = int.Parse(pid);
                    model.Stat        = int.Parse(stat);
                    model.DepartName  = Com.Public.SqlEncStr(dptname);
                    model.LastRecTime = DateTime.Now;
                    model.LastRecUser = Com.Session.userid;
                    bll.Update(model);
                    ret = "success";
                }
                catch (Exception ex)
                {
                    ret = ex.Message;
                }
            }
            return(ret);
        }
        public static string getdpt(string schid, string stat, string selfid, string selid)
        {
            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
            {
                schid  = Com.Public.SqlEncStr(schid);
                stat   = Com.Public.SqlEncStr(stat);
                selfid = Com.Public.SqlEncStr(selfid);
                selid  = Com.Public.SqlEncStr(selid);

                try
                {
                    if (selfid == "")
                    {
                        SchSystem.BLL.SchDepartInfo dptbll = new SchSystem.BLL.SchDepartInfo();
                        string sqlstr = "stat=1 and SchId=" + Com.Public.SqlEncStr(schid);
                        //if (stat != "")
                        //{
                        //    sqlstr += " and Stat=" + Com.Public.SqlEncStr(stat);
                        //}
                        DataTable dtdept = dptbll.GetList("Pid pId,DepartId id,DepartName name,'false' checked,stat,OrderId ", sqlstr + " Order by OrderId").Tables[0];
                        if (dtdept.Rows.Count == 0)
                        {
                            //给个默认根节点
                            //DataRow dr = dtdept.NewRow();
                            //dr["id"] = "0";
                            //dr["pId"] = DBNull.Value;
                            //dr["name"] = "顶级部门";
                            //dr["checked"] = "false";
                            //dtdept.Rows.Add(dr);
                        }
                        ret = Newtonsoft.Json.JsonConvert.SerializeObject(dtdept);
                    }
                    else if (selfid == "0")//添加时取全部节点的部门树
                    {
                        ret = Com.Public.GetDrp("dpt", schid, "1", true, "", selid);
                    }
                    else//修改时,取没有该节点下的所有子节点的树
                    {
                        ret = Com.Public.GetDrp("dpt", schid, "1", true, selfid, selid);
                    }
                }
                catch (Exception ex)
                {
                    ret = "";
                }
            }
            return(ret.Replace("全部", "顶级部门"));
        }
        public static string deldpt(string schid, string id)
        {
            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.SchDepartInfo bll = new SchSystem.BLL.SchDepartInfo();
                    //判断是否有正常的子部门和人员
                    if (bll.ExistsUser(int.Parse(id)))
                    {
                        ret += "该部门下还有人员,不允许删除!";
                    }
                    if (bll.ExistsPid(int.Parse(id)))
                    {
                        ret += "该部门下有子部门,不允许删除!";
                    }
                    if (ret == "")
                    {
                        SchSystem.Model.SchDepartInfo model = new SchSystem.Model.SchDepartInfo();
                        model.DepartId    = int.Parse(id);
                        model.LastRecTime = DateTime.Now;
                        model.LastRecUser = Com.SoureSession.Soureuserid;
                        model.Stat        = 2;
                        bll.UpdateStat(model);
                        ret = "success";
                    }
                }
                catch (Exception ex)
                {
                    ret = ex.Message;
                }
            }
            return(ret);
        }
        public static string deldpt(string schid, string id)
        {
            string ret = "";

            if (Com.Session.userid == null)
            {
                ret = "expire";
            }
            else
            {
                try
                {
                    SchSystem.BLL.SchDepartInfo bll = new SchSystem.BLL.SchDepartInfo();
                    //判断是否有正常的子部门和人员
                    if (bll.ExistsUser(int.Parse(id)))
                    {
                        ret += "该部门下还有人员,不允许删除!";
                    }
                    if (bll.ExistsPid(int.Parse(id)))
                    {
                        ret += "该部门下有子部门,不允许删除!";
                    }
                    if (ret == "")
                    {
                        SchSystem.Model.SchDepartInfo model = new SchSystem.Model.SchDepartInfo();
                        model.DepartId    = int.Parse(id);
                        model.LastRecTime = DateTime.Now;
                        model.LastRecUser = Com.Session.userid;
                        model.Stat        = 2;
                        bll.UpdateStat(model);
                        ret = "success";
                    }
                }
                catch (Exception ex)
                {
                    ret = ex.Message;
                }
            }
            return(ret);
        }
Пример #9
0
        public string depts   = "";//相应学校部门及个人部门,json

        //需要根据不同情况建立或修改的不同学校用户和不同类型的用户,本学校用户唯一,不需要全系统唯一
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //公钥
                publicKey = PublicProperty.PublicKey.Replace("\r\n", ",");
                //先得到操作类型
                dotype = Request.Params["dotype"].ToString();
                if (dotype == "e")//修改,不能修改用户的类型及学校参数
                {
                    //获取修改的对应用户的
                    uid = Request.Params["uid"].ToString();
                    SchSystem.BLL.SchUserInfo   userbll   = new SchSystem.BLL.SchUserInfo();
                    SchSystem.Model.SchUserInfo usermodel = userbll.GetModel(int.Parse(uid));
                    if (usermodel != null && usermodel.UserId > 0)
                    {
                        utname = usermodel.UserTname;
                        usex   = usermodel.Sex.ToString();
                        ups    = usermodel.Postion;
                        ujb    = usermodel.Title;
                        utl    = usermodel.Mobile.Trim();
                        uname  = usermodel.UserName.Trim();
                        if (usermodel.PassWord == Com.Public.StrToMD5("123456"))
                        {
                            upw     = "123456";
                            upwname = "初始密码:";
                        }
                        else if (usermodel.PassWord == "")
                        {
                            upw     = "";
                            upwname = "初始密码:";
                        }
                        else
                        {
                            upw     = "●●●●●●";
                            upwname = "用户密码:";
                        }
                        ustat = usermodel.AccStat.ToString();
                        uno   = "00000000".Substring(0, 8 - uid.Length) + uid;
                    }
                    else
                    {
                        Response.Write("无该用户!");
                        Response.End();
                    }
                }
                SchSystem.BLL.SchDepartInfo dptbll = new SchSystem.BLL.SchDepartInfo();
                DataTable dtdept = dptbll.GetList("Pid pId,DepartId id,DepartName name,'false' checked", "SchId=" + Com.Session.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=" + Com.Session.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);
            }
        }
Пример #10
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
            }
        }
        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);
                }
            }
        }
        //需要根据不同情况建立或修改的不同学校用户和不同类型的用户,本学校用户唯一,不需要全系统唯一
        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
            }
        }
        //需要根据不同情况建立或修改的不同学校用户和不同类型的用户,本学校用户唯一,不需要全系统唯一
        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
            }
        }
Пример #14
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());
        }
Пример #15
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
            }
        }
Пример #16
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);
                }
            }
        }
Пример #17
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);
            }
        }