protected void Page_Load(object sender, EventArgs e) { if (Com.Session.schid == null) { Response.Redirect("Login.aspx", false); return; } UploadHeadPic = Com.Public.getKey("adminurl") + "/UploadFile.aspx?schid=" + Com.Session.schid + "&userid=" + Com.Session.usertid + "&schtype=1"; //schtype:值为0代表普通老师后台,1代表学校管理员后台 string thstr = ""; //是否有第三方菜单权限 if (Com.Session.systype == "0") { systype = Com.Session.systype; utitlename = "智慧校园平台"; indexpage = "jsywebindex.html"; } SysListBind(thstr); usertname = Com.Session.uname; username = Com.Session.userid; if (!string.IsNullOrEmpty(Com.Session.imgurl)) { imgurl = Com.Public.getKey("adminurl") + "\\" + Com.Session.imgurl; } //获取学校基本数据 SchSystem.BLL.SchInfo siBll = new SchSystem.BLL.SchInfo(); DataTable dtschinfo = siBll.GetList("SchMaster,PlatformName,PlatformIco", "SchId='" + Com.Session.schid + "'").Tables[0]; if (dtschinfo.Rows.Count > 0) { //SchMasterstr = dtschinfo.Rows[0]["SchMaster"].ToString(); if (Com.Session.systype != "0") { PlatformName = dtschinfo.Rows[0]["PlatformName"].ToString() + "管理后台<span style=\"font-size:75%;font-weight:normal;\">【" + Com.Session.schid + "】</span>"; } else { PlatformName = dtschinfo.Rows[0]["PlatformName"].ToString(); } PlatformIco = Com.Public.getKey("adminurl") + dtschinfo.Rows[0]["PlatformIco"].ToString(); } if (PlatformName == "管理后台") { PlatformName = utitlename; } if (PlatformIco == "") { PlatformIco = "<i class=\"icon-leaf\"></i>"; } else { PlatformIco = "<img style='width:20px;' src='" + PlatformIco + "' />"; } }
public static string GetDrpAreaStu(string TypeCode, string pAreaCode, ref string sAreaCode, bool addall) { DataTable dt = new DataTable(); StringBuilder sb = new StringBuilder(); SchSystem.BLL.SysArea bll = new SchSystem.BLL.SysArea(); SchSystem.BLL.SchInfo bllsch = new SchSystem.BLL.SchInfo(); SchSystem.BLL.SchGradeInfo bllgrade = new SchSystem.BLL.SchGradeInfo(); SchSystem.BLL.SchClassInfo bllclass = new SchSystem.BLL.SchClassInfo(); string sqlstr = ""; if (TypeCode == "0")//取省份 { sqlstr = ""; } else if (TypeCode == "1" && pAreaCode != "")//取城市 { if (pAreaCode.Length == 6) { sqlstr = " and left(AreaCode,2)='" + pAreaCode.Substring(0, 2) + "'"; } else { sqlstr = " and AreaCode='" + Com.Public.SqlEncStr(pAreaCode) + "'"; } } else if (TypeCode == "2" && pAreaCode != "")//取区县 { if (pAreaCode.Length == 6) { sqlstr = " and left(AreaCode,4)='" + pAreaCode.Substring(0, 4) + "'"; } else { sqlstr = " and AreaCode='" + Com.Public.SqlEncStr(pAreaCode) + "'"; } } if (addall) { sb.Append("<option value=\"-1\" selected=\"selected\">全部</option>"); } if (TypeCode == "0" || TypeCode == "1" || TypeCode == "2") { //dt = bll.GetList("AreaCode ID,AreaName Name", "Stat=1 and TypeCode='" + TypeCode + "' " + sqlstr + " Order by AreaName").Tables[0]; dt = bll.GetList("AreaCode ID,AreaName Name", "TypeCode='" + Com.Public.SqlEncStr(TypeCode) + "' " + sqlstr + " Order by AreaName").Tables[0]; //获取全部省份 } else if (TypeCode == "3") //学校 { dt = bllsch.GetList("SchId ID,SchName Name", "Stat=1 and AreaNo='" + Com.Public.SqlEncStr(pAreaCode) + "' Order by SchName").Tables[0]; } else if (TypeCode == "4")//年级 { //普通老师 if (Com.Session.systype == "0") { if (Com.Public.IsUserVal(Com.Session.userrolestr, 2))//有查询权限,则全校 { dt = bllgrade.GetList("GradeId ID ,GradeName Name", "IsFinish=0 and SchId='" + Com.Public.SqlEncStr(pAreaCode) + "' Order by GradeCode").Tables[0]; } else { dt = bllgrade.GetList("GradeId ID ,GradeName Name", "IsFinish=0 and SchId='" + Com.Public.SqlEncStr(pAreaCode) + "' and (GradeId in (select GradeId FROM SchGradeUsers where UserName="******") or GradeId in (select GradeId FROM SchClassUserV where UserName="******")) Order by GradeCode").Tables[0]; } } else//学校超管 { dt = bllgrade.GetList("GradeId ID ,GradeName Name", "IsFinish=0 and SchId='" + Com.Public.SqlEncStr(pAreaCode) + "' Order by GradeCode").Tables[0]; } } else if (TypeCode == "5")//班级 { if (pAreaCode == "") { pAreaCode = "0"; } //普通老师 if (Com.Session.systype == "0") { if (Com.Public.IsUserVal(Com.Session.userrolestr, 2))//有查询权限,则全校 { dt = bllclass.GetList("ClassId ID, ClassName Name", "IsFinish=0 and GradeId='" + Com.Public.SqlEncStr(pAreaCode) + "' Order by ClassName").Tables[0]; } else { dt = bllclass.GetList("ClassId ID, ClassName Name", "IsFinish=0 and GradeId='" + Com.Public.SqlEncStr(pAreaCode) + "' and (GradeId in (select GradeId FROM SchGradeUsers where UserName="******") or ClassId in (select ClassId FROM SchClassUserV where UserName="******")) Order by ClassName").Tables[0]; } } else//学校超管 { dt = bllclass.GetList("ClassId ID, ClassName Name", "IsFinish=0 and GradeId='" + Com.Public.SqlEncStr(pAreaCode) + "' Order by ClassName").Tables[0]; } } if (dt.Rows.Count > 0) { if (sAreaCode == "")//输出第一个节点 { sAreaCode = dt.Rows[0]["ID"].ToString(); } for (int i = 0; i < dt.Rows.Count; i++) { if (sAreaCode == "" && i == 0) { sb.Append("<option value=\"" + dt.Rows[i]["ID"].ToString() + "\" selected=\"selected\">" + dt.Rows[i]["Name"].ToString() + "</option>"); } else { // selected="selected" if (dt.Rows[i]["ID"].ToString() == sAreaCode) { sb.Append("<option value=\"" + dt.Rows[i]["ID"].ToString() + "\">" + dt.Rows[i]["Name"].ToString() + "</option>"); } else { sb.Append("<option value=\"" + dt.Rows[i]["ID"].ToString() + "\">" + dt.Rows[i]["Name"].ToString() + "</option>"); } } } } return(sb.ToString()); }
/// <summary> /// /// </summary> /// <param name="TypeCode"></param> /// <param name="pAreaCode"></param> /// <param name="sAreaCode"></param> /// <param name="addall"></param> /// <param name="listoredit">區分是否為列表頁面和編輯頁面(1代表列表頁面;0代表編輯頁面)</param> /// <returns></returns> public static string GetDrpArea(string TypeCode, string pAreaCode, ref string sAreaCode, bool addall, string listoredit = "1") { DataTable dt = new DataTable(); StringBuilder sb = new StringBuilder(); SchSystem.BLL.SysArea bll = new SchSystem.BLL.SysArea(); SchSystem.BLL.SchInfo bllsch = new SchSystem.BLL.SchInfo(); SchSystem.BLL.SchGradeInfo bllgrade = new SchSystem.BLL.SchGradeInfo(); SchSystem.BLL.SchClassInfo bllclass = new SchSystem.BLL.SchClassInfo(); string sqlstr = ""; if (TypeCode == "0")//取省份 { sqlstr = ""; } else if (TypeCode == "1")//取城市 { if (pAreaCode.Length == 6) { sqlstr = " and left(AreaCode,2)='" + pAreaCode.Substring(0, 2) + "'"; } else { sqlstr = " and AreaCode='" + pAreaCode + "'"; } } else if (TypeCode == "2")//取区县 { if (pAreaCode.Length == 6) { sqlstr = " and left(AreaCode,4)='" + pAreaCode.Substring(0, 4) + "'"; } else { sqlstr = " and AreaCode='" + pAreaCode + "'"; } } if (addall) { sb.Append("<option value=\"\" selected=\"selected\">全部</option>"); } if (TypeCode == "0" || TypeCode == "1" || TypeCode == "2") { //dt = bll.GetList("AreaCode ID,AreaName Name", "Stat=1 and TypeCode='" + TypeCode + "' " + sqlstr + " Order by AreaName").Tables[0]; dt = bll.GetList("AreaCode ID,AreaName Name", "TypeCode='" + TypeCode + "' " + sqlstr + " Order by AreaName").Tables[0]; //获取全部省份 } else if (TypeCode == "3") //学校 { dt = bllsch.GetList("SchId ID,SchName Name", "Stat=1 and AreaNo='" + pAreaCode + "' Order by SchName").Tables[0]; } else if (TypeCode == "4")//年级 { schids = pAreaCode; dt = bllgrade.GetList("GradeId ID ,GradeName Name", "IsFinish=0 and SchId='" + pAreaCode + "' Order by GradeCode").Tables[0]; } else if (TypeCode == "5")//班级 { string strWhere = ""; if (Com.Session.systype != "2") { strWhere += " and schid ='" + Com.Session.schid + "'"; } else { strWhere += " and schid ='" + schids + "'"; } dt = bllclass.GetList("ClassId ID, ClassName Name", "IsFinish=0 and GradeId='" + pAreaCode + "'" + strWhere + " Order by ClassName").Tables[0]; } if (dt.Rows.Count > 0) { if (addall && listoredit == "1") { sAreaCode = ""; } else { if (string.IsNullOrEmpty(sAreaCode)) { sAreaCode = dt.Rows[0]["ID"].ToString(); } } for (int i = 0; i < dt.Rows.Count; i++) { //if (sAreaCode == "" && i == 0) //{ // sb.Append("<option value=\"" + dt.Rows[i]["ID"].ToString() + "\" selected=\"selected\">" + dt.Rows[i]["Name"].ToString() + "</option>"); //} //else //{ // selected="selected" if (dt.Rows[i]["ID"].ToString() == sAreaCode) { sb.Append("<option value=\"" + dt.Rows[i]["ID"].ToString() + "\" selected=\"selected\">" + dt.Rows[i]["Name"].ToString() + "</option>"); } else { sb.Append("<option value=\"" + dt.Rows[i]["ID"].ToString() + "\">" + dt.Rows[i]["Name"].ToString() + "</option>"); } //} } } return(sb.ToString()); }
//获取学校系统管理或者普通应用菜单列表 public static DataTable SchMenuData(string cols, string thstr, string schid, string systype) { if (schid == "") { schid = Com.Session.schid; } //查询学校的子系统、资源服务模块状态 SchSystem.BLL.SchInfo siBll = new SchSystem.BLL.SchInfo(); DataTable dtschinfo = siBll.GetList("SonSysStat,SourceSerStat,HomeschServStat", "SchId='" + schid + "'").Tables[0]; string SonSysStat = dtschinfo.Rows[0]["SonSysStat"].ToString(); string SourceSerStat = dtschinfo.Rows[0]["SourceSerStat"].ToString(); string SourceXXTStat = dtschinfo.Rows[0]["HomeschServStat"].ToString(); DataTable dt = new DataTable(); SchSystem.BLL.SchAppRole schapprolebll = new SchSystem.BLL.SchAppRole(); string appstr = schapprolebll.GetAppStr(int.Parse(schid)); if (appstr != "") { appstr = " AppCode in (" + appstr + ")"; } //0普通前台通用菜单,1学校管理后台菜单 if (systype == "0") { string sqlstr = ""; //获取正常的 if (appstr == "") { sqlstr = " Stat=1 and (AppCode=1 or AppCode=2 " + thstr + ")"; } else { sqlstr = " Stat=1 and (AppCode=1 or AppCode=2 or " + appstr + " " + thstr + ")"; } //获取菜单表 SchSystem.BLL.SchMenuInfoUser menuuserbll = new SchSystem.BLL.SchMenuInfoUser(); dt = menuuserbll.GetList(cols, sqlstr + " order by OrderId ").Tables[0]; if (dt.Rows.Count > 0) { DataRow row = dt.NewRow(); row["id"] = 1; row["pId"] = 0; row["name"] = "首页"; dt.Rows.InsertAt(row, 0); } } else if (systype == "1") { string sqlstr = ""; //获取正常的 if (appstr == "") { sqlstr = " Stat=1 and (AppCode=0 or AppCode=1 or AppCode=2 " + thstr + ") "; } else { sqlstr = " Stat=1 and (AppCode=0 or AppCode=1 or AppCode=2 or " + appstr + "" + thstr + ") "; } if (SonSysStat == "0" || SonSysStat == "") //子系统状态为0时,不显示管理平台菜单 { sqlstr += " and FuncCode<>22 and Pid<> (select MenuId from SchMenuInfoAdmin where FuncCode=22) "; //id是MenuId的别名 } if (SourceSerStat == "0" || SourceSerStat == "") //资源服务状态为0时,不显示资源平台菜单 { sqlstr += " and FuncCode<>23 and Pid<> (select MenuId from SchMenuInfoAdmin where FuncCode=23) "; } if (SourceXXTStat == "0" || SourceXXTStat == "")//家校互通服务状态为0时,不显示资源平台菜单 { sqlstr += " and FuncCode<>29 and Pid<> (select MenuId from SchMenuInfoAdmin where FuncCode=29) "; } SchSystem.BLL.SchMenuInfoAdmin menuuserbll = new SchSystem.BLL.SchMenuInfoAdmin(); dt = menuuserbll.GetList(cols, sqlstr + " order by OrderId").Tables[0]; //if (SonSysStat == "0" || SonSysStat == "")//子系统状态为0时,不显示管理平台菜单 //{ // DataRow[] dr = dt.Select("FuncCode=22");//通过FuncCode查找管理平台MenuId // int Manageid = int.Parse(dr[0]["id"].ToString());//id是MenuId的别称 // dt = DataRowToDataTable(dt, "FuncCode<>22 and pId<>" + Manageid);//查找出不属于管理平台的菜单项,并转换为DataTable //} //if (SourceSerStat == "0" || SourceSerStat == "")//资源服务状态为0时,不显示资源平台菜单 //{ // DataRow[] dr = dt.Select("FuncCode=23");//通过FuncCode查找资源平台MenuId // int Sourceid = int.Parse(dr[0]["id"].ToString());//id是MenuId的别称 // dt = DataRowToDataTable(dt, "FuncCode<>23 and pId<>" + Sourceid);//查找出不属于资源平台的菜单项,并转换为DataTable //} //if (SourceXXTStat == "0" || SourceXXTStat == "")//家校互通服务状态为0时,不显示资源平台菜单 //{ // DataRow[] dr = dt.Select("FuncCode=29");//通过FuncCode查找家校互通平台MenuId // int XXTid = int.Parse(dr[0]["id"].ToString());//id是MenuId的别称 // dt = DataRowToDataTable(dt, "FuncCode<>29 and pId<>" + XXTid);//查找出不属于家校互通平台的菜单项,并转换为DataTable //} } else { //获取子系统 if (appstr != "") { string sqlstr = "Stat=1 and (" + appstr + ")"; SchSystem.BLL.SchApp schappbll = new SchSystem.BLL.SchApp(); dt = schappbll.GetList(cols, sqlstr).Tables[0]; } } return(dt); }