public SchSystem.Model.ServFunc GetServFuncModel(string AutoId) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 AutoId,FuncName,FuncCode,TypeCode,FuncRange,FuncSet,FuncNote,FuncSyss,FuncDes from ServFunc "); strSql.Append(" where AutoId=@AutoId"); SqlParameter[] parameters = { new SqlParameter("@AutoId", SqlDbType.Int, 6) }; parameters[0].Value = AutoId; SchSystem.Model.SchInfo model = new SchSystem.Model.SchInfo(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public SchSystem.Model.SchInfo GetModel(int SchId) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 SchId,SchNo,SchName,SchType,AreaNo,SchMaster,SchYear,SchAddr,SchTel,SchLv,IsCity,RecTime,RecUser,LastRecTime,LastRecUser,Stat from SchInfo "); strSql.Append(" where SchId=@SchId "); SqlParameter[] parameters = { new SqlParameter("@SchId", SqlDbType.Int, 4) }; parameters[0].Value = SchId; SchSystem.Model.SchInfo model = new SchSystem.Model.SchInfo(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
public string umodelstr = "1"; //学校model protected void Page_Load(object sender, EventArgs e) { //先得到操作类型 SchSystem.BLL.SchInfo schbll = new SchSystem.BLL.SchInfo(); SchSystem.Model.SchInfo usermodel = new SchSystem.Model.SchInfo(); dotype = Request.Params["dotype"].ToString(); if (dotype == "e") //修改,不能修改用户的类型及学校参数 { schid = Request.Params["schid"].ToString(); if (string.IsNullOrEmpty(schid)) { Response.Write("无对应修改的记录!"); Response.End(); } //获取修改的对应用户的 usermodel = schbll.GetSupportModel(int.Parse(schid)); if (usermodel != null && usermodel.SchId > 0) { if (usermodel.SchSonSysEndDateTime == null) { usermodel.SchSonSysEndDateTime = DateTime.Parse("2100-1-1"); } umodelstr = Newtonsoft.Json.JsonConvert.SerializeObject(usermodel); } else { Response.Write("无该学校!"); Response.End(); } } else //不在添加及修改之内,则返回 { Response.Write("没有可供确认的操作类型!"); Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { usertname = Com.Session.uname; if (Com.Session.systype == "2") { returl = "<div class=\"nav-search\" id=\"nav-search\"><a class=\"btn btn-danger btn-sm pull-right\" href=\"javascript:window.history.go(-1);\"><i class=\"icon-reply icon-only\"></i></a></div>"; } if (!IsPostBack) { if (Com.Session.systype != "2") { systype = Com.Session.systype; } //先得到操作类型 SchSystem.BLL.SchInfo schbll = new SchSystem.BLL.SchInfo(); SchSystem.Model.SchInfo usermodel = new SchSystem.Model.SchInfo(); dotype = Request.Params["dotype"].ToString(); if (dotype == "a")//添加 { } else if (dotype == "e")//修改,不能修改用户的类型及学校参数 { btnname = "修改"; schid = Request.Params["schid"].ToString(); //判断跨界操作的可能性 if (!Com.Public.isVa(schid, "")) { Response.Write("出错,用户非法跨界操作!"); Response.End(); } if (string.IsNullOrEmpty(schid)) { Response.Write("无对应修改的记录!"); Response.End(); } //获取修改的对应用户的 usermodel = schbll.GetModel(int.Parse(schid)); if (usermodel != null && usermodel.SchId > 0) { umodelstr = Newtonsoft.Json.JsonConvert.SerializeObject(usermodel); } else { Response.Write("无该学校!"); Response.End(); } if (Com.Session.systype != "2") { btnname = "开始编辑"; } } else//不在添加及修改之内,则返回 { Response.Write("没有可供确认的操作类型!"); Response.End(); } if (!string.IsNullOrEmpty(schid)) { //系统科目 SchSystem.BLL.SysSub syssubbll = new SchSystem.BLL.SysSub(); DataTable dtsub = syssubbll.GetList("'0' pId,SubCode id,SubName name,'false' checked", "Stat=1 Order by SubCode").Tables[0];//Stat=1 //获取学校的sub SchSystem.BLL.SchSub schsubbll = new SchSystem.BLL.SchSub(); DataTable dtschsub = schsubbll.GetList("'0' pId,SubCode id,SubName name,'false' checked", "Stat=1 and SchId=" + schid + " Order by SubCode").Tables[0]; if (dtsub != null && dtschsub != null && dtsub.Rows.Count > 0 && dtschsub.Rows.Count > 0) { for (int i = 0; i < dtsub.Rows.Count; i++) { DataRow[] drs = dtschsub.Select("id='" + dtsub.Rows[i]["id"].ToString() + "'"); if (drs.Length > 0) { dtsub.Rows[i]["checked"] = "true"; } } } subs = Newtonsoft.Json.JsonConvert.SerializeObject(dtsub); schsubs = Newtonsoft.Json.JsonConvert.SerializeObject(dtschsub); //获取整个系统的年级 SchSystem.BLL.SysGrade sysgradebll = new SchSystem.BLL.SysGrade(); DataTable dtgrade = sysgradebll.GetList("GradeType pId,GradeCode id,GradeName name,'false' checked,'false' nochecks", " 1=1 Order by GradeType,GradeLv").Tables[0]; //获取学校的sub SchSystem.BLL.SchGradeInfo schgradebll = new SchSystem.BLL.SchGradeInfo(); DataTable dtschgrade = schgradebll.GetList("GradeCode id", "isfinish='0' and SchId='" + schid + "'").Tables[0]; if (dtgrade != null && dtschgrade != null && dtgrade.Rows.Count > 0 && dtschgrade.Rows.Count > 0) { for (int i = 0; i < dtgrade.Rows.Count; i++) { DataRow[] drs = dtschgrade.Select("id='" + dtgrade.Rows[i]["id"].ToString() + "'"); if (drs.Length > 0) { dtgrade.Rows[i]["checked"] = "true"; } } } dtgrade.Columns["nochecks"].ColumnName = "nocheck"; DataRow dry = dtgrade.NewRow(); dry["pId"] = "0"; dry["id"] = "1"; dry["name"] = "幼儿园"; dry["nocheck"] = "false"; DataRow[] drs1 = dtgrade.Select("pId='1' and checked='false'"); if (drs1.Length == 0) { dry["checked"] = "true"; } dtgrade.Rows.Add(dry); dry = dtgrade.NewRow(); dry["pId"] = "0"; dry["id"] = "2"; dry["name"] = "小学"; dry["nocheck"] = "false"; DataRow[] drs2 = dtgrade.Select("pId='2' and checked='false'"); if (drs2.Length == 0) { dry["checked"] = "true"; } dtgrade.Rows.Add(dry); dry = dtgrade.NewRow(); dry["pId"] = "0"; dry["id"] = "3"; dry["name"] = "初中"; dry["nocheck"] = "false"; DataRow[] drs3 = dtgrade.Select("pId='3' and checked='false'"); if (drs3.Length == 0) { dry["checked"] = "true"; } dtgrade.Rows.Add(dry); dry = dtgrade.NewRow(); dry["pId"] = "0"; dry["id"] = "4"; dry["name"] = "高中"; dry["nocheck"] = "false"; DataRow[] drs4 = dtgrade.Select("pId='4' and checked='false'"); if (drs4.Length == 0) { dry["checked"] = "true"; } dtgrade.Rows.Add(dry); grades = Newtonsoft.Json.JsonConvert.SerializeObject(dtgrade); //获取下拉列表 StringBuilder sbarea = new StringBuilder(); //获取省份 sbarea.Append("<select id=\"aprov\">"); string sareacode = ""; if (usermodel != null && usermodel.SchId > 0 && usermodel.AreaNo.Length == 6) { sareacode = usermodel.AreaNo.Substring(0, 2) + "0000"; } sbarea.Append(Com.Public.GetDrpArea("0", "", ref sareacode, false)); sbarea.Append("</select>"); //获取城市 sbarea.Append("<select id=\"acity\">"); string sareacitycode = ""; if (usermodel != null && usermodel.SchId > 0 && usermodel.AreaNo.Length == 6) { sareacitycode = usermodel.AreaNo.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 (usermodel != null && usermodel.SchId > 0 && usermodel.AreaNo.Length == 6) { sareacotycode = usermodel.AreaNo; } sbarea.Append(Com.Public.GetDrpArea("2", sareacitycode, ref sareacotycode, false)); sbarea.Append("</select>"); areastr = sbarea.ToString(); } } }
public static string schsave(string dotype, string schid, string schname, string schaddr, string schmaster, string schmasterpst, string schmastertel, string iscity, string schstat, string selgrades, string selsubs, string areano, string schnote) { string ret = ""; if (Com.Session.userid == null) { ret = "expire"; } else { try { //学校名不能为空, if (string.IsNullOrEmpty(schname)) { ret += "学校名称不能为空!"; } if (!Com.Public.isVa(schid, "")) { ret += "无跨界权限;"; } if (ret == "") { SchSystem.BLL.SchInfo schbll = new SchSystem.BLL.SchInfo(); SchSystem.Model.SchInfo schmodel = new SchSystem.Model.SchInfo(); schmodel.LastRecTime = DateTime.Now; schmodel.LastRecUser = Com.Session.userid; schmodel.SchAddr = schaddr; schmodel.SchMaster = schmaster; schmodel.MasterPostion = schmasterpst; schmodel.SchName = schname; schmodel.SchTel = schmastertel; schmodel.IsCity = int.Parse(iscity); schmodel.Stat = int.Parse(schstat); schmodel.AreaNo = areano; schmodel.SchNote = schnote; if (dotype == "e") { schmodel.SchId = int.Parse(schid); schbll.UpdateSch(schmodel); } if (dotype == "a") { schmodel.RecTime = DateTime.Now; schmodel.RecUser = Com.Session.userid; schid = schbll.Add(schmodel).ToString(); } if (int.Parse(schid) > 0) { //添加年级及科目 SchSystem.BLL.SchGradeInfo gradebll = new SchSystem.BLL.SchGradeInfo(); gradebll.DoSchGrades(Com.Session.userid, schid, selgrades); //添加科目 SchSystem.BLL.SchSub subbll = new SchSystem.BLL.SchSub(); subbll.DoSchSubs(Com.Session.userid, schid, selsubs); } ret = "success"; } } catch (Exception ex) { ret = ex.Message; } } return(ret); }
protected void Page_Load(object sender, EventArgs e) { if (Request.Params["schid"] != null && Request.Params["schid"].ToString() != "") { string schid = Com.Public.SqlEncStr(Request.Params["schid"].ToString()); //先得到操作类型 SchSystem.BLL.SchInfo schbll = new SchSystem.BLL.SchInfo(); SchSystem.Model.SchInfo usermodel = new SchSystem.Model.SchInfo(); if (string.IsNullOrEmpty(schid)) { Response.Write("无对应修改的记录!"); Response.End(); } //获取修改的对应用户的 usermodel = schbll.GetSupportModel(int.Parse(schid)); if (usermodel != null && usermodel.SchId > 0) { umodelstr = Newtonsoft.Json.JsonConvert.SerializeObject(usermodel); } else { Response.Write("无该学校!"); Response.End(); } if (!string.IsNullOrEmpty(schid)) { //获取管理员账号密码信息 SchSystem.BLL.SchUserInfo suiBll = new SchSystem.BLL.SchUserInfo(); SchSystem.Model.SchUserInfo modeluserinfo = suiBll.GetSupportModel(int.Parse(schid), 1); if (modeluserinfo != null) { if (modeluserinfo.PassWord == Com.Public.StrToMD5("123456")) { modeluserinfo.PassWord = "******"; } } usermanagerstr = Newtonsoft.Json.JsonConvert.SerializeObject(modeluserinfo); //系统科目 SchSystem.BLL.SysSub syssubbll = new SchSystem.BLL.SysSub(); DataTable dtsub = syssubbll.GetList("'0' pId,SubCode id,SubName name,'false' checked", "1=1 Order by SubCode").Tables[0];//Stat=1 //获取学校的sub SchSystem.BLL.SchSub schsubbll = new SchSystem.BLL.SchSub(); DataTable dtschsub = schsubbll.GetList("'0' pId,SubCode id,SubName name,'false' checked", "Stat=1 and SchId='" + schid + "' Order by SubCode").Tables[0]; DataTable dtsubmat = dtsub.Copy(); if (dtsub != null && dtschsub != null && dtsub.Rows.Count > 0 && dtschsub.Rows.Count > 0) { for (int i = 0; i < dtsub.Rows.Count; i++) { DataRow[] drs = dtschsub.Select("id='" + dtsub.Rows[i]["id"].ToString() + "'"); if (drs.Length > 0) { dtsub.Rows[i]["checked"] = "true"; } } } subs = Newtonsoft.Json.JsonConvert.SerializeObject(dtsub); subsmat = Newtonsoft.Json.JsonConvert.SerializeObject(dtsubmat); //获取子系统:AutoId,AppCode,AppName,Stat,RecTime,RecUser,LastRecTime,LastRecUser SchSystem.BLL.SchApp schappBll = new SchSystem.BLL.SchApp(); DataTable dtschapp = schappBll.GetList("'0' pId,AutoId id,AppName name,'false' checked,AppCode", "").Tables[0]; SchSystem.BLL.SchAppRole schapproleBll = new SchSystem.BLL.SchAppRole(); DataTable dtschapprole = schapproleBll.GetList("SchId='" + schid + "'").Tables[0]; if (dtschapp.Rows.Count > 0) { for (int i = 0; i < dtschapp.Rows.Count; i++) { DataRow[] drstr = dtschapprole.Select(); if (drstr.Length > 0) { string approlestr = drstr[0]["AppStr"].ToString(); string[] approlearr = approlestr.Split(','); int approlearrlen = approlearr.Length; for (int j = 0; j < approlearrlen; j++) { if (dtschapp.Rows[i]["AppCode"].ToString() == approlearr[j]) { dtschapp.Rows[i]["checked"] = "true"; } } } } } sonsys = Newtonsoft.Json.JsonConvert.SerializeObject(dtschapp); //获取整个系统的年级 SchSystem.BLL.SysGrade sysgradebll = new SchSystem.BLL.SysGrade(); DataTable dtgrade = sysgradebll.GetList("GradeType pId,GradeCode id,GradeName name,'false' checked,'false' nochecks,'0' IsFinish,'' GradeYear,'' GradeId", " GradeCode<>'3004' and GradeCode<>'4004' Order by GradeType,GradeLv").Tables[0]; #region 家校互通平台子模块 SchSystem.BLL.SchAppXXT saxxtBll = new SchSystem.BLL.SchAppXXT(); DataTable dtsaxxt = saxxtBll.GetList("'0' pId,AppCode id,AppName name,'false' checked,'false' isShar", "Stat=1").Tables[0]; SchSystem.BLL.SchAppRoleXXT sarxxtBll = new SchSystem.BLL.SchAppRoleXXT(); DataTable dtsarxxt = sarxxtBll.GetList("SchId='" + schid + "'").Tables[0]; DataRow[] drsarxxt = dtsarxxt.Select(); string[] approlexxtarr = { }; if (drsarxxt.Length > 0) { approlexxtarr = drsarxxt[0]["AppStr"].ToString().Split(','); if (dtsaxxt.Rows.Count > 0) { for (int i = 0; i < dtsaxxt.Rows.Count; i++) { for (int j = 0; j < approlexxtarr.Length; j++) { if (dtsaxxt.Rows[i]["id"].ToString() == approlexxtarr[j].ToString()) { dtsaxxt.Rows[i]["checked"] = "true"; } } } } } sarxxttree = Newtonsoft.Json.JsonConvert.SerializeObject(dtsaxxt); #endregion //家校互通平台学段、科目教版 SchSystem.BLL.SchPerSubMatXXT spsmxxtBll = new SchSystem.BLL.SchPerSubMatXXT(); DataTable dtspsmxxt = spsmxxtBll.SchPerSubMatXXTV("SchId='" + schid + "' Order by convert(int,PerCode) asc").Tables[0]; showmaterxxttree = Newtonsoft.Json.JsonConvert.SerializeObject(dtspsmxxt); //获取学校的年级 SchSystem.BLL.SchGradeInfo schgradebll = new SchSystem.BLL.SchGradeInfo(); DataTable dtschgrade = schgradebll.GetList("GradeCode id,GradeYear,GradeId", "isfinish='0' and SchId='" + schid + "'").Tables[0]; dtgrade.Columns["nochecks"].ColumnName = "nocheck"; DataRow dry = dtgrade.NewRow(); dry["pId"] = "0"; dry["id"] = "1"; dry["name"] = "幼儿园"; dry["nocheck"] = "false"; dry["IsFinish"] = "0"; dtgrade.Rows.Add(dry); dry = dtgrade.NewRow(); dry["pId"] = "0"; dry["id"] = "2"; dry["name"] = "小学"; dry["nocheck"] = "false"; dry["IsFinish"] = "0"; dtgrade.Rows.Add(dry); dry = dtgrade.NewRow(); dry["pId"] = "0"; dry["id"] = "3"; dry["name"] = "初中"; dry["nocheck"] = "false"; dry["IsFinish"] = "0"; dtgrade.Rows.Add(dry); dry = dtgrade.NewRow(); dry["pId"] = "0"; dry["id"] = "4"; dry["name"] = "高中"; dry["nocheck"] = "false"; dry["IsFinish"] = "0"; dtgrade.Rows.Add(dry); if (dtgrade != null && dtschgrade != null && dtgrade.Rows.Count > 0 && dtschgrade.Rows.Count > 0) //系统年级和学校年级不等于null { for (int i = 0; i < dtgrade.Rows.Count; i++) //遍历实体年级行数 { DataRow[] drs = dtschgrade.Select("id='" + dtgrade.Rows[i]["id"].ToString() + "'"); //根据系统年级id查询学校年级 if (drs.Length > 0) { dtgrade.Rows[i]["checked"] = "true"; dtgrade.Rows[i]["GradeYear"] = drs[0]["GradeYear"]; dtgrade.Rows[i]["GradeId"] = drs[0]["GradeId"]; } } } //獲取畢業年級的年級名稱和入學年份 //DataTable dtres = schgradebll.GetListGradeFinish("GradeCode,GradeName,GradeYear", int.Parse(schid), int.Parse(CurrentYear)).Tables[0]; DataTable dtres = schgradebll.Graduated(int.Parse(schid)).Tables[0]; updateGrade = Newtonsoft.Json.JsonConvert.SerializeObject(dtres); //获取服务资源:AutoId,AppCode,AppName,Stat,RecTime,RecUser,LastRecTime,LastRecUser #region 获取服务资源 SchSystem.BLL.SchAppSoure schappsoureBll = new SchSystem.BLL.SchAppSoure(); DataTable dtschappsoure = schappsoureBll.GetList("'0' pId,AppCode id,AppName name,'false' checked,'false' isShar", "Stat=1").Tables[0]; SchSystem.BLL.SchAppRoleSoure sarsBll = new SchSystem.BLL.SchAppRoleSoure(); DataTable dtsars = sarsBll.GetList("SchId='" + schid + "'").Tables[0]; DataRow[] drsarsstr = dtsars.Select(); string[] approlesourearr = { }; if (drsarsstr.Length > 0) { approlesourearr = drsarsstr[0]["AppCode"].ToString().Split('|'); } if (dtschappsoure.Rows.Count > 0) { for (int i = 0; i < dtschappsoure.Rows.Count; i++) { //dtschappsoure.Rows[i]["name"] = dtschappsoure.Rows[i]["name"] + "【不共享】"; for (int j = 0; j < approlesourearr.Length; j++) { if (approlesourearr[j].Split(',').Length > 1) { string appsourestr = approlesourearr[j].Split(',')[0]; string appsourestat = approlesourearr[j].Split(',')[1]; if (dtschappsoure.Rows[i]["id"].ToString() == appsourestr) { if (appsourestat == "1") { dtschappsoure.Rows[i]["name"] = dtschappsoure.Rows[i]["name"] + "【共享】"; //dtschappsoure.Rows[i]["isShar"] = "true"; } else if (appsourestat == "0") { dtschappsoure.Rows[i]["name"] = dtschappsoure.Rows[i]["name"] + "【不共享】"; //dtschappsoure.Rows[i]["isShar"] = "false"; } dtschappsoure.Rows[i]["checked"] = "true"; } } } if (dtschappsoure.Rows[i]["checked"].ToString() == "false") { dtschappsoure.Rows[i]["name"] = dtschappsoure.Rows[i]["name"] + "【不共享】"; //dtschappsoure.Rows[i]["isShar"] = "false"; } } } souretree = Newtonsoft.Json.JsonConvert.SerializeObject(dtschappsoure); #endregion //获取教版 SchSystem.BLL.SysMater smaterBll = new SchSystem.BLL.SysMater(); DataTable dtsmater = smaterBll.GetList("'0' pId,MaterCode id,MaterName name,'false' checked,'' subcodechk,MaterCode,'' PerCode,'' SubCode,'' SubName", "Stat=1").Tables[0]; SchSystem.BLL.SchPerSubMat spsmBll = new SchSystem.BLL.SchPerSubMat(); DataTable dtspsm = spsmBll.SchPerSubMatVMatSub("SchId='" + schid + "' Order by convert(int,PerCode) asc").Tables[0]; //if (dtsmater.Rows.Count > 0) //{ // for (int i = 0; i < dtsmater.Rows.Count; i++) // { // foreach (DataRow dr in dtspsm.Rows) // { // string ss = dtsmater.Rows[i]["MaterCode"].ToString(); // string sss = dr["MaterCode"].ToString(); // if (dtsmater.Rows[i]["MaterCode"].ToString() == dr["MaterCode"].ToString()) // { // dtsmater.Rows[i]["checked"] = "true"; // dtsmater.Rows[i]["PerCode"] = dr["PerCode"]; // dtsmater.Rows[i]["SubCode"] = dr["SubCode"]; // dtsmater.Rows[i]["SubName"] = dr["SubName"]; // } // } // } //} sysmatertree = Newtonsoft.Json.JsonConvert.SerializeObject(dtsmater); showmatertree = Newtonsoft.Json.JsonConvert.SerializeObject(dtspsm); grades = Newtonsoft.Json.JsonConvert.SerializeObject(dtgrade); //获取下拉列表 StringBuilder sbarea = new StringBuilder(); string[] areanames = Com.Public.GetArea(usermodel.AreaNo.ToString()).Split('|'); sbarea.Append(areanames[0]); sbarea.Append(areanames[1]); sbarea.Append(areanames[2]); areastr = sbarea.ToString(); } } }
/// <summary> /// 得到一个对象实体 /// </summary> public SchSystem.Model.SchInfo DataRowToModel(DataRow row) { SchSystem.Model.SchInfo model = new SchSystem.Model.SchInfo(); if (row != null) { if (row["SchId"] != null && row["SchId"].ToString() != "") { model.SchId = int.Parse(row["SchId"].ToString()); } if (row["SchNo"] != null) { model.SchNo = row["SchNo"].ToString(); } if (row["SchName"] != null) { model.SchName = row["SchName"].ToString(); } if (row["SchType"] != null && row["SchType"].ToString() != "") { model.SchType = int.Parse(row["SchType"].ToString()); } if (row["AreaNo"] != null) { model.AreaNo = row["AreaNo"].ToString(); } if (row["SchMaster"] != null) { model.SchMaster = row["SchMaster"].ToString(); } if (row["SchYear"] != null && row["SchYear"].ToString() != "") { model.SchYear = int.Parse(row["SchYear"].ToString()); } if (row["SchAddr"] != null) { model.SchAddr = row["SchAddr"].ToString(); } if (row["SchTel"] != null) { model.SchTel = row["SchTel"].ToString(); } if (row["SchLv"] != null && row["SchLv"].ToString() != "") { model.SchLv = int.Parse(row["SchLv"].ToString()); } if (row["IsCity"] != null && row["IsCity"].ToString() != "") { model.IsCity = int.Parse(row["IsCity"].ToString()); } if (row["RecTime"] != null && row["RecTime"].ToString() != "") { model.RecTime = DateTime.Parse(row["RecTime"].ToString()); } if (row["RecUser"] != null) { model.RecUser = row["RecUser"].ToString(); } if (row["LastRecTime"] != null && row["LastRecTime"].ToString() != "") { model.LastRecTime = DateTime.Parse(row["LastRecTime"].ToString()); } if (row["LastRecUser"] != null) { model.LastRecUser = row["LastRecUser"].ToString(); } if (row["Stat"] != null && row["Stat"].ToString() != "") { model.Stat = int.Parse(row["Stat"].ToString()); } } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(SchSystem.Model.SchInfo model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update SchInfo set "); strSql.Append("SchNo=@SchNo,"); strSql.Append("SchName=@SchName,"); strSql.Append("SchType=@SchType,"); strSql.Append("AreaNo=@AreaNo,"); strSql.Append("SchMaster=@SchMaster,"); strSql.Append("SchYear=@SchYear,"); strSql.Append("SchAddr=@SchAddr,"); strSql.Append("SchTel=@SchTel,"); strSql.Append("SchLv=@SchLv,"); strSql.Append("IsCity=@IsCity,"); strSql.Append("RecTime=@RecTime,"); strSql.Append("RecUser=@RecUser,"); strSql.Append("LastRecTime=@LastRecTime,"); strSql.Append("LastRecUser=@LastRecUser,"); strSql.Append("Stat=@Stat"); strSql.Append(" where SchId=@SchId "); SqlParameter[] parameters = { new SqlParameter("@SchNo", SqlDbType.VarChar, 10), new SqlParameter("@SchName", SqlDbType.VarChar, 50), new SqlParameter("@SchType", SqlDbType.SmallInt, 2), new SqlParameter("@AreaNo", SqlDbType.VarChar, 8), new SqlParameter("@SchMaster", SqlDbType.VarChar, 20), new SqlParameter("@SchYear", SqlDbType.TinyInt, 1), new SqlParameter("@SchAddr", SqlDbType.VarChar, 200), new SqlParameter("@SchTel", SqlDbType.VarChar, 20), new SqlParameter("@SchLv", SqlDbType.TinyInt, 1), new SqlParameter("@IsCity", SqlDbType.TinyInt, 1), new SqlParameter("@RecTime", SqlDbType.DateTime), new SqlParameter("@RecUser", SqlDbType.VarChar, 20), new SqlParameter("@LastRecTime", SqlDbType.DateTime), new SqlParameter("@LastRecUser", SqlDbType.VarChar, 20), new SqlParameter("@Stat", SqlDbType.TinyInt, 1), new SqlParameter("@SchId", SqlDbType.Int, 4) }; parameters[0].Value = model.SchNo; parameters[1].Value = model.SchName; parameters[2].Value = model.SchType; parameters[3].Value = model.AreaNo; parameters[4].Value = model.SchMaster; parameters[5].Value = model.SchYear; parameters[6].Value = model.SchAddr; parameters[7].Value = model.SchTel; parameters[8].Value = model.SchLv; parameters[9].Value = model.IsCity; parameters[10].Value = model.RecTime; parameters[11].Value = model.RecUser; parameters[12].Value = model.LastRecTime; parameters[13].Value = model.LastRecUser; parameters[14].Value = model.Stat; parameters[15].Value = model.SchId; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
//用户登录判断 public static string UserLoginDo(string uname, bool iscookies, string schid) { string str = ""; SchSystem.BLL.SchUserInfo userbll = new SchSystem.BLL.SchUserInfo(); //查询登录用户记录数据 DataTable SchUserInfoDs = userbll.GetList("UserId,UserName,UserTname,SchId,SysType,ImgUrl", "UserName='******' and Stat=1 and AccStat=1 and SchId=" + schid).Tables[0]; if (SchUserInfoDs.Rows.Count > 0) { SchSystem.BLL.SchUserRoleV userroleV = new SchSystem.BLL.SchUserRoleV(); DataTable dtroles = userroleV.GetList("UserName='******' and Stat=1 and AccStat=1 and SchId=" + schid).Tables[0]; //if (dtroles.Rows.Count > 0) //{ //设置Session信息 Com.Session.usertid = SchUserInfoDs.Rows[0]["UserId"].ToString(); Com.Session.userid = SchUserInfoDs.Rows[0]["UserName"].ToString(); Com.Session.uname = SchUserInfoDs.Rows[0]["UserTname"].ToString(); Com.Session.schid = SchUserInfoDs.Rows[0]["SchId"].ToString(); Com.Session.systype = SchUserInfoDs.Rows[0]["SysType"].ToString(); Com.Session.imgurl = SchUserInfoDs.Rows[0]["ImgUrl"].ToString(); //合并普通权限串 Com.Session.userrolestr = Com.Public.UserRoleStr(dtroles); //合并特殊权限串 Com.Session.userrolestrext = Com.Public.UserRoleExtStr(dtroles); Com.Session.ulogintime = DateTime.Now.ToString("yyyyMMddHHmmss"); //设置cookies if (iscookies) { CookieHelper.SetCookie("uname", uname, DateTime.Now.AddDays(7)); } //获取老师身份 if (Com.Session.usertp == "0") { string tectype = "0"; //1年级主任,2科任组长,3班主任,4科任老师 SchSystem.BLL.SchGradeUserV bllgrade = new SchSystem.BLL.SchGradeUserV(); if (bllgrade.Exists(Com.Session.usertid)) { tectype += ",1"; } SchSystem.BLL.SchUserSubV bllsub = new SchSystem.BLL.SchUserSubV(); if (bllsub.Exists(Com.Session.usertid)) { tectype += ",2"; } SchSystem.BLL.SchClassUser bllclasssub = new SchSystem.BLL.SchClassUser(); if (bllclasssub.ExistsV(0, 1, Com.Session.usertid, 1)) { tectype += ",3"; } if (bllclasssub.ExistsV(0, 1, Com.Session.usertid, 0)) { tectype += ",4"; } Com.Session.usertectp = tectype; } //获取该学校的系统编辑状态 SchSystem.BLL.SchInfo schbll = new SchSystem.BLL.SchInfo(); SchSystem.Model.SchInfo schmodel = schbll.GetModel(int.Parse(Com.Session.schid)); Com.Session.appeditstat = schmodel.SonSysStat.ToString(); str = "1"; //} // else // { // str = "该账号没有相应的权限或者对应角色被屏蔽,请联系管理员进行分配处理"; // } } else { str = "该账号被屏蔽或不存在"; } return(str); }
public string umodelsarstr = "1"; //学校资源模块 protected void Page_Load(object sender, EventArgs e) { //先得到操作类型 SchSystem.BLL.SchInfo schbll = new SchSystem.BLL.SchInfo(); SchSystem.Model.SchInfo usermodel = new SchSystem.Model.SchInfo(); dotype = Request.Params["dotype"].ToString(); if (dotype == "e")//修改,不能修改用户的类型及学校参数 { schid = Request.Params["schid"].ToString(); if (string.IsNullOrEmpty(schid)) { Response.Write("无对应修改的记录!"); Response.End(); } //获取修改的对应用户的 usermodel = schbll.GetSupportModel(int.Parse(schid)); if (usermodel != null && usermodel.SchId > 0) { umodelstr = Newtonsoft.Json.JsonConvert.SerializeObject(usermodel); // SchSystem.BLL.SchAppSoure sasBll = new SchSystem.BLL.SchAppSoure(); DataTable dtsar = sasBll.GetList("AppCode,AppName,'false' checked", "Stat=1").Tables[0]; if (dtsar.Rows.Count > 0) { dtsar.Columns.Add("UsharStat"); for (int j = 0; j < dtsar.Rows.Count; j++) { SchSystem.BLL.SchAppRoleSoure sarsBll = new SchSystem.BLL.SchAppRoleSoure(); DataTable dtsars = sarsBll.GetList("SchId='" + schid + "'").Tables[0]; if (dtsars.Rows.Count > 0) { string[] sarsarr = dtsars.Rows[0]["AppCode"].ToString().Split('|'); for (int i = 0; i < sarsarr.Length; i++) { int len = sarsarr[i].Split(',').Length; if (len > 1) { string issharstr = sarsarr[i].Split(',')[0]; string isshar = sarsarr[i].Split(',')[1]; //string sss = dtsar.Rows[j]["AppCode"].ToString(); if (isshar == "1" && issharstr == dtsar.Rows[j]["AppCode"].ToString()) { dtsar.Rows[j]["UsharStat"] = isshar; dtsar.Rows[j]["checked"] = "true"; } else if (dtsar.Rows[j]["AppCode"].ToString() == issharstr) { dtsar.Rows[j]["checked"] = "true"; } } } } } } umodelsarstr = Newtonsoft.Json.JsonConvert.SerializeObject(dtsar); // } else { Response.Write("无该学校!"); Response.End(); } } else//不在添加及修改之内,则返回 { Response.Write("没有可供确认的操作类型!"); Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { usertname = Com.Session.uname; //先得到操作类型 SchSystem.BLL.SchInfo schbll = new SchSystem.BLL.SchInfo(); SchSystem.Model.SchInfo usermodel = new SchSystem.Model.SchInfo(); SchSystem.BLL.SysSub syssubbll = new SchSystem.BLL.SysSub(); DataTable dtsub = syssubbll.GetList("'0' pId,SubCode id,SubName name,'false' checked", "Stat=1 Order by SubCode").Tables[0];//Stat=1 DataTable dtsubmat = dtsub.Copy(); //获取学校的sub SchSystem.BLL.SchSub schsubbll = new SchSystem.BLL.SchSub(); DataTable dtschsub = schsubbll.GetList("'0' pId,SubCode id,SubName name,'false' checked", "Stat=1 and SchId='" + schid + "' Order by SubCode").Tables[0]; subs = Newtonsoft.Json.JsonConvert.SerializeObject(dtsub); subsmat = Newtonsoft.Json.JsonConvert.SerializeObject(dtsubmat); treeNodekinderstr = Newtonsoft.Json.JsonConvert.SerializeObject(dtschsub); //获取子系统:AutoId,AppCode,AppName,Stat,RecTime,RecUser,LastRecTime,LastRecUser SchSystem.BLL.SchApp schappBll = new SchSystem.BLL.SchApp(); DataTable dtschapp = schappBll.GetList("'0' pId,AppCode id,AppName name,'false' checked,AppCode", "Stat=1 and AppCode not in (1,2)").Tables[0]; sonsys = Newtonsoft.Json.JsonConvert.SerializeObject(dtschapp); //获取整个系统的年级 SchSystem.BLL.SysGrade sysgradebll = new SchSystem.BLL.SysGrade(); DataTable dtgrade = sysgradebll.GetList("GradeType pId,GradeCode id,GradeName name,'false' checked,'false' nochecks,'0' IsFinish", " GradeCode<>'3004' and GradeCode<>'4004' Order by GradeType,GradeLv").Tables[0]; //获取学校类型 SchSystem.BLL.SysPer sysperbll = new SchSystem.BLL.SysPer(); DataTable dtper = sysperbll.GetList("PerName Name,PerCode ID", " Stat=1 Order by convert(int,PerCode)").Tables[0]; if (dtper.Rows.Count > 0) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < dtper.Rows.Count; i++) { if (dtper.Rows[i]["ID"].ToString() == percode) { sb.Append("<option value=\"" + dtper.Rows[i]["ID"].ToString() + "\" selected=\"selected\">" + dtper.Rows[i]["Name"].ToString() + "</option>"); } else { sb.Append("<option value=\"" + dtper.Rows[i]["ID"].ToString() + "\">" + dtper.Rows[i]["Name"].ToString() + "</option>"); } //} } percodes = sb.ToString(); } dtgrade.Columns["nochecks"].ColumnName = "nocheck"; DataRow dry = dtgrade.NewRow(); dry["pId"] = "0"; dry["id"] = "1"; dry["name"] = "幼儿园"; dry["nocheck"] = "false"; dry["IsFinish"] = "0"; dtgrade.Rows.Add(dry); dry = dtgrade.NewRow(); dry["pId"] = "0"; dry["id"] = "2"; dry["name"] = "小学"; dry["nocheck"] = "false"; dry["IsFinish"] = "0"; dtgrade.Rows.Add(dry); dry = dtgrade.NewRow(); dry["pId"] = "0"; dry["id"] = "3"; dry["name"] = "初中"; dry["nocheck"] = "false"; dry["IsFinish"] = "0"; dtgrade.Rows.Add(dry); dry = dtgrade.NewRow(); dry["pId"] = "0"; dry["id"] = "4"; dry["name"] = "高中"; dry["nocheck"] = "false"; dry["IsFinish"] = "0"; dtgrade.Rows.Add(dry); //if (dtgrade != null && dtschgrade != null && dtgrade.Rows.Count > 0 && dtschgrade.Rows.Count > 0)//系统年级和学校年级不等于null //{ // for (int i = 0; i < dtgrade.Rows.Count; i++)//遍历实体年级行数 // { // DataRow[] drs = dtschgrade.Select("id='" + dtgrade.Rows[i]["id"].ToString() + "'");//根据系统年级id查询学校年级 // if (drs.Length > 0) // { // //string ss = drs[0]["id"].ToString(); // //dtgrade.Rows[i]["checked"] = "true"; // //DataRow[] drss = dtgrade.Select("id='"+ss+"'"); // //int ss = int.Parse(drss["pId"].ToString()); // } // } //} grades = Newtonsoft.Json.JsonConvert.SerializeObject(dtgrade); //获取资源平台服务资源:AutoId,AppCode,AppName,Stat,RecTime,RecUser,LastRecTime,LastRecUser SchSystem.BLL.SchAppSoure schappsoureBll = new SchSystem.BLL.SchAppSoure(); DataTable dtschappsoure = schappsoureBll.GetList("'0' pId,AppCode id,AppName name,'false' checked,AppCode", "Stat=1").Tables[0]; if (dtschappsoure.Rows.Count > 0) { for (int i = 0; i < dtschappsoure.Rows.Count; i++) { dtschappsoure.Rows[i]["name"] = dtschappsoure.Rows[i]["name"] + "【不共享】"; } } souretree = Newtonsoft.Json.JsonConvert.SerializeObject(dtschappsoure); //获取教版 SchSystem.BLL.SysMater smaterBll = new SchSystem.BLL.SysMater(); DataTable dtsmater = smaterBll.GetList("'0' pId,AutoId id,MaterName name,'false' checked,MaterCode", "Stat=1").Tables[0]; sysmatertree = Newtonsoft.Json.JsonConvert.SerializeObject(dtsmater); //获取家校互通服务资源:AutoId,AppCode,AppName,Stat,RecTime,RecUser,LastRecTime,LastRecUser SchSystem.BLL.SchAppXXT schappxxtBll = new SchSystem.BLL.SchAppXXT(); DataTable dtschappxxt = schappxxtBll.GetList("'0' pId,AppCode id,AppName name,'false' checked,AppCode", "Stat=1").Tables[0]; //if (dtschappsoure.Rows.Count > 0) //{ // for (int i = 0; i < dtschappsoure.Rows.Count; i++) // { // dtschappsoure.Rows[i]["name"] = dtschappsoure.Rows[i]["name"] + "【不共享】"; // } //} homeschtree = Newtonsoft.Json.JsonConvert.SerializeObject(dtschappxxt); //获取下拉列表 StringBuilder sbarea = new StringBuilder(); //获取省份 sbarea.Append("<select id=\"aprov\">"); string sareacode = ""; if (usermodel != null && usermodel.SchId > 0 && usermodel.AreaNo.Length == 6) { sareacode = usermodel.AreaNo.Substring(0, 2) + "0000"; } sbarea.Append(SchWebAdmin.Com.Public.GetDrpArea("0", "", ref sareacode, false)); sbarea.Append("</select>"); //获取城市 sbarea.Append("<select id=\"acity\">"); string sareacitycode = ""; if (usermodel != null && usermodel.SchId > 0 && usermodel.AreaNo.Length == 6) { sareacitycode = usermodel.AreaNo.Substring(0, 4) + "00"; } sbarea.Append(SchWebAdmin.Com.Public.GetDrpArea("1", sareacode, ref sareacitycode, false)); sbarea.Append("</select>"); //获取区县 sbarea.Append("<select id=\"acoty\">"); string sareacotycode = ""; if (usermodel != null && usermodel.SchId > 0 && usermodel.AreaNo.Length == 6) { sareacotycode = usermodel.AreaNo; } sbarea.Append(SchWebAdmin.Com.Public.GetDrpArea("2", sareacitycode, ref sareacotycode, false)); sbarea.Append("</select>"); areastr = sbarea.ToString(); //根据部门分类查询人员信息 //当前学校老师 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]; SchSystem.BLL.SchDepartInfo dptbll = new SchSystem.BLL.SchDepartInfo(); DataTable dt = dptbll.GetList("Pid pId,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() + "'"); 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"] = item["DeptId"].ToString(); if (dr["name"].ToString() == usermodel.Artisan.ToString()) { dr["checked"] = true; } dtdptuser.Rows.Add(dr); } } } } deptsuser = Newtonsoft.Json.JsonConvert.SerializeObject(dtdptuser); } }
public static Com.DataPack.DataRsp <string> schsave(List <string> arr) { int schid = 0; string selgrades = ""; string selsubs = ""; string sonsys = ""; string schsonsysenabletime = ""; string resourcemodules = ""; string homschmodules = ""; string kinderstr = ""; string primarystr = ""; string juniorstr = ""; string highstr = ""; string homkinderstr = ""; string homprimarystr = ""; string homjuniorstr = ""; string homhighstr = ""; Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>(); if (Com.Session.userid == null) { rsp.code = "expire"; rsp.msg = "页面已经过期,请重新登录"; } else { try { SchSystem.Model.SchInfo schmodel = new SchSystem.Model.SchInfo(); SchSystem.BLL.SchInfo schbll = new SchSystem.BLL.SchInfo(); #region 收集前台传递过来的数据 foreach (string str in arr) { string[] strarr = str.Split('#'); if (strarr[0] == "schid") { schmodel.SchId = int.Parse(strarr[1]); } else if (strarr[0] == "schname") { schmodel.SchName = strarr[1]; } else if (strarr[0] == "acoty") { if (((IList)strarr).Contains(strarr[1])) { schmodel.AreaNo = strarr[1]; } else { schmodel.AreaNo = ""; } } else if (strarr[0] == "iscity") { if (((IList)strarr).Contains(strarr[1])) { schmodel.IsCity = int.Parse(strarr[1]); } else { schmodel.IsCity = 0; } } else if (strarr[0] == "schaddr") { if (((IList)strarr).Contains(strarr[1])) { schmodel.SchAddr = strarr[1]; } else { schmodel.SchAddr = ""; } } else if (strarr[0] == "schmaster") { if (((IList)strarr).Contains(strarr[1])) { schmodel.SchMaster = strarr[1]; } else { schmodel.SchMaster = ""; } } else if (strarr[0] == "schmasterpst") { if (((IList)strarr).Contains(strarr[1])) { schmodel.MasterPostion = strarr[1]; } else { schmodel.MasterPostion = ""; } } else if (strarr[0] == "schmastertel") { if (((IList)strarr).Contains(strarr[1])) { schmodel.SchTel = strarr[1]; } else { schmodel.SchTel = ""; } } else if (strarr[0] == "frontlinetechni") { if (((IList)strarr).Contains(strarr[1])) { schmodel.Artisan = strarr[1]; } else { schmodel.Artisan = ""; } } else if (strarr[0] == "principalname") { if (((IList)strarr).Contains(strarr[1])) { schmodel.PrincipalName = strarr[1]; } else { schmodel.PrincipalName = ""; } } else if (strarr[0] == "principaltel") { if (((IList)strarr).Contains(strarr[1])) { schmodel.PrincipalTel = strarr[1]; } else { schmodel.PrincipalTel = ""; } } else if (strarr[0] == "customerservicestaffname") { if (((IList)strarr).Contains(strarr[1])) { schmodel.ServiceName = strarr[1]; } else { schmodel.ServiceName = ""; } } else if (strarr[0] == "customerservicestaffnametel") { if (((IList)strarr).Contains(strarr[1])) { schmodel.ServiceTel = strarr[1]; } else { schmodel.ServiceTel = ""; } } else if (strarr[0] == "platformname") { if (((IList)strarr).Contains(strarr[1])) { schmodel.PlatformName = strarr[1]; } else { schmodel.PlatformName = ""; } } else if (strarr[0] == "platformico") { if (((IList)strarr).Contains(strarr[1])) { schmodel.PlatformIco = strarr[1]; } else { schmodel.PlatformIco = ""; } } else if (strarr[0] == "platformurl") { if (((IList)strarr).Contains(strarr[1])) { schmodel.PlatformUrl = strarr[1]; } else { schmodel.PlatformUrl = ""; } } else if (strarr[0] == "ipaddress") { if (((IList)strarr).Contains(strarr[1])) { schmodel.PlatformIP = strarr[1]; } else { schmodel.PlatformIP = ""; } } else if (strarr[0] == "manageracount") { if (((IList)strarr).Contains(strarr[1])) { schmodel.Manageracount = strarr[1]; } else { schmodel.Manageracount = ""; } } else if (strarr[0] == "selgrades") { if (((IList)strarr).Contains(strarr[1])) { selgrades = strarr[1]; } else { selgrades = ""; } } else if (strarr[0] == "selsubs") { if (((IList)strarr).Contains(strarr[1])) { selsubs = strarr[1]; } else { selsubs = ""; } } else if (strarr[0] == "sonsys") { if (((IList)strarr).Contains(strarr[1])) { sonsys = strarr[1]; } else { sonsys = ""; } } else if (strarr[0] == "resourceplatformname") { if (((IList)strarr).Contains(strarr[1])) { schmodel.ResourcePlatformName = strarr[1]; } else { schmodel.ResourcePlatformName = ""; } } else if (strarr[0] == "resourceplatformico") { if (((IList)strarr).Contains(strarr[1])) { schmodel.ResourcePlatformIco = strarr[1]; } else { schmodel.ResourcePlatformIco = ""; } } else if (strarr[0] == "resourceplatformurl") { if (((IList)strarr).Contains(strarr[1])) { schmodel.ResourcePlatformUrl = strarr[1]; } else { schmodel.ResourcePlatformUrl = ""; } } else if (strarr[0] == "resourceplatformip") { if (((IList)strarr).Contains(strarr[1])) { schmodel.ResourcePlatformIP = strarr[1]; } else { schmodel.ResourcePlatformIP = ""; } } else if (strarr[0] == "schoolsection") { if (((IList)strarr).Contains(strarr[1])) { schmodel.SchoolSection = strarr[1]; } else { schmodel.SchoolSection = ""; } } else if (strarr[0] == "creator") { if (((IList)strarr).Contains(strarr[1])) { schmodel.SchCreator = strarr[1]; } else { schmodel.SchCreator = ""; } } else if (strarr[0] == "resourcemodules") { if (((IList)strarr).Contains(strarr[1])) { resourcemodules = strarr[1]; } else { resourcemodules = ""; } } //else if (strarr[0] == "sourceserverstat") { if (((IList)strarr).Contains(strarr[1])) { schmodel.Sourceserstat = int.Parse(strarr[1]); } else { schmodel.Sourceserstat = 0; } } else if (strarr[0] == "kinderstr") { if (((IList)strarr).Contains(strarr[1])) { kinderstr = strarr[1]; } else { kinderstr = ""; } } else if (strarr[0] == "primarystr") { if (((IList)strarr).Contains(strarr[1])) { primarystr = strarr[1]; } else { primarystr = ""; } } else if (strarr[0] == "juniorstr") { if (((IList)strarr).Contains(strarr[1])) { juniorstr = strarr[1]; } else { juniorstr = ""; } } else if (strarr[0] == "highstr") { if (((IList)strarr).Contains(strarr[1])) { highstr = strarr[1]; } else { highstr = ""; } } else if (strarr[0] == "per") { if (((IList)strarr).Contains(strarr[1])) { schmodel.SchType = int.Parse(strarr[1]); } else { schmodel.SchType = 0; } } else if (strarr[0] == "drpm") { if (((IList)strarr).Contains(strarr[1])) { schmodel.OpenMonth = int.Parse(strarr[1]); } else { schmodel.OpenMonth = 0; } } //家校互通平台基础数据 else if (strarr[0] == "homeschoolingname") { if (((IList)strarr).Contains(strarr[1])) { schmodel.HomeSchPlatName = strarr[1]; } else { schmodel.HomeSchPlatName = ""; } } else if (strarr[0] == "homeschoolingico") { if (((IList)strarr).Contains(strarr[1])) { schmodel.HomeSchPlatIco = strarr[1]; } else { schmodel.HomeSchPlatIco = ""; } } else if (strarr[0] == "homeschoolingurl") { if (((IList)strarr).Contains(strarr[1])) { schmodel.HomeSchPlatUrl = strarr[1]; } else { schmodel.HomeSchPlatUrl = ""; } } else if (strarr[0] == "homeschoolingip") { if (((IList)strarr).Contains(strarr[1])) { schmodel.HomeSchPlatIP = strarr[1]; } else { schmodel.HomeSchPlatIP = ""; } } else if (strarr[0] == "homeschoolbaxicstat") { if (((IList)strarr).Contains(strarr[1])) { schmodel.HomeSchBasicStat = int.Parse(strarr[1]); } else { schmodel.HomeSchBasicStat = 0; } } else if (strarr[0] == "homeschoolservstat") { if (((IList)strarr).Contains(strarr[1])) { schmodel.HomeschServStat = int.Parse(strarr[1]); } else { schmodel.HomeschServStat = 0; } } //家校互通平台学段、科目及教版 else if (strarr[0] == "homschkinderstr") { if (((IList)strarr).Contains(strarr[1])) { homkinderstr = strarr[1]; } else { homkinderstr = ""; } } else if (strarr[0] == "homschprimarystr") { if (((IList)strarr).Contains(strarr[1])) { homprimarystr = strarr[1]; } else { homprimarystr = ""; } } else if (strarr[0] == "homschjuniorstr") { if (((IList)strarr).Contains(strarr[1])) { homjuniorstr = strarr[1]; } else { homjuniorstr = ""; } } else if (strarr[0] == "homschhighstr") { if (((IList)strarr).Contains(strarr[1])) { homhighstr = strarr[1]; } else { homhighstr = ""; } } //家校互通平台子模块 else if (strarr[0] == "homschmodules") { if (((IList)strarr).Contains(strarr[1])) { homschmodules = strarr[1]; } else { homschmodules = ""; } } } #endregion schmodel.RecTime = DateTime.Now; schmodel.RecUser = schmodel.SchCreator; schmodel.SonSysStat = 1; //子系统状态,缺省值为1,表示启用 schmodel.Stat = 1; //0代表废弃;1代表正常;2代表删除 schmodel.SourceSerStat = 0; schmodel.HomeSchCreateTime = DateTime.Now; string msusername = schmodel.Manageracount; string msusertname = schmodel.SchMaster; string errorstr = ""; SchSystem.BLL.SchUserInfo suiBll = new SchSystem.BLL.SchUserInfo(); if (string.IsNullOrEmpty(msusername) || string.IsNullOrEmpty(msusertname)) { errorstr += "管理员账号或管理员姓名为空;"; } if (msusername != "" && suiBll.ExistsUserName(0, msusername))//判断管理账号是否存在 { errorstr += "管理员账号已经被使用,请修改;"; } if (Encoding.Default.GetBytes(schmodel.PlatformIP).Length > 15)//判断管理平台IP地址 { errorstr += "管理平台IP地址超出15个字符;"; } if (Encoding.Default.GetBytes(schmodel.ResourcePlatformIP).Length > 15)//判断资源平台IP地址 { errorstr += "管理平台IP地址超出15个字符;"; } if (Encoding.Default.GetBytes(schmodel.HomeSchPlatIP).Length > 15)//判断家校互通平台IP地址 { errorstr += "管理平台IP地址超出15个字符;"; } if (errorstr == "") { schid = schbll.SchAdd(schmodel); if (schid > 0) { suiBll.AddUser(schid, schmodel.SchMaster, schmodel.Manageracount, Com.Public.StrToMD5("123456"), Com.Session.userid); //添加家校互通平台基础数据 schmodel.SchId = schid; schbll.SchAddXXT(schmodel); //添加年级及科目 GradeSubAdd(selgrades, schid); //添加科目 subAdd(selsubs, schid); //添加子系统 SonSysAdd(sonsys, schid); //资料科目及教版 dataSubMat(schid, kinderstr, primarystr, juniorstr, highstr); //资源模块 ResourcesModel(resourcemodules, schid); //家校互通平台学段科目及教版 schxxtPerSubMat(schid, homkinderstr, homprimarystr, homjuniorstr, homhighstr); //家校互通平台子模块 schxxtSonModel(homschmodules, schid); rsp.code = "success"; rsp.msg = "添加成功"; } else { rsp.code = "error"; rsp.msg = "添加失败"; } } else { rsp.code = "error"; rsp.msg = errorstr; } } catch (Exception ex) { rsp.code = "error"; rsp.msg = ex.Message; } } return(rsp); }