public static IList <GradeClass> GetGradeClass(int academicYear, GradeCode gradeCode) { try { using (AppBLL bll = new AppBLL()) { var sql = "select a.SystemID, a.GradeNo, AcadEmicYear, ClassNo, ClassType, IsDelete,b.GradeName, b.GradeBriefName from tbGradeClass a, tdGradeCode b" + " where a.Gradeno=b.GradeNO" + " and a.GradeNO=@gradeCode" + " and a.AcadEmicYear=@micYear"; return(bll.FillListByText <GradeClass>(sql, new { micYear = academicYear, gradeCode = gradeCode.GradeNo })); } } catch (Exception ex) { throw ex; } }
/// <summary> /// 获取用户功能树(菜单) /// </summary> /// <returns></returns> public static FuncEntry GetUserFuncs(string teacher) { try { using (AppBLL bll = new AppBLL()) { //var sql = "select FuncId, FuncName, Description, FuncType, FuncID0 As Parent, SysNo, 1 as Kind from s_tb_FunctionNew where CAST(FuncID as Int) in "; //sql += " (SELECT cast(a.FuncID as Int) FROM tbGroupInfo b INNER JOIN tbUserGroupInfo c ON b.TeacherID = c.TeacherID INNER JOIN s_tb_Rights a ON b.GroupID = a.TeacherID "; //sql += " where c.TeacherID=@teacher and a.SYSNO = 2) "; //sql += " union all "; //sql += " select FuncId, FuncName, Description, FuncType, FuncID0 As Parent, SysNo, 2 as Kind from s_tb_FunctionNew where CAST(FuncID as Int) in"; //sql += " (SELECT cast(a.FuncId as Int) from s_tb_Rights a, tbUserGroupInfo b "; //sql += " where a.TeacherID=@teacher and a.TeacherID=b.TeacherID and SYSNO = 2)"; var sql = "select FuncId, FuncName, Description, FuncType, FuncID0 As Parent, SysNo, 2 as Kind" + " from s_tb_FunctionNew " + " where CAST(FuncID as Int) in (" + " SELECT cast(a.FuncId as Int) from s_tb_Rights a, tbUserGroupInfo b " + " where a.TeacherID=@teacher and a.TeacherID=b.TeacherID and SYSNO = 2)"; //sql += " union all select FuncId, FuncName, Description, FuncType, FuncID0 As Parent, SysNo, 2 as Kind " + // " from s_tb_FunctionNew where FuncID in (1701, 1707,1801,1809)"; IList <FuncEntry> funcs = bll.FillListByText <FuncEntry>(sql, new { teacher = teacher }); var roots = from v in funcs where v.Parent == -1 select v; if (!roots.Any()) { return(null); } FuncEntry root = roots.First(); BuildFuncTree(root, funcs); return(root); } } catch (Exception ex) { throw ex; } }
/// <summary> /// 获取功能树(菜单) /// </summary> /// <returns></returns> public static FuncEntry GetFunc() { try { using (AppBLL bll = new AppBLL()) { var sql = "Select FuncId, FuncName, Description, FuncType, FuncID0 As Parent, SysNo from s_tb_FunctionNew order by FuncID"; IList <FuncEntry> funcs = bll.FillListByText <FuncEntry>(sql, null); var roots = from v in funcs where v.Parent == -1 select v; if (!roots.Any()) { return(null); } FuncEntry root = roots.First(); BuildFuncTree(root, funcs); return(root); } } catch (Exception ex) { throw ex; } }