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();
                }
            }
        }
示例#2
0
        //用户登录判断
        public static string UserLoginDo(string uname, bool iscookies, string schid)
        {
            string str = "";

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

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

            return(str);
        }