public static int ClassDelete(string schid, string schclassid) { int ret = 0; SchSystem.BLL.SchClassInfo classbll = new SchSystem.BLL.SchClassInfo(); bool resultBool = classbll.ExistsClassStuData(int.Parse(schclassid)); if (resultBool)//如果为true说明是班级内有数据 { ret = 0; } else//否则即可删除班级记录 { SchSystem.Model.SchClassInfo classmodel = new SchSystem.Model.SchClassInfo(); classmodel.ClassId = int.Parse(schclassid); classmodel.IsFinish = 2; classmodel.LastRecTime = DateTime.Now; classmodel.LastRecUser = Com.Session.userid; if (classbll.UpdateStat(classmodel)) { //SchSystem.BLL.SchClassUser scuBll = new SchSystem.BLL.SchClassUser(); // bool ecu = scuBll.ExistsClassUser(int.Parse(schid), int.Parse(classid)); //bool scubool = scuBll.Delete(classid, schid); //if (scubool) // { ret = 1; //} } else { ret = 0; } } return(ret); }
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 ExistsClassData(string schid, string gradecode) { SchSystem.BLL.SchClassInfo sciBll = new SchSystem.BLL.SchClassInfo(); bool resultBool = sciBll.ExistsClassData(schid, gradecode); if (resultBool) { return("1"); } else { return("0"); } }
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); }
public static int ClassNameSave(string schid, int gradeid, string gradecode, string classnamestr) { int ret = 0;//默认返回值为0,数字1代表成功 SchSystem.BLL.SchClassInfo sciBll = new SchSystem.BLL.SchClassInfo(); SchSystem.Model.SchClassInfo sciModel = new SchSystem.Model.SchClassInfo(); string[] classnamearr = classnamestr.Split(','); int classnamearrlen = classnamearr.Length; foreach (string classname in classnamearr) { DataTable dtRes = sciBll.Exists(schid, gradeid, classname.Replace("班", "")).Tables[0]; if (dtRes.Rows.Count > 0)//如果班级已经存在,则修改状态 { DataRow dr = dtRes.Select()[0]; string classid = dr["ClassId"].ToString(); sciModel.ClassId = int.Parse(classid); sciModel.LastRecTime = DateTime.Now; sciModel.LastRecUser = Com.Session.userid; sciModel.IsFinish = 0; bool resret = sciBll.UpdateStat(sciModel); if (resret) { ret = 1; } } else//否则,添加新班级 { sciModel.SchId = Convert.ToInt32(schid); sciModel.GradeId = gradeid; sciModel.GradeCode = Convert.ToString(gradecode); sciModel.ClassNo = classname.Replace("班", ""); sciModel.ClassName = Convert.ToString(classname); sciModel.RecTime = DateTime.Now; sciModel.RecUser = Com.Session.userid; sciModel.IsFinish = 0; int resret = sciBll.Add(sciModel); if (resret > 0) { ret = 1; } } } 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); }
protected void Page_Load(object sender, EventArgs e) { // string newsid = Request.Params["newsid"].ToString(); SchSystem.BLL.WebSchChnNewsV bll = new SchSystem.BLL.WebSchChnNewsV();// SchSystem.Model.WebSchChnNewsV model = bll.GetModel(int.Parse(newsid)); if (model != null) { newlv = model.Lv.ToString(); chnname = model.ChnName; SchSystem.BLL.SchGradeInfo bllgrade = new SchSystem.BLL.SchGradeInfo(); gradename = bllgrade.GetName(model.GradeId); SchSystem.BLL.SchClassInfo bllclass = new SchSystem.BLL.SchClassInfo(); classname = bllclass.GetName(model.ClassId); content = model.Content; isqur = model.IsQuo.ToString(); qurl = model.QuoUrl; topic = model.Topic; isrep = model.IsReply.ToString(); } }
public static string classsave(string dotype, string schid, string gradecode, string classid, string classname, string tagsusers) { dotype = Com.Public.SqlEncStr(dotype); schid = Com.Public.SqlEncStr(schid); gradecode = Com.Public.SqlEncStr(gradecode); classid = Com.Public.SqlEncStr(classid); classname = Com.Public.SqlEncStr(classname); tagsusers = Com.Public.SqlEncStr(tagsusers); 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 { //字符串匹配验证 string PatternStr = @"^[0-9a-zA-Z\u4e00-\u9fa5]+$"; bool resultStr = Regex.IsMatch(classname, PatternStr); if (resultStr != true) { return(ret = "必填,只能输入中文、数字和字母"); } try { if (!Com.Public.isVa(schid, "")) { return(ret = "无跨界权限"); } if (schid == Com.Public.getKey("adminschid")) { ret = "此为系统学校,不允许操作"; } else if (string.IsNullOrEmpty(schid) || schid == "0") { ret += "非法的学校!"; } SchSystem.BLL.SchClassInfo classbll = new SchSystem.BLL.SchClassInfo(); SchSystem.Model.SchClassInfo classmodel = new SchSystem.Model.SchClassInfo(); classmodel.LastRecTime = DateTime.Now; classmodel.LastRecUser = Com.SoureSession.Soureuserid; classmodel.GradeId = gradecode; classmodel.ClassName = classname; //判断编号及账号是否有重复,生成密码加密 if (dotype == "e") { /*if (userbll.ExistsUserCode(int.Parse(userid), usercode, int.Parse(schid))) * { * ret += "用户编号重复!"; * }*/ } if (dotype == "a") { /*if (userbll.ExistsUserCode(0, usercode, int.Parse(schid))) * { * ret += "用户编号重复!"; * } * if (userbll.ExistsUserCode(0, username, int.Parse(schid))) * { * ret += "账号重复!"; * }*/ } if (ret == "") { if (dotype == "e") { classmodel.ClassId = int.Parse(classid); classbll.Update(classmodel); } if (dotype == "a") { //usermodel.PassWord = SchManagerInfoSystem.Common.DESEncrypt.Encrypt(userpw); classmodel.RecTime = DateTime.Now; classmodel.RecUser = Com.SoureSession.Soureuserid; classmodel.IsFinish = 0; classmodel.SchId = int.Parse(schid); classid = classbll.Add(classmodel).ToString(); } //清除关联的老师,再添加或更新关联老师 SchSystem.BLL.SchClassUser classuserbll = new SchSystem.BLL.SchClassUser(); SchSystem.Model.SchClassUser classusermodel; classuserbll.DeleteUserSub("ClassId=" + Com.Public.SqlEncStr(classid)); tagsusers = tagsusers.Replace("u_", "");//UID,UTNAME,SUB,ISMS string[] uss = tagsusers.Split('|'); if (uss.Length > 0) { foreach (string item in uss) { string[] its = item.Split(','); if (its.Length == 4) { classusermodel = new SchSystem.Model.SchClassUser(); classusermodel.ClassId = int.Parse(classid); classusermodel.LastRecTime = DateTime.Now; classusermodel.SchId = int.Parse(schid); classusermodel.LastRecUser = Com.SoureSession.Soureuserid; classusermodel.RecTime = DateTime.Now; classusermodel.RecUser = Com.SoureSession.Soureuserid; classusermodel.UserName = its[0]; classusermodel.SubCode = its[1]; classusermodel.UserTname = its[2]; classusermodel.IsMs = int.Parse(its[3]); classuserbll.Add(classusermodel); } } } 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 classsave(string dotype, string schid, string gradecode, string classid, string classname, string tagsusers) { dotype = Com.Public.SqlEncStr(dotype); schid = Com.Public.SqlEncStr(schid); gradecode = Com.Public.SqlEncStr(gradecode); classid = Com.Public.SqlEncStr(classid); classname = Com.Public.SqlEncStr(classname); tagsusers = Com.Public.SqlEncStr(tagsusers); /* * //手机号码验证 * string PatternPhone = @"^(?:13|15\d|15[89])-?\d{5}(\d{3}|\*{3})$"; * bool ResultPhone = Regex.IsMatch(classname, PatternPhone); * if (ResultPhone != true) * { * return "手机号码(格式:15153585510)或固定电话(格式:0531-1234678)格式不正确"; * } */ //字符串匹配验证 string PatternStr = @"^[\u4e00-\u9fa5]+$"; bool resultStr = Regex.IsMatch(classname, PatternStr); if (resultStr != true) { return("只能输入中文名称"); } string ret = ""; try { if (!Com.Public.IsOne(Com.Session.userrolestr, 12)) { return(ret = "无操作权限"); } if (!Com.Public.isVa(schid, "")) { return(ret = "无跨界权限"); } if (schid == Com.Public.getKey("adminschid")) { ret = "此为系统学校,不允许操作"; } else if (string.IsNullOrEmpty(schid) || schid == "0") { ret += "非法的学校!"; } SchSystem.BLL.SchClassInfo classbll = new SchSystem.BLL.SchClassInfo(); SchSystem.Model.SchClassInfo classmodel = new SchSystem.Model.SchClassInfo(); classmodel.LastRecTime = DateTime.Now; classmodel.LastRecUser = Com.Session.userid; classmodel.GradeCode = gradecode; classmodel.ClassName = classname; //判断编号及账号是否有重复,生成密码加密 if (dotype == "e") { /*if (userbll.ExistsUserCode(int.Parse(userid), usercode, int.Parse(schid))) * { * ret += "用户编号重复!"; * }*/ } if (dotype == "a") { /*if (userbll.ExistsUserCode(0, usercode, int.Parse(schid))) * { * ret += "用户编号重复!"; * } * if (userbll.ExistsUserCode(0, username, int.Parse(schid))) * { * ret += "账号重复!"; * }*/ } if (ret == "") { if (dotype == "e") { classmodel.ClassId = int.Parse(classid); classbll.Update(classmodel); } if (dotype == "a") { //usermodel.PassWord = SchManagerInfoSystem.Common.DESEncrypt.Encrypt(userpw); classmodel.RecTime = DateTime.Now; classmodel.RecUser = Com.Session.userid; classmodel.IsFinish = 0; classmodel.SchId = int.Parse(schid); classid = classbll.Add(classmodel).ToString(); } //清除关联的老师,再添加或更新关联老师 SchSystem.BLL.SchClassUser classuserbll = new SchSystem.BLL.SchClassUser(); SchSystem.Model.SchClassUser classusermodel; classuserbll.DeleteUserSub("ClassId=" + Com.Public.SqlEncStr(classid)); tagsusers = tagsusers.Replace("u_", "");//UID,UTNAME,SUB,ISMS string[] uss = tagsusers.Split('|'); if (uss.Length > 0) { foreach (string item in uss) { string[] its = item.Split(','); if (its.Length == 4) { classusermodel = new SchSystem.Model.SchClassUser(); classusermodel.ClassId = int.Parse(classid); classusermodel.IsMs = int.Parse(its[3]); classusermodel.LastRecTime = DateTime.Now; classusermodel.LastRecUser = Com.Session.userid; classusermodel.RecTime = DateTime.Now; classusermodel.RecUser = Com.Session.userid; classusermodel.UserName = its[0]; classusermodel.UserTname = its[1]; classusermodel.SubCode = its[2]; classusermodel.SchId = int.Parse(schid); classuserbll.Add(classusermodel); } } } ret = "success"; } } catch (Exception ex) { ret = ex.Message; } return(ret); }
public static string page(string txtname, string ustat, string cotycode, string schid, string gradeCode, string classid, string subcode) { string ret = ""; if (Com.Session.userid == null) { ret = "expire"; } else { SchSystem.BLL.SchClassInfo sciBll = new SchSystem.BLL.SchClassInfo(); //Stat:0废弃,1正常,2被删除,正常界面不显示删除,超管界面可以考虑 string strwhere = "ClassStat=0 and SchId = '" + Com.Public.SqlEncStr(schid) + "'"; if (!string.IsNullOrEmpty(ustat)) { strwhere += " and IsFinish=" + Com.Public.SqlEncStr(ustat); } else { strwhere += " and IsFinish=0"; } if (!string.IsNullOrEmpty(gradeCode)) { strwhere += " and GradeId='" + Com.Public.SqlEncStr(gradeCode) + "'"; } if (!string.IsNullOrEmpty(classid)) { strwhere += " and ClassId='" + Com.Public.SqlEncStr(classid) + "'"; } if (!string.IsNullOrEmpty(subcode) && !string.IsNullOrEmpty(txtname)) { strwhere += " and ClassId in (select ClassId from SchClassUser where SubCode='" + Com.Public.SqlEncStr(subcode) + "' and schid='" + Com.Public.SqlEncStr(schid) + "' and UserTname like '%" + Com.Public.SqlEncStr(txtname) + "%')"; } else if (!string.IsNullOrEmpty(txtname) || !string.IsNullOrEmpty(subcode)) { if (!string.IsNullOrEmpty(txtname)) { strwhere += " and ClassId in (select ClassId from SchClassUser where UserTname like '%" + Com.Public.SqlEncStr(txtname) + "%' and schid='" + Com.Public.SqlEncStr(schid) + "')"; } else { strwhere += " and ClassId in (select ClassId from SchClassUser where SubCode='" + Com.Public.SqlEncStr(subcode) + "' and schid='" + Com.Public.SqlEncStr(schid) + "')"; } } 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.GetListV(strwhere + " order by GradeCode,ClassName").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(); string sqlstr = ""; string sqlstrn = ""; if (!string.IsNullOrEmpty(txtname)) { sqlstrn = " UserTname like '%" + Com.Public.SqlEncStr(txtname) + "%'"; } string sqlstrs = ""; if (!string.IsNullOrEmpty(subcode)) { sqlstrs = " SubCode='" + Com.Public.SqlEncStr(subcode) + "'"; } if (sqlstrn != "" && sqlstrs != "") { sqlstr = " and ( " + sqlstrn + " or " + sqlstrs + ")"; } else if (sqlstrn != "" || sqlstrs != "") { sqlstr = " and " + sqlstrn + sqlstrs; } 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(); string sss = scuBLL.GetNames("ClassId='" + ClassId + "'and IsMs=1"); //班级教师(班主任) ClassDt.Rows[i]["TeacherClass"] = scuBLL.GetNames("ClassId='" + ClassId + "' and IsMs=1 " + sqlstr); //任课老师 ClassDt.Rows[i]["TeacherSub"] = scuBLL.GetNames("ClassId='" + ClassId + "' and IsMs=0 " + sqlstr); } //pages.list = ClassDt; } ret = Newtonsoft.Json.JsonConvert.SerializeObject(ClassDt); } return(ret); }
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 udel(string type, string schid, string gradeid, string classid) { schid = Com.Public.SqlEncStr(schid); gradeid = Com.Public.SqlEncStr(gradeid); classid = Com.Public.SqlEncStr(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 { try { if (!Com.Public.isVa(schid, "")) { return(ret = "无跨界权限"); } if (schid == Com.Public.getKey("adminschid")) { ret = "此为系统学校,不允许操作"; } else { if (type == "1")//删除年级 { SchSystem.BLL.SchGradeInfo bll = new SchSystem.BLL.SchGradeInfo(); SchSystem.Model.SchGradeInfo model = new SchSystem.Model.SchGradeInfo(); model.GradeId = int.Parse(gradeid); model.IsFinish = 2; model.LastRecTime = DateTime.Now; model.LastRecUser = Com.SoureSession.Soureuserid; if (bll.UpdateStat(model)) { ret = "success"; } else { ret = "操作失败"; } } else if (type == "0")//删除班级 { SchSystem.BLL.SchClassInfo classbll = new SchSystem.BLL.SchClassInfo(); bool resultBool = classbll.ExistsClassStuData(int.Parse(classid)); SchSystem.BLL.SchClassUser classuserbll = new SchSystem.BLL.SchClassUser(); bool resultBoolUser = classuserbll.ExistsClassUser(schid, classid); if (resultBool || resultBoolUser)//如果为true说明是班级内有属性数据 { ret = "success01"; } else//否则即可删除班级记录 { SchSystem.Model.SchClassInfo classmodel = new SchSystem.Model.SchClassInfo(); classmodel.ClassId = int.Parse(classid); classmodel.IsFinish = 2; classmodel.LastRecTime = DateTime.Now; classmodel.LastRecUser = Com.SoureSession.Soureuserid; if (classbll.UpdateStat(classmodel)) { SchSystem.BLL.SchClassUser scuBll = new SchSystem.BLL.SchClassUser(); // bool ecu = scuBll.ExistsClassUser(int.Parse(schid), int.Parse(classid)); bool scubool = scuBll.Delete(classid, schid); //if (scubool) // { 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()); 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 classsave(string dotype, string schid, string gradecode, string classid, string classname, string tagsusers) { dotype = Com.Public.SqlEncStr(dotype); schid = Com.Public.SqlEncStr(schid); gradecode = Com.Public.SqlEncStr(gradecode); classid = Com.Public.SqlEncStr(classid); classname = Com.Public.SqlEncStr(classname); tagsusers = Com.Public.SqlEncStr(tagsusers); string ret = ""; try { if (!Com.Public.IsOne(Com.Session.userrolestr, 12)) { return(ret = "无操作权限"); } if (!Com.Public.isVa(schid, "")) { return(ret = "无跨界权限"); } if (schid == Com.Public.getKey("adminschid")) { ret = "此为系统学校,不允许操作"; } else if (string.IsNullOrEmpty(schid) || schid == "0") { ret += "非法的学校!"; } SchSystem.BLL.SchClassInfo classbll = new SchSystem.BLL.SchClassInfo(); SchSystem.Model.SchClassInfo classmodel = new SchSystem.Model.SchClassInfo(); classmodel.LastRecTime = DateTime.Now; classmodel.LastRecUser = Com.Session.userid; classmodel.GradeCode = gradecode; classmodel.ClassName = classname; //判断编号及账号是否有重复,生成密码加密 if (dotype == "e") { /*if (userbll.ExistsUserCode(int.Parse(userid), usercode, int.Parse(schid))) * { * ret += "用户编号重复!"; * }*/ } if (dotype == "a") { /*if (userbll.ExistsUserCode(0, usercode, int.Parse(schid))) * { * ret += "用户编号重复!"; * } * if (userbll.ExistsUserCode(0, username, int.Parse(schid))) * { * ret += "账号重复!"; * }*/ } if (ret == "") { if (dotype == "e") { classmodel.ClassId = int.Parse(classid); classbll.Update(classmodel); } if (dotype == "a") { //usermodel.PassWord = SchManagerInfoSystem.Common.DESEncrypt.Encrypt(userpw); classmodel.RecTime = DateTime.Now; classmodel.RecUser = Com.Session.userid; classmodel.IsFinish = 0; classmodel.SchId = int.Parse(schid); classid = classbll.Add(classmodel).ToString(); } //清除关联的老师,再添加或更新关联老师 SchSystem.BLL.SchClassUser classuserbll = new SchSystem.BLL.SchClassUser(); SchSystem.Model.SchClassUser classusermodel; classuserbll.DeleteUserSub("ClassId=" + Com.Public.SqlEncStr(classid)); tagsusers = tagsusers.Replace("u_", "");//UID,UTNAME,SUB,ISMS string[] uss = tagsusers.Split('|'); if (uss.Length > 0) { foreach (string item in uss) { string[] its = item.Split(','); if (its.Length == 4) { classusermodel = new SchSystem.Model.SchClassUser(); classusermodel.ClassId = int.Parse(classid); classusermodel.LastRecTime = DateTime.Now; classusermodel.LastRecUser = Com.Session.userid; classusermodel.RecTime = DateTime.Now; classusermodel.RecUser = Com.Session.userid; classusermodel.UserName = its[0]; classusermodel.SubCode = its[1]; classusermodel.UserTname = its[2]; classusermodel.IsMs = int.Parse(its[3]); classusermodel.SchId = int.Parse(schid); classuserbll.Add(classusermodel); } } } ret = "success"; } } catch (Exception ex) { ret = ex.Message; } return(ret); }
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 static string page(string txtname, string ustat, string cotycode, string schid, string gradeCode, string classid, string subcode) { 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 sciBll = new SchSystem.BLL.SchClassInfo(); //Stat:0废弃,1正常,2被删除,正常界面不显示删除,超管界面可以考虑 string strwhere = "ClassStat=0 and SchId = '" + Com.Public.SqlEncStr(schid) + "'"; if (!string.IsNullOrEmpty(ustat)) { strwhere += " and IsFinish=" + Com.Public.SqlEncStr(ustat); } else { strwhere += " and IsFinish=0"; } if (!string.IsNullOrEmpty(gradeCode)) { strwhere += " and GradeId='" + Com.Public.SqlEncStr(gradeCode) + "'"; } if (!string.IsNullOrEmpty(classid)) { strwhere += " and ClassId='" + Com.Public.SqlEncStr(classid) + "'"; } if (!string.IsNullOrEmpty(subcode)) { strwhere += " and ClassId in (select ClassId from SchClassUser where SubCode='" + Com.Public.SqlEncStr(subcode) + "' and schid='" + Com.Public.SqlEncStr(schid) + "')"; } if (!string.IsNullOrEmpty(txtname)) { strwhere += " and ClassId in (select ClassId from SchClassUser where UserTname like '%" + Com.Public.SqlEncStr(txtname) + "%' and schid='" + Com.Public.SqlEncStr(schid) + "')"; } 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.GetListV(strwhere + " order by GradeCode,ClassName").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 IsMs=1"); //任课老师 ClassDt.Rows[i]["TeacherSub"] = scuBLL.GetNames("ClassId='" + ClassId + "' and IsMs=0"); } //pages.list = ClassDt; } //Newtonsoft.Json.JsonConvert(); //string ddd = Newtonsoft.Json.JsonConvert.SerializeObject(pages); //string ddd = Newtonsoft.Json.JsonConvert.SerializeObject(ClassDt); ret = Newtonsoft.Json.JsonConvert.SerializeObject(ClassDt); } return(ret); }
/// <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()); }
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()); }
public static string udel(string type, string schid, string gradeid, string classid) { schid = Com.Public.SqlEncStr(schid); gradeid = Com.Public.SqlEncStr(gradeid); classid = Com.Public.SqlEncStr(classid); string ret = ""; try { if (!Com.Public.IsOne(Com.Session.userrolestr, 13)) { return(ret = "无操作权限"); } if (!Com.Public.isVa(schid, "")) { return(ret = "无跨界权限"); } if (schid == Com.Public.getKey("adminschid")) { ret = "此为系统学校,不允许操作"; } else { if (type == "1")//删除年级 { SchSystem.BLL.SchGradeInfo bll = new SchSystem.BLL.SchGradeInfo(); SchSystem.Model.SchGradeInfo model = new SchSystem.Model.SchGradeInfo(); model.GradeId = int.Parse(gradeid); model.IsFinish = 2; model.LastRecTime = DateTime.Now; model.LastRecUser = Com.Session.userid; if (bll.UpdateStat(model)) { ret = "success"; } else { ret = "操作失败"; } } else if (type == "0")//删除班级 { SchSystem.BLL.SchClassInfo classbll = new SchSystem.BLL.SchClassInfo(); SchSystem.Model.SchClassInfo classmodel = new SchSystem.Model.SchClassInfo(); classmodel.ClassId = int.Parse(classid); classmodel.IsFinish = 2; classmodel.LastRecTime = DateTime.Now; classmodel.LastRecUser = Com.Session.userid; if (classbll.UpdateStat(classmodel)) { ret = "success"; } else { ret = "操作失败"; } } } } catch (Exception ex) { ret = ex.Message; } return(ret); }