/// <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()); }