public static string getgradeboss(string schid, string gradecode) { schid = Com.Public.SqlEncStr(schid); gradecode = Com.Public.SqlEncStr(gradecode); string rets = ""; if (Com.Session.userid == null) { rets = "expire"; } else { //年级领导 SchSystem.BLL.SchGradeUsers sguBLL = new SchSystem.BLL.SchGradeUsers(); rets = sguBLL.GetNames("GradeId in ( select GradeId from SchGradeInfo where GradeId=" + Com.Public.SqlEncStr(gradecode) + " and schid=" + schid + ")"); } return(rets); }
public static string getgradeboss(string schid, string gradecode) { schid = Com.Public.SqlEncStr(schid); gradecode = Com.Public.SqlEncStr(gradecode); string rets = ""; Com.DataPack.DataRsp <Com.DataPack.UserInfo> rsp = Com.Public.UserFuncSoure(Com.SoureSession.jsid, Com.SoureSession.jstoken); if (rsp.code == "ERROR_TOKEN") { rets = "expire"; } else { //年级领导 SchSystem.BLL.SchGradeUsers sguBLL = new SchSystem.BLL.SchGradeUsers(); rets = sguBLL.GetNames("GradeId in ( select GradeId from SchGradeInfo where GradeId=" + Com.Public.SqlEncStr(gradecode) + " and schid=" + schid + ")"); } return(rets); }
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) { string jsid = Request.Params["sid"].ToString(); string jstoken = Request.Params["token"].ToString(); Com.SoureSession.jsid = jsid; Com.SoureSession.jstoken = jstoken; Com.DataPack.DataRsp <Com.DataPack.UserInfo> rsp = Com.Public.UserFuncSoure(jsid, jstoken); if (rsp.code == "ERROR_TOKEN") { Response.Write("登录已失效!"); Response.End(); } else if (!IsPostBack) { if (Com.SoureSession.Souresystype == "1" || Com.SoureSession.Souresystype == "2")//超级管理员和学校管理员 { islook = true; if (Com.SoureSession.Souresystype == "1") { isadd = false; isedit = false; isdel = false; } else { isadd = true; isedit = true; isdel = true; } } else//普通老师 { isadd = false; isedit = false; isdel = false; islook = true;//学科/年级/班级任课权限 } //isGradeClassAuth = Com.Public.IsUserVal(Com.Session.userrolestr, 2) ? true : false;//学科/年级/班级任课权限 //不是超管获取本学校的 if (Com.SoureSession.Souresystype != "2") { schid = Com.SoureSession.Soureschid; } else//超管还要加省市区学校下拉,后面需要更改 { //第一次加载,获取省市区,获取第一个省份下的所有学校 StringBuilder sbarea = new StringBuilder(); //获取省份 sbarea.Append("省:<select id=\"aprov\">"); string sareacode = ""; sbarea.Append(Com.Public.GetDrpArea("0", "", ref sareacode, false)); sbarea.Append("</select>"); //获取城市 sbarea.Append("市:<select id=\"acity\">"); string sareacitycode = ""; sbarea.Append(Com.Public.GetDrpArea("1", sareacode, ref sareacitycode, false)); sbarea.Append("</select>"); //获取区县 sbarea.Append("区:<select id=\"acoty\">"); string sareacotycode = ""; sbarea.Append(Com.Public.GetDrpArea("2", sareacitycode, ref sareacotycode, false)); cotycode = sareacotycode; sbarea.Append("</select>"); sbarea.Append("学校:<select id=\"asch\">"); string sareaschid = ""; sbarea.Append(Com.Public.GetDrpArea("3", sareacotycode, ref sareaschid, false)); if (sareaschid != "") { schid = sareaschid; } sbarea.Append("</select>"); areastr = sbarea.ToString(); systype = Com.SoureSession.Souresystype; } //当前学校年级:IsFinish状态,1代表已毕业;0代表未毕业 // SchSystem.BLL.SchGradeInfo sgiBll = new SchSystem.BLL.SchGradeInfo(); //DataSet dsSchGrade = sgiBll.GetList("IsFinish=0 and SchId=" + schid); //年级 SchSystem.BLL.SchGradeInfo sgiBLL = new SchSystem.BLL.SchGradeInfo(); DataTable dtSchGrade = sgiBLL.GetList(" IsFinish=0 and SchId='" + schid + "' order by GradeCode").Tables[0];//得到年级数据列表,并且是为非毕业的年级 //年级领导 SchSystem.BLL.SchGradeUsers sguBLL = new SchSystem.BLL.SchGradeUsers(); dtSchGrade.Columns.Add("GradeBoss"); if (dtSchGrade.Rows.Count > 0) { for (int i = 0; i < dtSchGrade.Rows.Count; i++) { dtSchGrade.Rows[i]["GradeBoss"] = sguBLL.GetNames("GradeId=" + dtSchGrade.Rows[i]["GradeId"].ToString()); } } grades = Newtonsoft.Json.JsonConvert.SerializeObject(dtSchGrade); //当前学校所开设的科目 SchSystem.BLL.SchSub schsubBll = new SchSystem.BLL.SchSub(); DataSet dsSchSub = schsubBll.GetList("Stat=1 and SchId='" + schid + "'"); subs = Newtonsoft.Json.JsonConvert.SerializeObject(dsSchSub); //获取科目教师 SchSystem.BLL.SchSubLeader scuBll = new SchSystem.BLL.SchSubLeader(); DataSet dssubUser = scuBll.GetListTecSub("*", "schid='" + schid + "' and Stat=1"); subUser = Newtonsoft.Json.JsonConvert.SerializeObject(dssubUser); //subUser //当前学校的教师 SchSystem.BLL.SchUserInfo suiBll = new SchSystem.BLL.SchUserInfo(); DataSet dsSUI = suiBll.GetList("*", "Stat=1 and SchId='" + schid + "'"); tecs = Newtonsoft.Json.JsonConvert.SerializeObject(dsSUI); } }
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(); * }*/ 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 } }
public static string udel(string schid, string id) { if (!Com.Public.isVa(schid, "")) { return("无跨界权限"); } string ret = ""; if (Com.Session.userid == null) { ret = "expire"; } else { try { SchSystem.BLL.SchSubLeader sslBll = new SchSystem.BLL.SchSubLeader(); bool sslBool = sslBll.ExistsClassSubLeader(schid, id); if (sslBool) { ret = "success01"; } else { SchSystem.BLL.SchGradeUsers sguBll = new SchSystem.BLL.SchGradeUsers(); bool sguBool = sguBll.ExistsGradeUser(schid, id); if (sguBool) { ret = "success02"; } else { SchSystem.BLL.SchClassUser scuBll = new SchSystem.BLL.SchClassUser(); bool scuBooll = scuBll.ExistsClassUser(schid, id); if (scuBooll) { ret = "success03"; } else { SchSystem.BLL.SchUserInfo bll = new SchSystem.BLL.SchUserInfo(); SchSystem.Model.SchUserInfo model = new SchSystem.Model.SchUserInfo(); model.UserId = int.Parse(id); model.Stat = 2; model.LastRecTime = DateTime.Now; model.LastRecUser = Com.Session.userid; if (bll.UpdateStat(model)) { ret = "success"; } else { ret = "操作失败"; } } } } } catch (Exception ex) { ret = ex.Message; } } return(ret); }
//需要根据不同情况建立或修改的不同学校用户和不同类型的用户,本学校用户唯一,不需要全系统唯一 protected void Page_Load(object sender, EventArgs e) { //if (true)//如果没对应权限,及判断用户类型是否跨界,主要防止非法篡改数据出现 //{ // Response.Write("无对应权限"); // Response.End(); //} if (!IsPostBack) { //先得到操作类型 dotype = Com.Public.SqlEncStr(Request.Params["dotype"].ToString()); string gradeid = "0";//修改时的用户ID string uname = "";//修改时的用户账号 if (dotype == "e")//修改,不能修改用户的类型及学校参数 { btnname = "保存"; gradeid = Com.Public.SqlEncStr(Request.Params["gradeid"].ToString()); if (string.IsNullOrEmpty(gradeid)) { Response.Write("无对应修改的用户!"); Response.End(); } //获取修改的对应用户的 SchSystem.BLL.SchGradeInfo sgibll = new SchSystem.BLL.SchGradeInfo(); SchSystem.Model.SchGradeInfo sgimodel = sgibll.GetModel(int.Parse(gradeid)); if (sgimodel != null && sgimodel.GradeId > 0) { umodelstr = Newtonsoft.Json.JsonConvert.SerializeObject(sgimodel); schid = sgimodel.SchId.ToString(); } 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.SchDepartInfo sdiBll = new SchSystem.BLL.SchDepartInfo(); //获取部门列表 DataTable dtdpt = sdiBll.GetList("Pid pId,convert(varchar(20),DepartId) id,DepartName name,'false' checked,'true' nochecks", "SchId=" + schid + " and Stat=1 Order by OrderId").Tables[0]; dtdpt.Columns["nochecks"].ColumnName = "nocheck"; DataTable dtdptuser = dtdpt.Clone(); if (dtdpt.Rows.Count > 0) { //获取该年级下关联的领导 SchSystem.BLL.SchGradeUsers usergradebll = new SchSystem.BLL.SchGradeUsers(); DataTable dtgradeuser = usergradebll.GetList("UserName", "GradeId=" + gradeid).Tables[0]; //获取该学校的所有人员 SchSystem.BLL.SchUserDeptV userbll = new SchSystem.BLL.SchUserDeptV(); DataTable dtuser = userbll.GetList("DeptId ,UserId,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[] drsgrade = dtgradeuser.Select("UserName='******'"); DataRow dr = dtdptuser.NewRow(); dr["id"] = "u_" + item["UserId"].ToString(); dr["name"] = item["UserTname"].ToString(); dr["pId"] = item["DeptId"].ToString(); if (drsgrade.Length > 0) dr["checked"] = "true"; dtdptuser.Rows.Add(dr); } } } } depart =Newtonsoft.Json.JsonConvert.SerializeObject(dtdptuser); #endregion } }
public static string gradesave(string dotype, string schid, string gradename, string gradeid, string tagsusers) { dotype = Com.Public.SqlEncStr(dotype); schid = Com.Public.SqlEncStr(schid); gradename = Com.Public.SqlEncStr(gradename); gradeid = Com.Public.SqlEncStr(gradeid); tagsusers = Com.Public.SqlEncStr(tagsusers); string ret = ""; //字符串匹配验证 string PatternStr = @"^[\u4e00-\u9fa5]+$"; bool resultStr = Regex.IsMatch(gradename, PatternStr); if (resultStr != true) { return ret = "只能输入中文名称"; } try { if (string.IsNullOrEmpty(schid) || schid == "0") ret += "非法的学校!"; SchSystem.BLL.SchGradeInfo userbll = new SchSystem.BLL.SchGradeInfo(); SchSystem.Model.SchGradeInfo usermodel = new SchSystem.Model.SchGradeInfo(); usermodel.LastRecTime = DateTime.Now; usermodel.LastRecUser = Com.Session.userid; //判断编号及账号是否有重复,生成密码加密 if (dotype == "e") { if (userbll.ExistsGradeCode(int.Parse(gradeid), Com.Public.SqlEncStr(gradename), int.Parse(schid))) { ret += "年级编号重复!"; } } if (dotype == "a") { if (userbll.ExistsGradeCode(0, Com.Public.SqlEncStr(gradename), int.Parse(schid))) { ret += "年级编号重复!"; } if (userbll.ExistsGradeCode(0, Com.Public.SqlEncStr(gradename), int.Parse(schid))) { ret += "年级重复!"; } } if (ret == "") { if (!Com.Public.isVa(schid, "")) { return ret = "无跨界权限"; } if (schid == Com.Public.getKey("adminschid")) { ret = "此为系统学校,不允许操作"; } else if (dotype == "e") { usermodel.GradeId = int.Parse(gradeid); usermodel.GradeName = Com.Public.SqlEncStr(gradename); usermodel.LastRecTime = DateTime.Now; usermodel.LastRecUser = Com.Session.userid; userbll.UpdateGrade(usermodel); } tagsusers = Com.Public.SqlEncStr(tagsusers); //添加或更新关联年级 SchSystem.BLL.SchGradeUsers userdeptbll = new SchSystem.BLL.SchGradeUsers(); if (tagsusers == "null") tagsusers = ""; else tagsusers = "'"+tagsusers.Replace(",", "','").Replace("u_","") + "'"; userdeptbll.DoUserGrade(gradeid, Com.Session.userid,schid, tagsusers); //添加或更新关联角色 //SchSystem.BLL.SchUserRole userrolebll = new SchSystem.BLL.SchUserRole(); // if (userroles == null) userroles = "0"; // userrolebll.DoUserRole(username, Com.Session.userid, schid, userroles); ret = "success"; } } catch (Exception ex) { ret = ex.Message; } return ret; }
//需要根据不同情况建立或修改的不同学校用户和不同类型的用户,本学校用户唯一,不需要全系统唯一 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 } }
public static string getnj(string typecode, string pcode, string schid, string classid) { 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 { if (pcode == "null") { pcode = "0"; } if (schid == "undefined") { schid = Com.SoureSession.Soureschid; } schid = Com.Public.SqlEncStr(schid); typecode = Com.Public.SqlEncStr(typecode); string ClassId = ""; SchSystem.BLL.SchGradeUsers sguBLL = new SchSystem.BLL.SchGradeUsers(); SchSystem.BLL.SchClassUser scuBLL = new SchSystem.BLL.SchClassUser(); namepack np = new namepack(); if (typecode == "1")//1为获取年级领导 { string GradeCode = Com.Public.SqlEncStr(pcode); string sql1 = ""; string sql2 = ""; if (Com.SoureSession.Souresystype != "2")//判断是否是超管 { sql1 = "select GradeId from dbo.SchGradeInfo where GradeId='" + GradeCode + "' and SchId='" + Com.SoureSession.Soureschid + "'"; sql2 = "select * FROM SchClassGradeV where IsFinish<>2 and SchId='" + Com.SoureSession.Soureschid + "' and IsFinish=0 and GradeId='" + GradeCode + "' and ClassId='" + classid + "' order by GradeCode,ClassName "; } else { sql1 = "select GradeId from dbo.SchGradeInfo where GradeId='" + GradeCode + "' and SchId='" + schid + "'"; sql2 = "select * FROM SchClassGradeV where IsFinish<>2 and SchId='" + schid + "' and IsFinish=0 and GradeId='" + GradeCode + "' and ClassId='" + classid + "' order by GradeCode,ClassName "; } DataTable dt1 = DbHelperSQL.Query(sql1).Tables[0]; if (dt1.Rows.Count > 0) { string GradeId = dt1.Rows[0]["GradeId"].ToString(); DataTable dt2 = DbHelperSQL.Query(sql2).Tables[0]; njld = np.gradeboss = sguBLL.GetNames("GradeId='" + GradeId + "'"); if (dt2.Rows.Count != 0) { ClassId = dt2.Rows[0]["ClassId"].ToString(); bzr = np.classms = scuBLL.GetNames("ClassId='" + ClassId + "' and IsMs=1"); bjjs = np.classtec = scuBLL.GetNames("ClassId=" + ClassId + " and IsMs=0"); } } } else//侧为获取班主任和任课老师 { np.classms = scuBLL.GetNames("ClassId='" + Com.Public.SqlEncStr(pcode) + "' and IsMs=1 and SchId='" + schid + "'"); np.classtec = scuBLL.GetNames("ClassId=" + Com.Public.SqlEncStr(pcode) + " and IsMs=0 and SchId='" + schid + "'"); } ret = Newtonsoft.Json.JsonConvert.SerializeObject(np); } return(ret); }
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 ustat, string txtcode, string drptype) { Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>(); if (Com.Session.userid == null) { rsp.code = "expire"; rsp.msg = "页面已经过期,请重新登录"; } else { try { //Stat:0废弃,1正常,2被删除,正常界面不显示删除,超管界面可以考虑 string strwhere = "Stat<2 and SchId='" + Com.Session.schid + "' "; if (!string.IsNullOrEmpty(txtname)) { strwhere += " and Topic like '%" + Com.Public.SqlEncStr(txtname) + "%'"; } if (!string.IsNullOrEmpty(ustat)) { strwhere += " and Stat='" + Com.Public.SqlEncStr(ustat) + "'"; } if (txtcode != "0") { strwhere += " and ChnId='" + Com.Public.SqlEncStr(txtcode) + "'"; } if (drptype != "") { strwhere += " and Lv='" + Com.Public.SqlEncStr(drptype) + "'"; } Com.Public.PageModelResp pages = new Com.Public.PageModelResp(); pages.PageIndex = int.Parse(PageIndex); pages.PageSize = int.Parse(PageSize); int rowc = 0; int pc = 0; SchSystem.BLL.WebSchChnNewsV userbll = new SchSystem.BLL.WebSchChnNewsV(); string dbcols = "NewsId,ChnName,ChnId,Topic,RecTime,GradeId,ClassId,Lv,'' GradeName,'' ClassName,'' LvName,'0' isdel,'0' isedit,'1' islook,Stat,IsTop"; DataTable dt = userbll.GetListCols(dbcols, strwhere, "IsTop Desc,RecTime DESC", "", pages.PageIndex, pages.PageSize, ref rowc, ref pc).Tables[0]; pages.PageCount = pc; pages.RowCount = rowc; if (dt.Rows.Count > 0) { SchSystem.BLL.SchClassUser bllclassuser = new SchSystem.BLL.SchClassUser(); SchSystem.BLL.SchGradeUsers bllgradeuser = new SchSystem.BLL.SchGradeUsers(); SchSystem.BLL.SchClassInfo bllclass = new SchSystem.BLL.SchClassInfo(); SchSystem.BLL.SchGradeInfo bllgrade = new SchSystem.BLL.SchGradeInfo(); //权限 for (int i = 0; i < dt.Rows.Count; i++) { if (Com.Session.appeditstat == "1") //允许编辑 { if (dt.Rows[i]["Lv"].ToString() == "0") //班级新闻 { if (Com.Public.IsUserVal(Com.Session.userrolestr, 14) || bllclassuser.ExistsIsMs(dt.Rows[i]["ClassId"].ToString(), Com.Session.usertid, Com.Session.schid, 1) == true) //如果有所有班级权限或是班主任 { dt.Rows[i]["isdel"] = "1"; dt.Rows[i]["isedit"] = "1"; } //获取年级,班级,类型 dt.Rows[i]["GradeName"] = bllgrade.GetName(int.Parse(dt.Rows[i]["GradeId"].ToString())); dt.Rows[i]["ClassName"] = bllclass.GetName(int.Parse(dt.Rows[i]["ClassId"].ToString())); dt.Rows[i]["LvName"] = "班级"; } else if (dt.Rows[i]["Lv"].ToString() == "1") //年级新闻 { if (Com.Public.IsUserVal(Com.Session.userrolestr, 13) || bllgradeuser.ExistsGrade(dt.Rows[i]["GradeId"].ToString(), Com.Session.schid, Com.Session.usertid) == true) //如果有全校权限或是年级组长 { dt.Rows[i]["isdel"] = "1"; dt.Rows[i]["isedit"] = "1"; } //获取年级 dt.Rows[i]["GradeName"] = bllgrade.GetName(int.Parse(dt.Rows[i]["GradeId"].ToString())); dt.Rows[i]["LvName"] = "年级"; } else if (dt.Rows[i]["Lv"].ToString() == "2") //学校新闻 { if (Com.Public.IsUserVal(Com.Session.userrolestr, 13)) //如果有全校权限 { dt.Rows[i]["isdel"] = "1"; dt.Rows[i]["isedit"] = "1"; } dt.Rows[i]["LvName"] = "学校"; } } } pages.list = dt; } rsp.RspData = Newtonsoft.Json.JsonConvert.SerializeObject(pages).Replace("\n\r", ""); } catch (Exception ex) { rsp.code = "error"; rsp.msg = ex.Message; } } return(rsp); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string Action = context.Request.Form["Action"]; string SchId = context.Request.Form["SchId"]; if (string.IsNullOrEmpty(SchId)) { SchId = "0"; } else { SchId = Com.Public.SqlEncStr(SchId); } if (Action == "GradeClassInfo") { //年级 SchSystem.BLL.SchGradeInfo sgiBLL = new SchSystem.BLL.SchGradeInfo(); DataTable dt = sgiBLL.GetList(" IsFinish=0 and SchId=" + SchId + " order by GradeCode").Tables[0];//得到年级数据列表,并且是为非毕业的年级 //年级领导 SchSystem.BLL.SchGradeUsers sguBLL = new SchSystem.BLL.SchGradeUsers(); dt.Columns.Add("GradeBoss"); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { dt.Rows[i]["GradeBoss"] = sguBLL.GetNames("GradeId=" + dt.Rows[i]["GradeId"].ToString()); } } context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(dt)); } /*if (Action == "GradeClassList") * { * //string UserId = Com.Session.userid;//获取session中的username * * //int SchId = int.Parse(Com.Session.schid);//获取session中的schid * * SchSystem.BLL.SchUserInfo suiBll = new SchSystem.BLL.SchUserInfo(); * DataSet UserDs = suiBll.GetList("*", "Stat=1 and SchId=" + SchId);//获取当前学校的用户 * string UserStr = SchManagerInfoSystem.Common.Function.DatSetToJSON2(UserDs, "UserRows"); * * StringBuilder sb = new StringBuilder(); * sb.Append("{"); * sb.Append(UserStr); * sb.Append("}"); * context.Response.Write(sb.ToString()); * } * else if (Action == "GradeEdit") * { * int GradeId = int.Parse(context.Request.Form["GradeId"]); * string nameval = context.Request.Form["name"]; * nameval = nameval.Substring(0, nameval.Length - 1); * string[] NameArr = nameval.Split(','); * int NameArrLenght = NameArr.Length; * * SchSystem.BLL.SchGradeUsers sguBll = new SchSystem.BLL.SchGradeUsers(); * //先删除原有年级领导,仅供测试之用 * DataSet ds = sguBll.GetList("AutoId","GradeId="+GradeId); * * StringBuilder sb = new StringBuilder(); * //遍历一个表多行多列 * if (ds.Tables[0].Rows.Count > 0) * { * foreach (DataRow row in ds.Tables[0].Rows) * { * sb.Append(row[0].ToString() + ","); * } * string str = sb.ToString(); * str = str.Substring(0, str.Length - 1); * sguBll.DeleteList(str); * } * //下面的少量数据批量插入数据,仅供测试之用 * int iStr = 0; * for (int i=0; i < NameArrLenght; i++) * { * SchSystem.Model.SchGradeUsers sgi = new SchSystem.Model.SchGradeUsers(); * sgi.GradeId = GradeId; * sgi.UserName = NameArr[i]; * sgi.UserTname = NameArr[i]; * iStr = sguBll.Add(sgi); * } * if(iStr>=0) * context.Response.Write("1"); * else * context.Response.Write("0"); * }*/ }
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);; } } }
public static string udel(string schid, string id) { 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 { SchSystem.BLL.SchSubLeader sslBll = new SchSystem.BLL.SchSubLeader(); bool sslBool = sslBll.ExistsClassSubLeader(schid, id); if (sslBool) { ret = "success01"; } else { SchSystem.BLL.SchGradeUsers sguBll = new SchSystem.BLL.SchGradeUsers(); bool sguBool = sguBll.ExistsGradeUser(schid, id); if (sguBool) { ret = "success02"; } else { SchSystem.BLL.SchClassUser scuBll = new SchSystem.BLL.SchClassUser(); bool scuBooll = scuBll.ExistsClassUser(schid, id); if (scuBooll) { ret = "success03"; } else { SchSystem.BLL.SchUserInfo bll = new SchSystem.BLL.SchUserInfo(); SchSystem.Model.SchUserInfo model = new SchSystem.Model.SchUserInfo(); model.UserId = int.Parse(id); model.Stat = 2; model.LastRecTime = DateTime.Now; model.LastRecUser = Com.SoureSession.Soureuserid; if (bll.UpdateStat(model)) { ret = "success"; } else { ret = "操作失败"; } } } } } catch (Exception ex) { ret = ex.Message; } } return(ret); }