public static Com.DataPack.DataRsp <string> getclass(string gradecode) { Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>(); if (Com.Session.userid == null) { rsp.code = "expire"; rsp.msg = "页面已经过期,请重新登录"; } else { try { SchSystem.BLL.SchClassInfo schclass = new SchSystem.BLL.SchClassInfo(); DataTable dtSchClass = schclass.GetList("ClassName,ClassId", "IsFinish=0 and GradeCode='" + gradecode + "' and SchId='" + SchId + "'").Tables[0]; string optionSchClass = ""; for (int i = 0; i < dtSchClass.Rows.Count; i++) { optionSchClass += "<option value=\"" + dtSchClass.Rows[i]["ClassId"].ToString() + "\">" + dtSchClass.Rows[i]["ClassName"].ToString() + "</option>"; } rsp.data = optionSchClass.ToString(); } catch (Exception ex) { rsp.code = "ExcepError"; rsp.msg = ex.Message; } } return(rsp); }
public static string getclassdatas(string schid) { string ret = ""; SchSystem.BLL.SchClassInfo SchClassBll = new SchSystem.BLL.SchClassInfo(); DataTable dtschclass = SchClassBll.GetList("ClassId,GradeId,ClassName", "IsFinish=0 and SchId='" + schid + "' order by ClassName asc").Tables[0]; ret = Newtonsoft.Json.JsonConvert.SerializeObject(dtschclass); return(ret); }
public static string getarea(string typecode, string pcode, string ustat, string gradecode) { typecode = Com.Public.SqlEncStr(typecode); pcode = Com.Public.SqlEncStr(pcode); ustat = Com.Public.SqlEncStr(ustat); gradecode = Com.Public.SqlEncStr(gradecode); string ret = ""; Com.DataPack.DataRsp <Com.DataPack.UserInfo> rsp = Com.Public.UserFuncSoure(Com.SoureSession.jsid, Com.SoureSession.jstoken); if (rsp.code == "ERROR_TOKEN") { ret = "expire"; } else { try { string selp = ""; if (typecode != "4") { ret = Com.Public.GetDrpArea(typecode, pcode, ref selp, false); } else { SchSystem.BLL.SchClassInfo sciBll = new SchSystem.BLL.SchClassInfo(); string strWhere = " IsFinish=0 "; if (pcode != "") { strWhere += " and Schid=" + pcode; } if (gradecode != "" || gradecode != "0") { strWhere += " and GradeId='" + gradecode + "'"; } //获取科目组长 SchSystem.BLL.SchSubLeader scuBll = new SchSystem.BLL.SchSubLeader(); DataTable dssubUser = scuBll.GetListTecSub("*", "schid='" + pcode + "' and Stat=1").Tables[0]; DataTable scids = sciBll.GetList("ClassId,ClassName", strWhere).Tables[0]; //scids.Select(); gradsub ds = new gradsub(); ds.grade = Com.Public.GetDrp("grade", pcode, ustat, true, "", "");//是否已毕业,1毕业,0未毕业 ds.subs = Com.Public.GetDrp("sub", pcode, "1", true, "", ""); ds.schclass = scids; ret = Newtonsoft.Json.JsonConvert.SerializeObject(ds); //ret = Com.Public.GetDrp("sub", Com.Public.SqlEncStr(pcode), "1", true, "", ""); } } catch (Exception ex) { ret = ""; } } return(ret); }
public static string page(string txtname, string ustat, string cotycode, string schid, string gradeCode) { txtname = Com.Public.SqlEncStr(txtname); ustat = Com.Public.SqlEncStr(ustat); cotycode = Com.Public.SqlEncStr(cotycode); schid = Com.Public.SqlEncStr(schid); gradeCode = Com.Public.SqlEncStr(gradeCode); SchSystem.BLL.SchClassInfo sciBll = new SchSystem.BLL.SchClassInfo(); if (schid == "") { schid = "0"; } //IsFinish:毕业状态,0非,1是,2被删除,正常界面不显示删除,超管界面可以考虑 string strwhere = "IsFinish = 0 and SchId = '" + Com.Public.SqlEncStr(schid) + "'"; if (!string.IsNullOrEmpty(ustat)) { strwhere += " and IsFinish=" + Com.Public.SqlEncStr(ustat); } if (!string.IsNullOrEmpty(gradeCode) || gradeCode != "") { strwhere += " and GradeCode='" + Com.Public.SqlEncStr(gradeCode) + "'"; } int rowc = 0; int pc = 0; //DataTable dt = userbll.GetListCols("*", strwhere, "SchName", "ASC", pages.PageIndex, pages.PageSize, ref rowc, ref pc).Tables[0]; DataTable ClassDt = sciBll.GetList(strwhere).Tables[0];//得到班级数据列表 //pages.PageCount = pc; if (ClassDt.Rows.Count > 0) { ClassDt.Columns.Add("Ustat"); ClassDt.Columns.Add("Ucity"); ClassDt.Columns.Add("TeacherClass"); //班主任 //ClassDt.Columns.Add("Teacher");//任课老师 ClassDt.Columns.Add("TeacherSub"); //任课老师科目 SchSystem.BLL.SchClassUser scuBLL = new SchSystem.BLL.SchClassUser(); for (int i = 0; i < ClassDt.Rows.Count; i++) { ClassDt.Rows[i]["Ustat"] = ClassDt.Rows[i]["IsFinish"].ToString() == "0" ? "正常" : "停用"; string ClassId = ClassDt.Rows[i]["ClassId"].ToString(); //班级教师(班主任) ClassDt.Rows[i]["TeacherClass"] = scuBLL.GetNames("ClassId='" + ClassId + "' and Stat=1 and IsMs=1"); //任课老师 ClassDt.Rows[i]["TeacherSub"] = scuBLL.GetNames("ClassId='" + ClassId + "' and Stat=1 and IsMs=0"); } //pages.list = ClassDt; } //Newtonsoft.Json.JsonConvert(); //string ddd = Newtonsoft.Json.JsonConvert.SerializeObject(pages); //string ddd = Newtonsoft.Json.JsonConvert.SerializeObject(ClassDt); return(Newtonsoft.Json.JsonConvert.SerializeObject(ClassDt)); }
public static string getclassdatas(string schid) { string ret = ""; Com.DataPack.DataRsp <Com.DataPack.UserInfo> rsp = Com.Public.UserFuncSoure(Com.SoureSession.jsid, Com.SoureSession.jstoken); if (rsp.code == "ERROR_TOKEN") { ret = "expire"; } else { SchSystem.BLL.SchClassInfo SchClassBll = new SchSystem.BLL.SchClassInfo(); DataTable dtschclass = SchClassBll.GetList("ClassId,GradeId,ClassName", "IsFinish=0 and SchId='" + schid + "' order by ClassName asc").Tables[0]; ret = Newtonsoft.Json.JsonConvert.SerializeObject(dtschclass); } return(ret); }
protected void Page_Load(object sender, EventArgs e) { SchId = Com.Session.schid; //栏目初始化 SchSystem.BLL.WebSchChn SchChn = new SchSystem.BLL.WebSchChn(); DataTable dtSchChn = SchChn.GetList("ChnName,ChnCode", "Stat=1").Tables[0]; SchChnJsonStr = Newtonsoft.Json.JsonConvert.SerializeObject(dtSchChn); //年级 SchSystem.BLL.SchGradeInfo schgrade = new SchSystem.BLL.SchGradeInfo(); DataTable dtSchGrade = schgrade.GetList("GradeName,GradeCode", "IsFinish=0 and SchId=" + SchId).Tables[0]; string GradeCode = dtSchGrade.Rows[0]["GradeCode"].ToString(); SchGradeJsonStr = Newtonsoft.Json.JsonConvert.SerializeObject(dtSchGrade); //班级 SchSystem.BLL.SchClassInfo schclass = new SchSystem.BLL.SchClassInfo(); DataTable dtSchClass = schclass.GetList("ClassName,ClassId", "IsFinish=0 and GradeCode='" + GradeCode + "' and SchId='" + SchId + "'").Tables[0]; SchClassJsonStr = Newtonsoft.Json.JsonConvert.SerializeObject(dtSchClass); }
public static string GetIdsAllStu(string TypeCode, string pAreaCode) { DataTable dt = new DataTable(); StringBuilder sb = new StringBuilder("0"); SchSystem.BLL.SchGradeInfo bllgrade = new SchSystem.BLL.SchGradeInfo(); SchSystem.BLL.SchClassInfo bllclass = new SchSystem.BLL.SchClassInfo(); if (TypeCode == "4")//年级 { //普通老师 if (Com.Session.systype == "0") { if (Com.Public.IsUserVal(Com.Session.userrolestr, 2))//有查询权限,则全校 { dt = bllgrade.GetList("GradeId ID", "IsFinish=0 and SchId='" + Com.Public.SqlEncStr(pAreaCode) + "'").Tables[0]; } else//年级主任或者普通老师 { dt = bllgrade.GetList("GradeId ID", "IsFinish=0 and SchId='" + Com.Public.SqlEncStr(pAreaCode) + "' and (GradeId in (select GradeId FROM SchGradeUsers where UserName="******") or GradeId in (select GradeId FROM SchClassUserV where UserName="******"))").Tables[0]; } } else//学校超管 { dt = bllgrade.GetList("GradeId ID", "IsFinish=0 and SchId='" + Com.Public.SqlEncStr(pAreaCode) + "'").Tables[0]; } } else if (TypeCode == "5")//班级 { if (pAreaCode == "") { pAreaCode = "0"; } if (pAreaCode == "-1") { //普通老师 if (Com.Session.systype == "0") { if (Com.Public.IsUserVal(Com.Session.userrolestr, 2))//有查询权限,则全校 { dt = bllclass.GetList("ClassId ID", "IsFinish=0 and SchId='" + Com.Session.schid + "'").Tables[0]; } else//年级主任或者普通老师 { dt = bllclass.GetList("ClassId ID", "IsFinish=0 and SchId='" + Com.Session.schid + "' and (GradeId in (select GradeId FROM SchGradeUsers where UserName="******") or ClassId in (select ClassId FROM SchClassUserV where UserName="******"))").Tables[0]; } } else//学校超管 { dt = bllclass.GetList("ClassId ID", "IsFinish=0 and SchId='" + Com.Session.schid + "'").Tables[0]; } } else { //普通老师 if (Com.Session.systype == "0") { if (Com.Public.IsUserVal(Com.Session.userrolestr, 2))//有查询权限,则全校 { dt = bllclass.GetList("ClassId ID", "IsFinish=0 and GradeId='" + Com.Public.SqlEncStr(pAreaCode) + "'").Tables[0]; } else//年级主任或者普通老师 { dt = bllclass.GetList("ClassId ID", "IsFinish=0 and GradeId='" + Com.Public.SqlEncStr(pAreaCode) + "' and (GradeId in (select GradeId FROM SchGradeUsers where UserName="******") or ClassId in (select ClassId FROM SchClassUserV where UserName="******"))").Tables[0]; } } else//学校超管 { dt = bllclass.GetList("ClassId ID", "IsFinish=0 and GradeId='" + Com.Public.SqlEncStr(pAreaCode) + "'").Tables[0]; } } } if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { sb.Append("," + dt.Rows[i]["ID"].ToString()); } } return(sb.ToString()); }
public static string GetDrpAreaStu(string TypeCode, string pAreaCode, ref string sAreaCode, bool addall) { DataTable dt = new DataTable(); StringBuilder sb = new StringBuilder(); SchSystem.BLL.SysArea bll = new SchSystem.BLL.SysArea(); SchSystem.BLL.SchInfo bllsch = new SchSystem.BLL.SchInfo(); SchSystem.BLL.SchGradeInfo bllgrade = new SchSystem.BLL.SchGradeInfo(); SchSystem.BLL.SchClassInfo bllclass = new SchSystem.BLL.SchClassInfo(); string sqlstr = ""; if (TypeCode == "0")//取省份 { sqlstr = ""; } else if (TypeCode == "1" && pAreaCode != "")//取城市 { if (pAreaCode.Length == 6) { sqlstr = " and left(AreaCode,2)='" + pAreaCode.Substring(0, 2) + "'"; } else { sqlstr = " and AreaCode='" + Com.Public.SqlEncStr(pAreaCode) + "'"; } } else if (TypeCode == "2" && pAreaCode != "")//取区县 { if (pAreaCode.Length == 6) { sqlstr = " and left(AreaCode,4)='" + pAreaCode.Substring(0, 4) + "'"; } else { sqlstr = " and AreaCode='" + Com.Public.SqlEncStr(pAreaCode) + "'"; } } if (addall) { sb.Append("<option value=\"-1\" selected=\"selected\">全部</option>"); } if (TypeCode == "0" || TypeCode == "1" || TypeCode == "2") { //dt = bll.GetList("AreaCode ID,AreaName Name", "Stat=1 and TypeCode='" + TypeCode + "' " + sqlstr + " Order by AreaName").Tables[0]; dt = bll.GetList("AreaCode ID,AreaName Name", "TypeCode='" + Com.Public.SqlEncStr(TypeCode) + "' " + sqlstr + " Order by AreaName").Tables[0]; //获取全部省份 } else if (TypeCode == "3") //学校 { dt = bllsch.GetList("SchId ID,SchName Name", "Stat=1 and AreaNo='" + Com.Public.SqlEncStr(pAreaCode) + "' Order by SchName").Tables[0]; } else if (TypeCode == "4")//年级 { //普通老师 if (Com.Session.systype == "0") { if (Com.Public.IsUserVal(Com.Session.userrolestr, 2))//有查询权限,则全校 { dt = bllgrade.GetList("GradeId ID ,GradeName Name", "IsFinish=0 and SchId='" + Com.Public.SqlEncStr(pAreaCode) + "' Order by GradeCode").Tables[0]; } else { dt = bllgrade.GetList("GradeId ID ,GradeName Name", "IsFinish=0 and SchId='" + Com.Public.SqlEncStr(pAreaCode) + "' and (GradeId in (select GradeId FROM SchGradeUsers where UserName="******") or GradeId in (select GradeId FROM SchClassUserV where UserName="******")) Order by GradeCode").Tables[0]; } } else//学校超管 { dt = bllgrade.GetList("GradeId ID ,GradeName Name", "IsFinish=0 and SchId='" + Com.Public.SqlEncStr(pAreaCode) + "' Order by GradeCode").Tables[0]; } } else if (TypeCode == "5")//班级 { if (pAreaCode == "") { pAreaCode = "0"; } //普通老师 if (Com.Session.systype == "0") { if (Com.Public.IsUserVal(Com.Session.userrolestr, 2))//有查询权限,则全校 { dt = bllclass.GetList("ClassId ID, ClassName Name", "IsFinish=0 and GradeId='" + Com.Public.SqlEncStr(pAreaCode) + "' Order by ClassName").Tables[0]; } else { dt = bllclass.GetList("ClassId ID, ClassName Name", "IsFinish=0 and GradeId='" + Com.Public.SqlEncStr(pAreaCode) + "' and (GradeId in (select GradeId FROM SchGradeUsers where UserName="******") or ClassId in (select ClassId FROM SchClassUserV where UserName="******")) Order by ClassName").Tables[0]; } } else//学校超管 { dt = bllclass.GetList("ClassId ID, ClassName Name", "IsFinish=0 and GradeId='" + Com.Public.SqlEncStr(pAreaCode) + "' Order by ClassName").Tables[0]; } } if (dt.Rows.Count > 0) { if (sAreaCode == "")//输出第一个节点 { sAreaCode = dt.Rows[0]["ID"].ToString(); } for (int i = 0; i < dt.Rows.Count; i++) { if (sAreaCode == "" && i == 0) { sb.Append("<option value=\"" + dt.Rows[i]["ID"].ToString() + "\" selected=\"selected\">" + dt.Rows[i]["Name"].ToString() + "</option>"); } else { // selected="selected" if (dt.Rows[i]["ID"].ToString() == sAreaCode) { sb.Append("<option value=\"" + dt.Rows[i]["ID"].ToString() + "\">" + dt.Rows[i]["Name"].ToString() + "</option>"); } else { sb.Append("<option value=\"" + dt.Rows[i]["ID"].ToString() + "\">" + dt.Rows[i]["Name"].ToString() + "</option>"); } } } } return(sb.ToString()); }
/// <summary> /// /// </summary> /// <param name="TypeCode"></param> /// <param name="pAreaCode"></param> /// <param name="sAreaCode"></param> /// <param name="addall"></param> /// <param name="listoredit">區分是否為列表頁面和編輯頁面(1代表列表頁面;0代表編輯頁面)</param> /// <returns></returns> public static string GetDrpArea(string TypeCode, string pAreaCode, ref string sAreaCode, bool addall, string listoredit = "1") { DataTable dt = new DataTable(); StringBuilder sb = new StringBuilder(); SchSystem.BLL.SysArea bll = new SchSystem.BLL.SysArea(); SchSystem.BLL.SchInfo bllsch = new SchSystem.BLL.SchInfo(); SchSystem.BLL.SchGradeInfo bllgrade = new SchSystem.BLL.SchGradeInfo(); SchSystem.BLL.SchClassInfo bllclass = new SchSystem.BLL.SchClassInfo(); string sqlstr = ""; if (TypeCode == "0")//取省份 { sqlstr = ""; } else if (TypeCode == "1")//取城市 { if (pAreaCode.Length == 6) { sqlstr = " and left(AreaCode,2)='" + pAreaCode.Substring(0, 2) + "'"; } else { sqlstr = " and AreaCode='" + pAreaCode + "'"; } } else if (TypeCode == "2")//取区县 { if (pAreaCode.Length == 6) { sqlstr = " and left(AreaCode,4)='" + pAreaCode.Substring(0, 4) + "'"; } else { sqlstr = " and AreaCode='" + pAreaCode + "'"; } } if (addall) { sb.Append("<option value=\"\" selected=\"selected\">全部</option>"); } if (TypeCode == "0" || TypeCode == "1" || TypeCode == "2") { //dt = bll.GetList("AreaCode ID,AreaName Name", "Stat=1 and TypeCode='" + TypeCode + "' " + sqlstr + " Order by AreaName").Tables[0]; dt = bll.GetList("AreaCode ID,AreaName Name", "TypeCode='" + TypeCode + "' " + sqlstr + " Order by AreaName").Tables[0]; //获取全部省份 } else if (TypeCode == "3") //学校 { dt = bllsch.GetList("SchId ID,SchName Name", "Stat=1 and AreaNo='" + pAreaCode + "' Order by SchName").Tables[0]; } else if (TypeCode == "4")//年级 { schids = pAreaCode; dt = bllgrade.GetList("GradeId ID ,GradeName Name", "IsFinish=0 and SchId='" + pAreaCode + "' Order by GradeCode").Tables[0]; } else if (TypeCode == "5")//班级 { string strWhere = ""; if (Com.Session.systype != "2") { strWhere += " and schid ='" + Com.Session.schid + "'"; } else { strWhere += " and schid ='" + schids + "'"; } dt = bllclass.GetList("ClassId ID, ClassName Name", "IsFinish=0 and GradeId='" + pAreaCode + "'" + strWhere + " Order by ClassName").Tables[0]; } if (dt.Rows.Count > 0) { if (addall && listoredit == "1") { sAreaCode = ""; } else { if (string.IsNullOrEmpty(sAreaCode)) { sAreaCode = dt.Rows[0]["ID"].ToString(); } } for (int i = 0; i < dt.Rows.Count; i++) { //if (sAreaCode == "" && i == 0) //{ // sb.Append("<option value=\"" + dt.Rows[i]["ID"].ToString() + "\" selected=\"selected\">" + dt.Rows[i]["Name"].ToString() + "</option>"); //} //else //{ // selected="selected" if (dt.Rows[i]["ID"].ToString() == sAreaCode) { sb.Append("<option value=\"" + dt.Rows[i]["ID"].ToString() + "\" selected=\"selected\">" + dt.Rows[i]["Name"].ToString() + "</option>"); } else { sb.Append("<option value=\"" + dt.Rows[i]["ID"].ToString() + "\">" + dt.Rows[i]["Name"].ToString() + "</option>"); } //} } } return(sb.ToString()); }