protected void Page_Load(object sender, EventArgs e) { if (Request.Params["schid"] != null && Request.Params["schid"].ToString() != "") { schid = Com.Public.SqlEncStr(Request.Params["schid"].ToString()); //年级 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); } }
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 getSearch(string schid, string gradecode, string subcode, string ustat) { schid = Com.Public.SqlEncStr(schid); gradecode = Com.Public.SqlEncStr(gradecode); subcode = Com.Public.SqlEncStr(subcode); ustat = Com.Public.SqlEncStr(ustat); 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.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); searchgradsub ds = new searchgradsub(); ds.grade = dtSchGrade; ds.subs = dsSchSub; ds.subtec = dssubUser; ret = Newtonsoft.Json.JsonConvert.SerializeObject(ds); } catch (Exception ex) { ret = ex.Message; } } return(ret); }
public static string ExistsClassSubUser(string schid, string subcode) { SchSystem.BLL.SchSubLeader sslBll = new SchSystem.BLL.SchSubLeader(); bool sslbool = sslBll.ExistsClassSubUser(schid, subcode); if (sslbool) { return("success01"); } else { SchSystem.BLL.SchClassUser scuBll = new SchSystem.BLL.SchClassUser(); bool scuBool = scuBll.ExistsClassSubUser(schid, subcode); if (scuBool) { return("success02"); } else { return("0"); } } }
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 (true)//如果没对应权限,及判断用户类型是否跨界,主要防止非法篡改数据出现 //{ // Response.Write("无对应权限"); // Response.End(); //} if (!IsPostBack) { //不是超管获取本学校的 if (Com.Session.systype != "2") { schid = Com.Session.schid; systype = "0"; } else { schid = Request.Params["schid"].ToString(); if (string.IsNullOrEmpty(schid))//如果没有对应参数中任意一个 { Response.Write("学校ID为空或者添加的类型为空!"); Response.End(); } } SchSystem.BLL.SchSub ssBll = new SchSystem.BLL.SchSub(); //先得到操作类型 dotype = Com.Public.SqlEncStr(Request.Params["dotype"].ToString()); string subid = "0"; //修改时的用户ID string uname = ""; //修改时的用户账号 if (dotype == "e") //修改,不能修改用户的类型及学校参数 { btnname = "保存"; subid = Com.Public.SqlEncStr(Request.Params["subid"].ToString()); if (string.IsNullOrEmpty(subid)) { Response.Write("无对应修改的用户!"); Response.End(); } //获取修改的对应用户的 SchSystem.Model.SchSub ssModel = ssBll.GetModelSub(subid, schid); if (ssModel != null && ssModel.SubId > 0) { umodelstr = Newtonsoft.Json.JsonConvert.SerializeObject(ssModel); schid = ssModel.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.SchSubLeader sslBll = new SchSystem.BLL.SchSubLeader(); DataTable dtgradeuser = sslBll.GetList("UserName", "SubCode=" + subid).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"] = "sub_" + 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); //科目ID tagsusers = Com.Public.SqlEncStr(tagsusers); //科目组长ID string ret = ""; if (Com.Session.userid == null) { ret = "expire"; } else { //字符串匹配验证 //if (gradename != "") //{ // 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.SchSubLeader sslModel = new SchSystem.Model.SchSubLeader(); //SchSystem.Model.SchGradeInfo usermodel = new SchSystem.Model.SchGradeInfo(); sslModel.LastRecTime = DateTime.Now; sslModel.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") { sslModel.SubCode = gradeid; sslModel.SchId = int.Parse(schid); sslModel.LastRecTime = DateTime.Now; sslModel.LastRecUser = Com.Session.userid; //userbll.UpdateGrade(sslModel); } //tagsusers = Com.Public.SqlEncStr(tagsusers); //添加或更新关联年级 SchSystem.BLL.SchSubLeader sslBll = new SchSystem.BLL.SchSubLeader(); //SchSystem.BLL.SchGradeUsers userdeptbll = new SchSystem.BLL.SchGradeUsers(); if (tagsusers == null || tagsusers == "") { tagsusers = ""; } else { tagsusers = "'" + tagsusers.Replace(",", "','").Replace("sub_", "") + "'"; } sslBll.DoUserSubLeader(gradeid, Com.Session.userid, schid, tagsusers); ret = "success"; } } catch (Exception ex) { ret = ex.Message; } } return(ret); }
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); }
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); }