protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataTable dt = new DataTable(); dotype = Request.Params["dotype"].ToString(); gradecodestr = Request.Params["gradecode"].ToString(); classidstr = Request.Params["classid"].ToString(); #region 编辑绑定查询 if (dotype == "e") { Stubh = Request.Params["Stubh"].ToString(); stuid = Request.Params["id"].ToString(); string sql = "select * from SchStuInfoV where StuId='" + stuid + "' ";//根据学生ID查询出学校,年级,班级等信息 dt = DbHelperSQL.Query(sql).Tables[0]; //18 //string oldclassname = dt.Rows[0][18].ToString(); DataRow[] dr = dt.Select(); if (classidstr == "") { classidstr = dr[0]["ClassId"].ToString(); } string oldclassname = dr[0]["OldClassId"].ToString(); if (!string.IsNullOrEmpty(oldclassname) || oldclassname != "") { oldClassName = oldclassname; } else { oldClassName = ""; } /*if (!string.IsNullOrEmpty(oldclassid) || oldclassid != "") * { * SchSystem.BLL.SchClassInfo sciBll = new SchSystem.BLL.SchClassInfo(); * oldClassName = sciBll.GetClassNames("ClassId in (" + oldclassid + ")"); * } * else * { * oldClassName = ""; * }*/ if (dt.Rows.Count > 0) { classinfo = Newtonsoft.Json.JsonConvert.SerializeObject(dt); } else { classinfo = "0"; } SchSystem.BLL.SchStuInfo bll_stu = new SchSystem.BLL.SchStuInfo(); string strWhere = " a.StuId=" + stuid; DataSet ds = bll_stu.GetList(strWhere);//修改绑定需要的数据 ds.Tables[0].Columns.Add("ClassId"); ds.Tables[0].Columns.Add("jzGenName2"); ds.Tables[0].Columns.Add("jzLoginName2"); ds.Tables[0].Columns.Add("jzTelNo2"); ds.Tables[0].Columns.Add("jzPwd2"); ds.Tables[0].Columns.Add("jzStat2"); ds.Tables[0].Columns.Add("jzRelation2"); ds.Tables[0].Columns.Add("jzGenId2"); ds.Tables[0].Columns.Add("jzUnId2"); if (ds.Tables[0].Rows.Count != 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { for (int j = i + 1; j < ds.Tables[0].Rows.Count; j++) { if (ds.Tables[0].Rows[i]["StuId"].ToString() == ds.Tables[0].Rows[j]["StuId"].ToString()) { ds.Tables[0].Rows[i]["jzGenName2"] = ds.Tables[0].Rows[j]["jzGenName1"].ToString(); ds.Tables[0].Rows[i]["jzLoginName2"] = ds.Tables[0].Rows[j]["jzLoginName1"].ToString(); ds.Tables[0].Rows[i]["jzTelNo2"] = ds.Tables[0].Rows[j]["jzTelNo1"].ToString(); ds.Tables[0].Rows[i]["jzPwd2"] = ds.Tables[0].Rows[j]["jzPwd1"].ToString(); ds.Tables[0].Rows[i]["jzStat2"] = ds.Tables[0].Rows[j]["jzStat1"].ToString(); ds.Tables[0].Rows[i]["jzRelation2"] = ds.Tables[0].Rows[j]["jzRelation1"].ToString(); ds.Tables[0].Rows[i]["jzGenId2"] = ds.Tables[0].Rows[j]["jzGenId1"].ToString(); ds.Tables[0].Rows[i]["jzUnId2"] = ds.Tables[0].Rows[j]["jzUnId1"].ToString(); ds.Tables[0].Rows.RemoveAt(j); } } } } umodelstr = dttojson.DatSetToJSON2(ds); } #endregion #region 缺省值:年級領導、班主任和任課教師 SchSystem.BLL.SchGradeUsers sgiBll = new SchSystem.BLL.SchGradeUsers(); SchSystem.BLL.SchClassUser scuBll = new SchSystem.BLL.SchClassUser(); DataTable dtgradeuser = sgiBll.GetList("*", "GradeId='" + gradecodestr + "'").Tables[0]; if (dtgradeuser.Rows.Count > 0) { StringBuilder sbgradeuser = new StringBuilder(); foreach (DataRow dr in dtgradeuser.Rows) { sbgradeuser.Append(dr["UserTname"].ToString() + ","); } if (sbgradeuser.ToString().Length > 0) { njld = sbgradeuser.ToString().Substring(0, sbgradeuser.ToString().Length - 1);//年級領導 } } DataTable dtclassuser = scuBll.GetList("*", "ClassId='" + classidstr + "'").Tables[0]; if (dtclassuser.Rows.Count > 0) { StringBuilder sbgradeuser01 = new StringBuilder(); StringBuilder sbgradeuser02 = new StringBuilder(); foreach (DataRow dr in dtclassuser.Rows) { if (dr["IsMs"].ToString() == "1") { sbgradeuser01.Append(dr["UserTname"].ToString() + ","); } else { sbgradeuser02.Append(dr["UserTname"].ToString() + ","); } } if (sbgradeuser01.ToString().Length > 0) { bzr = sbgradeuser01.ToString().Substring(0, sbgradeuser01.ToString().Length - 1);//班主任 } if (sbgradeuser02.ToString().Length > 0) { bjjs = sbgradeuser02.ToString().Substring(0, sbgradeuser02.ToString().Length - 1);//任課教師 } } #endregion StringBuilder sbarea = new StringBuilder(); //普通老师登录 if (Com.SoureSession.Souresystype == "0") { string gradeid = ""; if (dotype == "e" && dt.Rows[0]["AreaNo"].ToString().Length == 6) { gradeid = dt.Rows[0]["GradeId"].ToString(); } else { gradeid = gradecodestr; } sbarea.Append("<br/><label class=\"biaoti\">年级:</label><select id=\"nj\" style=\"width:100px\">"); sbarea.Append(Com.Public.GetGradeSelect("1", int.Parse(classidstr), ref gradeid, Com.SoureSession.Soureschid)); sbarea.Append("</select>"); string classid = ""; if (dotype == "e" && dt.Rows[0]["AreaNo"].ToString().Length == 6) { classid = dt.Rows[0]["ClassId"].ToString(); } sbarea.Append("<span id=\"njld\" style=\"color: #808080 \">年级领导:" + njld + "</span><br/><br/>"); sbarea.Append("<label class=\"biaoti\">班级:</label><select id=\"bj\" style=\"width:100px\" >"); sbarea.Append(Com.Public.GetGradeSelect("2", int.Parse(classidstr), ref classid, gradeid)); sbarea.Append("</select>"); sbarea.Append("<span id=\"bzr\" style=\"color: #808080 \">班主任:"+ bzr + "</span> "); sbarea.Append("<span id=\"bjjs\" style=\"color: #808080 \">任课老师:" + bjjs + "</span><br/><br/>"); areastr = sbarea.ToString(); } else if (Com.SoureSession.Souresystype == "1") { //获取年级 sbarea.Append("<br/> 年级:<select id=\"nj\" style=\"width:100px\">"); string schcode = ""; if (dotype == "e" && dt.Rows[0]["AreaNo"].ToString().Length == 6) { schcode = dt.Rows[0]["GradeId"].ToString(); } sbarea.Append(Com.Public.GetDrpArea("4", Com.SoureSession.Soureschid, ref schcode, false)); sbarea.Append("</select> "); sbarea.Append("<span id=\"njld\" style=\"color: #808080 \">年级领导:" + njld + "</span><br/><br/>"); //获取班级 sbarea.Append(" 班级:<select id=\"bj\" style=\"width:100px\" >"); string Classcode = ""; if (dotype == "e" && dt.Rows[0]["AreaNo"].ToString().Length == 6) { Classcode = dt.Rows[0]["ClassId"].ToString(); } sbarea.Append(Com.Public.GetDrpArea("5", schcode, ref Classcode, false)); sbarea.Append("</select> "); sbarea.Append("<span id=\"bzr\" style=\"color: #808080 \">班主任:"+ bzr + "</span> "); sbarea.Append("<span id=\"bjjs\" style=\"color: #808080 \">任课老师:" + bjjs + "</span><br/><br/>"); string s = getnj("1", schcode, schid, Classcode); areastr = sbarea.ToString(); } else//超管还要加学校下拉,后面需要更改 { //第一次加载,获取省市区,获取第一个省份下的所有学校 //StringBuilder sbarea = new StringBuilder(); //获取省份 sbarea.Append("省:<select id=\"aprov\">"); string sareacode = ""; if (dotype == "e" && dt.Rows[0]["AreaNo"].ToString().Length == 6) { sareacode = dt.Rows[0]["AreaNo"].ToString().Substring(0, 2) + "0000"; } sbarea.Append(Com.Public.GetDrpArea("0", "", ref sareacode, false)); sbarea.Append("</select>"); //获取城市 sbarea.Append("市:<select id=\"acity\">"); string sareacitycode = ""; if (dotype == "e" && dt.Rows[0]["AreaNo"].ToString().Length == 6) { sareacitycode = dt.Rows[0]["AreaNo"].ToString().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 (dotype == "e" && dt.Rows[0]["AreaNo"].ToString().Length == 6) { sareacotycode = dt.Rows[0]["AreaNo"].ToString(); } sbarea.Append(Com.Public.GetDrpArea("2", sareacitycode, ref sareacotycode, false)); sbarea.Append("</select>"); //获取学校 sbarea.Append("学校:<select id=\"asch\">"); string sareaschid = ""; if (dotype == "e" && dt.Rows[0]["AreaNo"].ToString().Length == 6) { sareaschid = dt.Rows[0]["SchId"].ToString(); } sbarea.Append(Com.Public.GetDrpArea("3", sareacotycode, ref sareaschid, false)); sbarea.Append("</select><br/> "); //获取年级 sbarea.Append("<br/> 年级:<select id=\"nj\" style=\"width:100px\">"); string schcode = ""; if (dotype == "e" && dt.Rows[0]["AreaNo"].ToString().Length == 6) { schcode = dt.Rows[0]["GradeId"].ToString(); } sbarea.Append(Com.Public.GetDrpArea("4", sareaschid, ref schcode, false)); sbarea.Append("</select> "); sbarea.Append("<span id=\"njld\" style=\"color:#808080 \">年级领导:"+ njld + "</span><br/><br/>"); //获取班级 sbarea.Append(" 班级:<select id=\"bj\" style=\"width:100px\" >"); string Classcode = ""; if (dotype == "e" && dt.Rows[0]["AreaNo"].ToString().Length == 6) { Classcode = dt.Rows[0]["ClassId"].ToString(); } sbarea.Append(Com.Public.GetDrpArea("5", schcode, ref Classcode, false)); sbarea.Append("</select> "); sbarea.Append("<span id=\"bzr\" style=\"color: #808080 \">班主任:"+ bzr + "</span> "); sbarea.Append("<span id=\"bjjs\" style=\"color:#808080 \">任课老师:" + bjjs + "</span><br/><br/>"); string s = getnj("1", schcode, sareaschid, Classcode); areastr = sbarea.ToString(); } } }
//需要根据不同情况建立或修改的不同学校用户和不同类型的用户,本学校用户唯一,不需要全系统唯一 protected void Page_Load(object sender, EventArgs e) { //if (true)//如果没对应权限,及判断用户类型是否跨界,主要防止非法篡改数据出现 //{ // Response.Write("无对应权限"); // Response.End(); //} if (!IsPostBack) { //先得到操作类型 dotype = Com.Public.SqlEncStr(Request.Params["dotype"].ToString()); schid = Com.Public.SqlEncStr(Request.Params["schid"].ToString()); gradecode = Com.Public.SqlEncStr(Request.Params["gradecode"].ToString()); if (string.IsNullOrEmpty(schid) || string.IsNullOrEmpty(gradecode))//如果没有对应参数中任意一个 { Response.Write("参数错误!"); Response.End(); } if (dotype == "a") { } else if (dotype == "e")//修改,不能修改用户的类型及学校参数 { btnname = "修改"; classid = Com.Public.SqlEncStr(Request.Params["classid"].ToString()); if (string.IsNullOrEmpty(classid)) { Response.Write("无对应修改的记录!"); Response.End(); } //获取修改的对应用户的 SchSystem.BLL.SchClassInfo sgibll = new SchSystem.BLL.SchClassInfo(); SchSystem.Model.SchClassInfo sgimodel = sgibll.GetModel(int.Parse(classid)); if (sgimodel != null && sgimodel.ClassId > 0) { umodelstr = Newtonsoft.Json.JsonConvert.SerializeObject(sgimodel); } else { Response.Write("无该记录!"); Response.End(); } } else//不在添加及修改之内,则返回 { Response.Write("没有可供确认的操作类型!"); Response.End(); } /*//判断跨界操作的可能性 * if (!Com.Public.isVa(schid, systype)) * { * Response.Write("出错,用户非法跨界操作!"); * Response.End(); * }*/ #region 获取部门人员列表 SchSystem.BLL.SchInfo schbll = new SchSystem.BLL.SchInfo(); schname = schbll.GetSchName(int.Parse(schid)); //获取年级领导 SchSystem.BLL.SchGradeUsers usergradebll = new SchSystem.BLL.SchGradeUsers(); gradeboss = usergradebll.GetNames("GradeId in ( select GradeId from SchGradeInfo where GradeCode=" + Com.Public.SqlEncStr(gradecode) + " and schid=" + schid + ")"); gradesdrp = Com.Public.GetDrp("grade", schid, "0", false, "", ""); SchSystem.BLL.SchDepartInfo sdiBll = new SchSystem.BLL.SchDepartInfo(); //获取部门列表 DataTable dtdpt = sdiBll.GetList("Pid pId,convert(varchar(20),DepartId) id,DepartName name,'false' checked,'true' nochecks,'0' isms,'' subcode", "SchId=" + Com.Public.SqlEncStr(schid) + " and Stat=1 Order by OrderId").Tables[0]; dtdpt.Columns["nochecks"].ColumnName = "nocheck"; DataTable dtdptuser = dtdpt.Clone(); StringBuilder sb = new StringBuilder(); if (dtdpt.Rows.Count > 0) { SchSystem.BLL.SchClassUser userclassbll = new SchSystem.BLL.SchClassUser(); DataTable dtclassuser = userclassbll.GetList("UserName,SubCode,IsMs", "ClassId=" + Com.Public.SqlEncStr(classid)).Tables[0]; //获取该学校的所有人员 SchSystem.BLL.SchUserDeptV userbll = new SchSystem.BLL.SchUserDeptV(); DataTable dtuser = userbll.GetList("DeptId ,UserName,UserTname", "Stat=1 and Ustat=1 and SchId=" + Com.Public.SqlEncStr(schid)).Tables[0]; //合并人员到部门表 for (int i = 0; i < dtdpt.Rows.Count; i++) { dtdptuser.Rows.Add(dtdpt.Rows[i].ItemArray); //获取该部门下的人员 DataRow[] drs = dtuser.Select("DeptId='" + dtdpt.Rows[i]["id"].ToString() + "'"); if (drs.Length > 0) { foreach (DataRow item in drs) { DataRow dr = dtdptuser.NewRow(); dr["id"] = "u_" + item["UserName"].ToString(); dr["name"] = item["UserTname"].ToString(); dr["pId"] = item["DeptId"].ToString(); //如果是被绑定了,则勾选 DataRow[] drsclassuser = dtclassuser.Select("UserName='******'"); if (drsclassuser.Length > 0) { dr["isms"] = drsclassuser[0]["IsMs"].ToString(); dr["subcode"] = drsclassuser[0]["SubCode"].ToString(); dr["checked"] = "true"; } dtdptuser.Rows.Add(dr); } } } } SchSystem.BLL.SchUserInfo sui = new SchSystem.BLL.SchUserInfo(); DataTable dtsui = sui.GetList("*", "Stat=1 and SchId=" + Com.Public.SqlEncStr(schid)).Tables[0]; DataRow[] drsui = dtsui.Select(); foreach (DataRow item in drsui) { sb.Append("<option value=\"u_" + item["UserName"].ToString() + "\">" + item["UserTname"].ToString() + "</option>"); } tec = sb.ToString(); depts = Newtonsoft.Json.JsonConvert.SerializeObject(dtdptuser); subsdrp = Com.Public.GetDrp("sub", schid, "1", false, "", ""); #endregion #region 获取部门人员列表 /*SchSystem.BLL.SchInfo schbll = new SchSystem.BLL.SchInfo(); * schname = schbll.GetSchName(int.Parse(schid)); * //获取年级领导 * SchSystem.BLL.SchGradeUsers usergradebll = new SchSystem.BLL.SchGradeUsers(); * gradeboss = usergradebll.GetNames("GradeId in ( select GradeId from SchGradeInfo where GradeCode=" + Com.Public.SqlEncStr(gradecode) + " and schid=" + schid + ")"); * gradesdrp = Com.Public.GetDrp("grade", schid, "0", false, "", ""); * SchSystem.BLL.SchDepartInfo sdiBll = new SchSystem.BLL.SchDepartInfo(); * //获取部门列表 * DataTable dtdpt = sdiBll.GetList("Pid pId,convert(varchar(20),DepartId) id,DepartName name,'false' checked,'false' checked,'true' nochecks,'0' isms,'' subcode", "SchId=" + Com.Public.SqlEncStr(schid) + " and Stat=1 Order by OrderId").Tables[0]; * dtdpt.Columns["nochecks"].ColumnName = "nocheck"; * DataTable dtdptuser = dtdpt.Clone(); * StringBuilder sb = new StringBuilder(); * if (dtdpt.Rows.Count > 0) * { * SchSystem.BLL.SchClassUser userclassbll = new SchSystem.BLL.SchClassUser(); * DataTable dtclassuser = userclassbll.GetList("UserName,SubCode,IsMs", "ClassId=" + Com.Public.SqlEncStr(classid)).Tables[0]; * //获取该学校的所有人员 * SchSystem.BLL.SchUserDeptV userbll = new SchSystem.BLL.SchUserDeptV(); * DataTable dtuser = userbll.GetList("DeptId ,UserName,UserTname", "Stat=1 and Ustat=1 and SchId=" + Com.Public.SqlEncStr(schid)).Tables[0]; * //合并人员到部门表 * int z = 0; * for (int i = 0; i < dtdpt.Rows.Count; i++) * { * * dtdptuser.Rows.Add(dtdpt.Rows[i].ItemArray); * //获取该部门下的人员 * DataRow[] drs = dtuser.Select("DeptId='" + dtdpt.Rows[i]["id"].ToString() + "'"); * if (drs.Length > 0) * { * foreach (DataRow item in drs) * { * sb.Append("<option value=\"u_"+z+"_" + item["UserName"].ToString() + "\">" + item["UserTname"].ToString() + "</option>"); * DataRow dr = dtdptuser.NewRow(); * dr["id"] = "u_" + z + "_" + item["UserName"].ToString(); * dr["name"] = item["UserTname"].ToString(); * dr["pId"] = item["DeptId"].ToString(); * //如果是被绑定了,则勾选 * DataRow[] drsclassuser = dtclassuser.Select("UserName='******'"); * if (drsclassuser.Length > 0) * { * dr["isms"] = drsclassuser[0]["IsMs"].ToString(); * dr["subcode"] = drsclassuser[0]["SubCode"].ToString(); * dr["checked"] = "true"; * }z++; * dtdptuser.Rows.Add(dr); * * } * } * } * * } * tec = sb.ToString(); * depts = Newtonsoft.Json.JsonConvert.SerializeObject(dtdptuser); * subsdrp = Com.Public.GetDrp("sub", schid, "1", false, "", "");*/ #endregion } }
//需要根据不同情况建立或修改的不同学校用户和不同类型的用户,本学校用户唯一,不需要全系统唯一 protected void Page_Load(object sender, EventArgs e) { //if (true)//如果没对应权限,及判断用户类型是否跨界,主要防止非法篡改数据出现 //{ // Response.Write("无对应权限"); // Response.End(); //} if (!IsPostBack) { //先得到操作类型 dotype = Com.Public.SqlEncStr(Request.Params["dotype"].ToString()); schid = Com.Public.SqlEncStr(Request.Params["schid"].ToString()); gradecode = Com.Public.SqlEncStr(Request.Params["gradecode"].ToString()); if (string.IsNullOrEmpty(schid) || string.IsNullOrEmpty(gradecode))//如果没有对应参数中任意一个 { Response.Write("参数错误!"); Response.End(); } if (dotype == "a") { } else if (dotype == "e")//修改,不能修改用户的类型及学校参数 { btnname = "保存"; classid = Com.Public.SqlEncStr(Request.Params["classid"].ToString()); if (string.IsNullOrEmpty(classid)) { Response.Write("无对应修改的记录!"); Response.End(); } //获取修改的对应用户的 SchSystem.BLL.SchClassInfo sgibll = new SchSystem.BLL.SchClassInfo(); SchSystem.Model.SchClassInfo sgimodel = sgibll.GetModel(int.Parse(classid)); if (sgimodel != null && sgimodel.ClassId > 0) { umodelstr = Newtonsoft.Json.JsonConvert.SerializeObject(sgimodel); } else { Response.Write("无该记录!"); Response.End(); } } else//不在添加及修改之内,则返回 { Response.Write("没有可供确认的操作类型!"); Response.End(); } /*//判断跨界操作的可能性 * if (!Com.Public.isVa(schid, systype)) * { * Response.Write("出错,用户非法跨界操作!"); * Response.End(); * }*/ SchSystem.BLL.SchInfo schbll = new SchSystem.BLL.SchInfo(); schname = schbll.GetSchName(int.Parse(schid)); #region 获取当前学校的老师 //当前班级任课老师及班主任 SchSystem.BLL.SchClassUser userclassbll = new SchSystem.BLL.SchClassUser(); DataTable dtclassuser = userclassbll.GetList("UserName id,SubCode subcode,UserTname name,IsMs isms", "ClassId=" + Com.Public.SqlEncStr(classid)).Tables[0]; //当前学校老师 SchSystem.BLL.SchUserDeptV userbll = new SchSystem.BLL.SchUserDeptV(); DataTable dtuser = userbll.GetList("DeptId,DepartName,UserId,UserTname", "Stat=1 and Ustat=1 and SchId=" + Com.Public.SqlEncStr(schid)).Tables[0]; //DataRow[] dtRow = dtuser.Select(); StringBuilder sb = new StringBuilder(); //DataView dv = dtuser.DefaultView; //DataTable datadpt = dv.ToTable(true, "Pid,DeptId,DepartName"); SchSystem.BLL.SchDepartInfo dptbll = new SchSystem.BLL.SchDepartInfo(); DataTable dt = dptbll.GetList(" 'd_'+convert(varchar(20),Pid) pId,'d_'+convert(varchar(20),DepartId) id,DepartName name,'0' isms,'' subcode,'false' checked,'true' nochecks", "SchId=" + schid + " and Stat=1 Order by OrderId,DepartName").Tables[0]; DataTable dtdptuser = dt.Clone(); dtdptuser.Columns["nochecks"].ColumnName = "nocheck"; if (dt.Rows.Count > 0) { //合并人员到部门表 for (int i = 0; i < dt.Rows.Count; i++) { dtdptuser.Rows.Add(dt.Rows[i].ItemArray); //获取该部门下的人员 DataRow[] drss = dtuser.Select("DeptId='" + dt.Rows[i]["id"].ToString().Replace("d_", "") + "'"); if (drss.Length > 0) { foreach (DataRow item in drss) { DataRow dr = dtdptuser.NewRow(); dr["id"] = item["UserId"].ToString(); dr["name"] = item["UserTname"].ToString(); dr["pId"] = "d_" + item["DeptId"].ToString(); dtdptuser.Rows.Add(dr); } } } deptusers = Newtonsoft.Json.JsonConvert.SerializeObject(dtdptuser); //DataRow[] drs = dt.Select("Pid=0"); //foreach (DataRow dr in drs) //{ // string nodeID = dr["ID"].ToString(); // string nodeText = dr["Name"].ToString(); // nodeText = "├" + nodeText; // string blank = " "; // sb.Append("<option value=\"p_" + nodeID + "\">" + nodeText + "</option>"); // DataRow[] drusers = dtuser.Select("DeptId='" + nodeID + "'"); // if (drusers != null && drusers.Length > 0) // { // foreach (DataRow druser in drusers) // { // sb.Append("<option style=\"color:blue\" value=\"u_" + druser["UserId"].ToString() + "\">" + blank + " " + druser["UserTname"].ToString() + "</option>"); // } // } // BindSon(sb, nodeID, dt, blank, dtuser); //} } //depts = sb.ToString(); deptss = Newtonsoft.Json.JsonConvert.SerializeObject(dtclassuser); subsdrp = Com.Public.GetDrp("sub", schid, "1", false, "", ""); #endregion #region 获取年级领导 SchSystem.BLL.SchGradeUsers usergradebll = new SchSystem.BLL.SchGradeUsers(); gradeboss = usergradebll.GetNames("GradeId='" + Com.Public.SqlEncStr(gradecode) + "'"); gradesdrp = Com.Public.GetDrp("grade", schid, "0", false, "", ""); #endregion } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataTable dt = new DataTable(); string dotype = Request.Params["dotype"].ToString(); var gradeid = Request.Params["gradecode"].ToString(); var classid = Request.Params["classid"].ToString(); if (dotype == "c") { Stubh = Request.Params["Stubh"].ToString(); string stuid = Request.Params["id"].ToString(); string sql = "select * from SchStuInfoV where StuId='" + stuid + "' ";//根据学生ID查询出学校,年级,班级等信息 dt = DbHelperSQL.Query(sql).Tables[0]; if (gradeid == "") { gradeid = dt.Rows[0]["GradeId"].ToString(); } if (classid == "") { classid = dt.Rows[0]["ClassId"].ToString(); } DataRow[] drr = dt.Select(); string oldclassname = drr[0]["OldClassId"].ToString(); if (!string.IsNullOrEmpty(oldclassname) || oldclassname != "") { oldClassName = oldclassname; } else { oldClassName = ""; } SchSystem.BLL.SchStuInfo bll_stu = new SchSystem.BLL.SchStuInfo(); string strWhere = " a.StuId=" + stuid; DataSet ds = bll_stu.GetList(strWhere);//修改绑定需要的数据 ds.Tables[0].Columns.Add("jzGenName2"); ds.Tables[0].Columns.Add("jzLoginName2"); ds.Tables[0].Columns.Add("jzTelNo2"); ds.Tables[0].Columns.Add("jzPwd2"); ds.Tables[0].Columns.Add("jzStat2"); ds.Tables[0].Columns.Add("jzRelation2"); ds.Tables[0].Columns.Add("jzGenId2"); ds.Tables[0].Columns.Add("jzUnId2"); if (ds.Tables[0].Rows.Count != 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { for (int j = i + 1; j < ds.Tables[0].Rows.Count; j++) { if (ds.Tables[0].Rows[i]["StuId"].ToString() == ds.Tables[0].Rows[j]["StuId"].ToString()) { ds.Tables[0].Rows[i]["jzGenName2"] = ds.Tables[0].Rows[j]["jzGenName1"].ToString(); ds.Tables[0].Rows[i]["jzLoginName2"] = ds.Tables[0].Rows[j]["jzLoginName1"].ToString(); ds.Tables[0].Rows[i]["jzTelNo2"] = ds.Tables[0].Rows[j]["jzTelNo1"].ToString(); ds.Tables[0].Rows[i]["jzPwd2"] = ds.Tables[0].Rows[j]["jzPwd1"].ToString(); ds.Tables[0].Rows[i]["jzStat2"] = ds.Tables[0].Rows[j]["jzStat1"].ToString(); ds.Tables[0].Rows[i]["jzRelation2"] = ds.Tables[0].Rows[j]["jzRelation1"].ToString(); ds.Tables[0].Rows[i]["jzGenId2"] = ds.Tables[0].Rows[j]["jzGenId1"].ToString(); ds.Tables[0].Rows[i]["jzUnId2"] = ds.Tables[0].Rows[j]["jzUnId1"].ToString(); ds.Tables[0].Rows.RemoveAt(j); } } } } #region 缺省值:年級領導、班主任和任課教師 SchSystem.BLL.SchGradeUsers sgiBll = new SchSystem.BLL.SchGradeUsers(); SchSystem.BLL.SchClassUser scuBll = new SchSystem.BLL.SchClassUser(); DataTable dtgradeuser = sgiBll.GetList("*", "GradeId='" + gradeid + "'").Tables[0]; if (dtgradeuser.Rows.Count > 0) { StringBuilder sbgradeuser = new StringBuilder(); foreach (DataRow dr in dtgradeuser.Rows) { sbgradeuser.Append(dr["UserTname"].ToString() + ","); } if (sbgradeuser.ToString().Length > 0) { njld = sbgradeuser.ToString().Substring(0, sbgradeuser.ToString().Length - 1);//年級領導 } } DataTable dtclassuser = scuBll.GetList("*", "ClassId='" + classid + "'").Tables[0]; if (dtclassuser.Rows.Count > 0) { StringBuilder sbgradeuser01 = new StringBuilder(); StringBuilder sbgradeuser02 = new StringBuilder(); foreach (DataRow dr in dtclassuser.Rows) { if (dr["IsMs"].ToString() == "1") { sbgradeuser01.Append(dr["UserTname"].ToString() + ","); } else { sbgradeuser02.Append(dr["UserTname"].ToString() + ","); } } if (sbgradeuser01.ToString().Length > 0) { bzr = sbgradeuser01.ToString().Substring(0, sbgradeuser01.ToString().Length - 1);//班主任 } if (sbgradeuser02.ToString().Length > 0) { bjjs = sbgradeuser02.ToString().Substring(0, sbgradeuser02.ToString().Length - 1);//任課教師 } } #endregion StringBuilder sbarea = new StringBuilder(); //获取年级 sbarea.Append("<br/> 年级:<select id=\"nj\" style=\"width:100px\" disabled=\"disabled\">"); sbarea.Append(Com.Public.GetDrpAreaShow("4", Com.Session.schid, ref gradeid, false)); sbarea.Append("</select> "); //获取年级主任 StudentList.namepack npgrade = (StudentList.namepack)Newtonsoft.Json.JsonConvert.DeserializeObject <StudentList.namepack>(getusers("1", gradeid)); sbarea.Append("<span id=\"njld\" style=\"color: #808080 \">年级领导:" + npgrade.gradeboss + "</span><br/><br/>"); //获取班级 sbarea.Append(" 班级:<select id=\"bj\" style=\"width:100px\" disabled=\"disabled\" >"); sbarea.Append(Com.Public.GetDrpAreaShow("5", gradeid, ref classid, false)); sbarea.Append("</select> "); //获取班主任及任课老师 StudentList.namepack np = (StudentList.namepack)Newtonsoft.Json.JsonConvert.DeserializeObject <StudentList.namepack>(getusers("2", classid)); sbarea.Append("<span id=\"bzr\" style=\"color: #808080 \">班主任:"+ np.classms + "</span> "); sbarea.Append("<span id=\"bjjs\" style=\"color: #808080 \">任课老师:" + np.classtec + "</span><br/><br/>"); areastr = sbarea.ToString(); umodelstr = dttojson.DatSetToJSON2(ds);; } } }