/// <summary> /// 通过学号判断是否是辅导员所带班级的学生 /// </summary> /// <returns></returns> private string ChkStuInfo() { Basic_stu_info info = StuHandleClass.getInstance().GetStuInfo_Obj(Get("stuno")); if (info == null) { return(string.Empty); } ComHandleClass chc = new ComHandleClass(); string strFClass = chc.ByFGetClassCode(user.User_Id); if (!strFClass.Contains(info.CLASS)) { return("录入的学号不是所带班级的学生,请确认!"); } return(string.Empty); }
/// <summary> /// 获取辅导员所带班级HTML /// </summary> /// <returns></returns> private string GetFdyClassData() { string strSQL = string.Format("SELECT CLASSCODE AS VALUE, CLASSNAME AS TEXT FROM BASIC_CLASS_INFO WHERE 1=1 "); string strWhere = string.Empty; string strOrder = " ORDER BY CLASSCODE ASC "; ComHandleClass chc = new ComHandleClass(); if (user.User_Role.Equals("S")) { strWhere += string.Format(" AND CLASSCODE = '{0}' ", chc.BySGetClassCode(user.User_Id)); } //用户角色是辅导员的,只能看到所带班级的数据 if (user.User_Role.Equals("F")) { string strFClass = chc.GetNoRepeatAndNoEmptyStringSql(chc.ByFGetClassCode(user.User_Id)); if (!string.IsNullOrEmpty(strFClass)) { strWhere += string.Format(" AND CLASSCODE IN ({0})", strFClass); } else { strWhere += string.Format(" AND 1=2 ", strFClass); } } strSQL = strSQL + strWhere + strOrder; DataTable dt = ds.ExecuteTxtDataTable(strSQL); StringBuilder sbHtml = new StringBuilder(); foreach (DataRow row in dt.Rows) { if (row == null) { continue; } sbHtml.Append("<div class=\"form-group col-sm-12\">"); sbHtml.Append("<div class=\"col-sm-8\">"); sbHtml.Append("<input name=\"fdy_class\" id=\"" + row["VALUE"].ToString() + "\" type=\"checkbox\" value=\"" + row["VALUE"].ToString() + "\" class=\"flat-red\"/> <label for=\"" + row["VALUE"].ToString() + "\">" + row["TEXT"].ToString() + "</label> "); sbHtml.Append("</div>"); sbHtml.Append("</div>"); } return(sbHtml.ToString()); }