protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { dotype = Request.Params["dotype"].ToString(); schid = Com.Session.schid; #region 编辑绑定查询 if (dotype == "e") { stuid = Request.Params["id"].ToString();// SchSystem.BLL.SchStuInfoV bll_stu = new SchSystem.BLL.SchStuInfoV(); DataTable dt = bll_stu.GetList("GradeId,GradeName,ClassId,ClassName,StuId,StuName,CardNo,StuNo,Sex,OldClassId,TestNo,TelNo,StudyType,Addr", "StuId=" + Com.Public.SqlEncStr(stuid)).Tables[0]; stugradeid = dt.Rows[0]["GradeId"].ToString(); stuclassid = dt.Rows[0]["ClassId"].ToString(); stuname = dt.Rows[0]["StuName"].ToString(); stugrade = dt.Rows[0]["GradeName"].ToString(); stuclass = dt.Rows[0]["ClassName"].ToString(); stucode = dt.Rows[0]["TestNo"].ToString(); stusex = dt.Rows[0]["Sex"].ToString(); stucard = dt.Rows[0]["CardNo"].ToString(); stutel = dt.Rows[0]["TelNo"].ToString(); stuaddr = dt.Rows[0]["Addr"].ToString(); stustp = dt.Rows[0]["StudyType"].ToString(); stuocls = dt.Rows[0]["OldClassId"].ToString(); SchSystem.BLL.SchStuGenUV bll_stugen = new SchSystem.BLL.SchStuGenUV(); DataTable dtgen = bll_stugen.GetList("Relation,GenName,TelNo", "StuId=" + Com.Public.SqlEncStr(stuid)).Tables[0]; if (dtgen != null && dtgen.Rows.Count > 0) { stug1name = dtgen.Rows[0]["GenName"].ToString(); stug1rl = dtgen.Rows[0]["Relation"].ToString(); stug1rt = dtgen.Rows[0]["TelNo"].ToString(); if (dtgen.Rows.Count > 1) { stug2name = dtgen.Rows[1]["GenName"].ToString(); stug2rl = dtgen.Rows[1]["Relation"].ToString(); stug2rt = dtgen.Rows[1]["TelNo"].ToString(); } } stuno = "00000000".Substring(0, 8 - stuid.Length) + stuid; } else { stugradeid = Request.Params["gradecode"].ToString(); stuclassid = Request.Params["classid"].ToString(); } drpgrade = Com.Public.GetDrpAreaClassMaster("4", Com.Session.schid, ref stugradeid, false); drpclass = Com.Public.GetDrpAreaClassMaster("5", stugradeid, ref stuclassid, false); StudentList.namepack npgrade = (StudentList.namepack)Newtonsoft.Json.JsonConvert.DeserializeObject <StudentList.namepack>(getusers("1", stugradeid)); stugradeboss = npgrade.gradeboss; StudentList.namepack np = (StudentList.namepack)Newtonsoft.Json.JsonConvert.DeserializeObject <StudentList.namepack>(getusers("2", stuclassid)); stuclassms = np.classms; stuclasstec = np.classtec; #endregion } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { stuid = Request.Params["id"].ToString();// SchSystem.BLL.SchStuInfoV bll_stu = new SchSystem.BLL.SchStuInfoV(); DataTable dt = bll_stu.GetList("GradeId,GradeName,ClassId,ClassName,StuId,StuName,CardNo,StuNo,Sex,OldClassId,TestNo,TelNo,StudyType,Addr", "StuId=" + Com.Public.SqlEncStr(stuid)).Tables[0]; string gradeid = dt.Rows[0]["GradeId"].ToString(); string classid = dt.Rows[0]["ClassId"].ToString(); stuname = dt.Rows[0]["StuName"].ToString(); stugrade = dt.Rows[0]["GradeName"].ToString(); stuclass = dt.Rows[0]["ClassName"].ToString(); stucode = dt.Rows[0]["TestNo"].ToString(); stusex = dt.Rows[0]["Sex"].ToString() == "0" ? "女" : "男"; stucard = dt.Rows[0]["CardNo"].ToString(); stutel = dt.Rows[0]["TelNo"].ToString(); stuaddr = dt.Rows[0]["Addr"].ToString(); stustp = dt.Rows[0]["StudyType"].ToString() == "0" ? "否" : "是";; stuocls = dt.Rows[0]["OldClassId"].ToString(); SchSystem.BLL.SchStuGenUV bll_stugen = new SchSystem.BLL.SchStuGenUV(); DataTable dtgen = bll_stugen.GetList("Relation,GenName,TelNo", "StuId=" + Com.Public.SqlEncStr(stuid)).Tables[0]; if (dtgen != null && dtgen.Rows.Count > 0) { stug1name = dtgen.Rows[0]["GenName"].ToString(); stug1rl = dtgen.Rows[0]["Relation"].ToString(); stug1rt = dtgen.Rows[0]["TelNo"].ToString(); if (dtgen.Rows.Count > 1) { stug2name = dtgen.Rows[1]["GenName"].ToString(); stug2rl = dtgen.Rows[1]["Relation"].ToString(); stug2rt = dtgen.Rows[1]["TelNo"].ToString(); } } StudentList.namepack npgrade = (StudentList.namepack)Newtonsoft.Json.JsonConvert.DeserializeObject <StudentList.namepack>(getusers("1", gradeid)); stugradeboss = npgrade.gradeboss; StudentList.namepack np = (StudentList.namepack)Newtonsoft.Json.JsonConvert.DeserializeObject <StudentList.namepack>(getusers("2", classid)); stuclassms = np.classms; stuclasstec = np.classtec; stuid = "00000000".Substring(0, 8 - stuid.Length) + stuid; } }
public static string getusers(string tp, string id) { StudentList.namepack np = new StudentList.namepack(); if (Com.Public.IsNum(id)) { if (tp == "1")//获取年级主任 { SchSystem.BLL.SchGradeUsers sguBLL = new SchSystem.BLL.SchGradeUsers(); np.gradeboss = sguBLL.GetNames("GradeId=" + Com.Public.SqlEncStr(id)); } else { SchSystem.BLL.SchClassUser scuBLL = new SchSystem.BLL.SchClassUser(); np.classms = scuBLL.GetNames("ClassId=" + Com.Public.SqlEncStr(id) + " and IsMs=1"); np.classtec = scuBLL.GetNames("ClassId=" + Com.Public.SqlEncStr(id) + " and IsMs=0"); } } return(Newtonsoft.Json.JsonConvert.SerializeObject(np)); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { dotype = Request.Params["dotype"].ToString(); string gradeid = Request.Params["gradecode"].ToString(); string classid = Request.Params["classid"].ToString(); schid = Com.Session.schid; #region 编辑绑定查询 if (dotype == "e") { Stubh = Request.Params["Stubh"].ToString(); stuid = Com.Public.SqlEncStr(Request.Params["id"].ToString()); 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); } } } gradeid = ds.Tables[0].Rows[0]["GradeId"].ToString(); classid = ds.Tables[0].Rows[0]["ClassId"].ToString(); } umodelstr = Newtonsoft.Json.JsonConvert.SerializeObject(ds.Tables[0]); } #endregion StringBuilder sbarea = new StringBuilder(); if (Com.Session.systype == "1") { //获取年级 sbarea.Append("<br/> 年级:<select id=\"nj\" style=\"width:100px\">"); sbarea.Append(Com.Public.GetDrpArea("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\" >"); sbarea.Append(Com.Public.GetDrpArea("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(); } } }