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 } }
public static string page(string PageIndex, string PageSize, string ClassId, string SchId, string Stuname, string GradeId) { Com.Public.PageModelResp pages = new Com.Public.PageModelResp(); pages.PageIndex = int.Parse(PageIndex); pages.PageSize = int.Parse(PageSize); SchSystem.BLL.SchClassUser bllclassuser = new SchSystem.BLL.SchClassUser(); SchSystem.BLL.SchGradeUsers bllgradeuser = new SchSystem.BLL.SchGradeUsers(); string strWhere = "StuStat=1 and SchId=" + Com.Public.SqlEncStr(SchId); if (!string.IsNullOrEmpty(Stuname)) { strWhere += " and stuname LIKE '%" + Com.Public.SqlEncStr(Stuname) + "%'"; } if (GradeId != "-1" && GradeId != "")//获取当前用户的所有年级 { strWhere += " and GradeId=" + Com.Public.SqlEncStr(GradeId); } if (ClassId != "-1" && ClassId != "")//获取当前用户的所有班级 { strWhere += " and ClassId=" + Com.Public.SqlEncStr(ClassId); } int RowCount = 0; int PageCount = 0;//left('00000000',8-len(StuId))+convert(varchar(10),StuId) string cols = " GradeId,ClassId,GradeName,ClassName,StuId,TestNo,StuName,CardNo,Sex,StuNo,TelNo,StudyType,LoginName,'' GenNameO,'' GenLoginNameO ,'' GenTelO,'' GenNameT,'' GenLoginNameT ,'' GenTelT,'0' isdel,'0' isedit,'0' islook"; SchSystem.BLL.SchStuInfoV bllstuv = new SchSystem.BLL.SchStuInfoV(); DataTable dtstuv = bllstuv.GetListCols(cols, strWhere, "StuName", "ASC", pages.PageIndex, pages.PageSize, ref RowCount, ref PageCount).Tables[0]; pages.PageCount = PageCount; pages.RowCount = RowCount; if (dtstuv != null && dtstuv.Rows.Count > 0) { SchSystem.BLL.SchStuGenUV bllstugenv = new SchSystem.BLL.SchStuGenUV(); for (int i = 0; i < dtstuv.Rows.Count; i++)//将家长添加上,并且把权限加上 { //获取家长 DataTable dtgenv = bllstugenv.GetList("GenName,LoginName,TelNo,Relation", "Stat=1 and StuId=" + dtstuv.Rows[i]["StuId"].ToString()).Tables[0]; if (dtgenv != null && dtgenv.Rows.Count > 0) { dtstuv.Rows[i]["GenNameO"] = dtgenv.Rows[0]["GenName"].ToString(); dtstuv.Rows[i]["GenTelO"] = dtgenv.Rows[0]["TelNo"].ToString(); dtstuv.Rows[i]["GenLoginNameO"] = dtgenv.Rows[0]["LoginName"].ToString(); if (dtgenv.Rows.Count > 1) { dtstuv.Rows[i]["GenNameT"] = dtgenv.Rows[1]["GenName"].ToString(); dtstuv.Rows[i]["GenTelT"] = dtgenv.Rows[1]["TelNo"].ToString(); dtstuv.Rows[i]["GenLoginNameT"] = dtgenv.Rows[1]["LoginName"].ToString(); } } pages.list = dtstuv; } } return(Newtonsoft.Json.JsonConvert.SerializeObject(pages)); }
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 page(string PageIndex, string PageSize, string ClassId, string SchId, string Stuname, string GradeId) { bool islist = false; Com.Public.PageModelResp pages = new Com.Public.PageModelResp(); pages.PageIndex = int.Parse(PageIndex); pages.PageSize = int.Parse(PageSize); SchSystem.BLL.SchClassUser bllclassuser = new SchSystem.BLL.SchClassUser(); SchSystem.BLL.SchGradeUsers bllgradeuser = new SchSystem.BLL.SchGradeUsers(); #region 添加按钮和列表显示权限 pages.isadd = false; if (Com.SoureSession.Souresystype == "1")//学校超管 { islist = true; if (GradeId == "-1" || ClassId == "-1" || GradeId == "" || ClassId == "") //系统编辑状态为0,或者年级,班级其中一个选择了全部,则不允许出现添加按钮 { pages.isadd = false; } else { pages.isadd = true; } } else//普通老师账号 { if (bllclassuser.ExistsIsMs(Com.Public.SqlEncStr(ClassId), Com.SoureSession.Soureuserid, Com.SoureSession.Soureschid, 1) == true)//班主任 { if (Com.Session.appeditstat == "1") { pages.isadd = true; } islist = true; } else { pages.isadd = false; if (bllgradeuser.ExistsGrade(Com.Public.SqlEncStr(GradeId), Com.SoureSession.Soureschid, Com.SoureSession.Soureuserid) == true)//年级主任 { islist = true; } if (bllclassuser.ExistsIsMs(Com.Public.SqlEncStr(ClassId), Com.SoureSession.Soureuserid, Com.SoureSession.Soureschid, 0) == true)//任课老师 { islist = true; } } if (Com.Public.IsUserVal(Com.Session.userrolestr, 2)) { islist = true; } ; } #endregion if (islist) { string strWhere = "StuStat=1 "; if (!string.IsNullOrEmpty(Stuname)) { strWhere += " and stuname LIKE '%" + Com.Public.SqlEncStr(Stuname) + "%'"; } if (GradeId == "-1" || GradeId == "")//获取当前用户的所有年级 { strWhere += " and GradeId in (" + Com.Public.GetIdsAllStu("4", Com.SoureSession.Soureschid) + ")"; } else { strWhere += " and GradeId=" + Com.Public.SqlEncStr(GradeId); } if (ClassId == "-1" || ClassId == "")//获取当前用户的所有班级 { if (GradeId == "") { GradeId = "-1"; } strWhere += " and ClassId in (" + Com.Public.GetIdsAllStu("5", Com.Public.SqlEncStr(GradeId)) + ")"; } else { strWhere += " and ClassId=" + Com.Public.SqlEncStr(ClassId); } int RowCount = 0; int PageCount = 0;//left('00000000',8-len(StuId))+convert(varchar(10),StuId) string cols = " GradeId,ClassId,GradeName,ClassName,StuId,TestNo,StuName,CardNo,Sex,StuNo,TelNo,StudyType,LoginName,'' GenNameO,'' GenLoginNameO ,'' GenTelO,'' GenNameT,'' GenLoginNameT ,'' GenTelT,'0' isdel,'0' isedit,'0' islook"; SchSystem.BLL.SchStuInfoV bllstuv = new SchSystem.BLL.SchStuInfoV(); DataTable dtstuv = bllstuv.GetListCols(cols, strWhere, "StuName", "ASC", pages.PageIndex, pages.PageSize, ref RowCount, ref PageCount).Tables[0]; pages.PageCount = PageCount; pages.RowCount = RowCount; if (dtstuv != null && dtstuv.Rows.Count > 0) { SchSystem.BLL.SchStuGenUV bllstugenv = new SchSystem.BLL.SchStuGenUV(); for (int i = 0; i < dtstuv.Rows.Count; i++)//将家长添加上,并且把权限加上 { //获取家长 DataTable dtgenv = bllstugenv.GetList("GenName,LoginName,TelNo,Relation", "Stat=1 and StuId=" + dtstuv.Rows[i]["StuId"].ToString()).Tables[0]; if (dtgenv != null && dtgenv.Rows.Count > 0) { dtstuv.Rows[i]["GenNameO"] = dtgenv.Rows[0]["GenName"].ToString(); dtstuv.Rows[i]["GenTelO"] = dtgenv.Rows[0]["TelNo"].ToString(); dtstuv.Rows[i]["GenLoginNameO"] = dtgenv.Rows[0]["LoginName"].ToString(); if (dtgenv.Rows.Count > 1) { dtstuv.Rows[i]["GenNameT"] = dtgenv.Rows[1]["GenName"].ToString(); dtstuv.Rows[i]["GenTelT"] = dtgenv.Rows[1]["TelNo"].ToString(); dtstuv.Rows[i]["GenLoginNameT"] = dtgenv.Rows[1]["LoginName"].ToString(); } } //权限 if (Com.SoureSession.Souresystype == "1") //学校超管,可看 { if (Com.Session.appeditstat == "1") //系统未被屏蔽编辑功能,则可编辑和删除 { dtstuv.Rows[i]["isdel"] = "1"; dtstuv.Rows[i]["isedit"] = "1"; } dtstuv.Rows[i]["islook"] = "1"; } else//普通老师账号 { if (bllclassuser.ExistsIsMs(dtstuv.Rows[i]["ClassId"].ToString(), Com.SoureSession.Soureuserid, Com.SoureSession.Soureschid, 1) == true)//班主任可查看 { dtstuv.Rows[i]["islook"] = "1"; if (Com.Session.appeditstat == "1") { dtstuv.Rows[i]["isdel"] = "1"; dtstuv.Rows[i]["isedit"] = "1"; } } else { if (bllgradeuser.ExistsGrade(dtstuv.Rows[i]["GradeId"].ToString(), Com.SoureSession.Soureschid, Com.SoureSession.Soureuserid) == true)//年级主任 { islist = true; dtstuv.Rows[i]["islook"] = "1"; } } if (Com.Public.IsUserVal(Com.Session.userrolestr, 2)) { dtstuv.Rows[i]["islook"] = "1"; islist = true; } } } pages.list = dtstuv; } } return(Newtonsoft.Json.JsonConvert.SerializeObject(pages)); }
public static Com.DataPack.DataRsp <string> page(string PageIndex, string PageSize, string txtname, string txtcard, string clssid, string gradeid, string schid, string cotyid, string cityid, string provid, string iscard) { Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>(); if (Com.Session.userid == null) { rsp.code = "expire"; rsp.msg = "页面已经过期,请重新登录"; } else { try { SchSystem.BLL.SchStuInfoV userbll = new SchSystem.BLL.SchStuInfoV(); //Stat:0废弃,1正常,2被删除,正常界面不显示删除,超管界面可以考虑 string strwhere = " 1=1 "; //SysType if (!string.IsNullOrEmpty(txtname)) //按学生姓名查询 { strwhere += " and StuName like '%" + Com.Public.SqlEncStr(txtname) + "%'"; } if (!string.IsNullOrEmpty(txtcard))//按卡地址查 { strwhere += " and CardNo like '%" + Com.Public.SqlEncStr(txtcard) + "%'"; } if (iscard == "1")//已有卡 { strwhere += " and len(CardNo)>7 "; } else if (iscard == "0")//无卡 { strwhere += " and len(CardNo)<8 "; } if (!string.IsNullOrEmpty(clssid)) { strwhere += " and ClassId= " + Com.Public.SqlEncStr(clssid); } if (!string.IsNullOrEmpty(gradeid)) { strwhere += " and GradeId= " + Com.Public.SqlEncStr(gradeid); } if (!string.IsNullOrEmpty(schid)) { strwhere += " and SchId= " + Com.Public.SqlEncStr(schid); } if (!string.IsNullOrEmpty(cotyid)) { strwhere += " and AreaNo= '" + Com.Public.SqlEncStr(cotyid) + "'"; } if (!string.IsNullOrEmpty(cityid)) { strwhere += " and left(AreaNo,4)= '" + Com.Public.SqlEncStr(cityid.Substring(0, 4)) + "'"; } if (!string.IsNullOrEmpty(provid)) { strwhere += " and left(AreaNo,2)= '" + Com.Public.SqlEncStr(provid.Substring(0, 2)) + "'"; } Com.Public.PageModelResp pages = new Com.Public.PageModelResp(); pages.PageIndex = int.Parse(PageIndex); pages.PageSize = int.Parse(PageSize); int rowc = 0; int pc = 0; DataTable dt = userbll.GetListCols("AreaNo,SchName,GradeName,ClassName,StuId,StuName,CardNo", strwhere, "StuName", "ASC", pages.PageIndex, pages.PageSize, ref rowc, ref pc).Tables[0]; pages.PageCount = pc; pages.RowCount = rowc; if (dt.Rows.Count > 0) { dt.Columns.Add("SHENG"); dt.Columns.Add("SHI"); dt.Columns.Add("QU"); for (int i = 0; i < dt.Rows.Count; i++) { string[] areanames = Com.Public.GetArea(dt.Rows[i]["AreaNo"].ToString()).Split('|'); dt.Rows[i]["SHENG"] = areanames[0]; dt.Rows[i]["SHI"] = areanames[1]; dt.Rows[i]["QU"] = areanames[2]; } //dt.Columns.Add("Dpts"); //获取关联的部门 pages.list = dt; } rsp.data = Newtonsoft.Json.JsonConvert.SerializeObject(pages); } catch (Exception ex) { rsp.code = "error"; rsp.msg = ex.Message; } } return(rsp); }