public static string VerifyConfigEnumIsExists(string strConfigEnum) { string strJson = string.Empty; try { BLL_ConfigSchool bll = new BLL_ConfigSchool(); if (bll.GetRecordCount("ConfigEnum='" + strConfigEnum.Filter() + "'") > 0) { strJson = Newtonsoft.Json.JsonConvert.SerializeObject(new { err = "error", errMsg = "标识已存在" }); } else { strJson = Newtonsoft.Json.JsonConvert.SerializeObject(new { err = "null", errMsg = "" }); } } catch (Exception ex) { new Rc.Cloud.BLL.BLL_clsAuth().AddLogErrorFromBS("90207000", "验证【学校配置标识】是否存在出现异常:" + ex.Message.ToString()); return(Newtonsoft.Json.JsonConvert.SerializeObject(new { err = "error", errMsg = "出现异常错误" })); } return(strJson); }
protected void btnSubmit_Click(object sender, EventArgs e) { try { int intOrder = 0; int.TryParse(txtDSort.Text, out intOrder); if (string.IsNullOrEmpty(ConfigEnum)) { #region 添加 model = new Model_ConfigSchool(); model.ConfigEnum = txtConfigEnum.Text.Trim(); model.School_ID = hidtxtSchool.Value.Trim(); model.School_Name = txtSchool.Value.Trim(); model.D_Name = txtDName.Text.Trim(); model.D_Value = txtDValue.Text.Trim(); model.D_PublicValue = txtDPublicValue.Text.Trim(); model.D_Type = ddlDType.SelectedValue; model.D_Order = intOrder; model.D_Remark = txtRemark.Text.Trim(); model.D_CreateUser = loginUser.SysUser_ID; model.D_CreateTime = DateTime.Now; model.SchoolIP = txtSchoolIP.Text.Trim(); //验证标识是否已存在 if (bll.GetRecordCount("ConfigEnum='" + txtConfigEnum.Text.Trim() + "'") > 0) { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script>layer.msg('标识已存在', { time: 2000, icon: 2})</script>"); return; } //验证学校是否已配置某一类型的数据 if (bll.GetRecordCount("School_ID='" + hidtxtSchool.Value.Trim() + "' and D_Type='" + ddlDType.SelectedValue + "'") > 0) { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script>layer.msg('该学校已添加此类型数据', { time: 2000, icon: 2})</script>"); return; } if (bll.Add(model)) { new Rc.Cloud.BLL.BLL_clsAuth().AddLogFromBS("90207000", "新增学校配置标识成功"); ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('新增成功!',{ time: 2000,icon:1},function(){parent.loadData();parent.layer.close(index)});</script>"); return; } #endregion } else { #region 修改 model = bll.GetModel(ConfigEnum); model.School_ID = hidtxtSchool.Value.Trim(); model.School_Name = txtSchool.Value.Trim(); model.D_Name = txtDName.Text.Trim(); model.D_Value = txtDValue.Text.Trim(); model.D_PublicValue = txtDPublicValue.Text.Trim(); model.D_Type = ddlDType.SelectedValue; model.D_Order = intOrder; model.D_Remark = txtRemark.Text.Trim(); model.D_UpdateUser = loginUser.SysUser_ID; model.D_UpdateTime = DateTime.Now; model.SchoolIP = txtSchoolIP.Text.Trim(); //验证学校是否已配置某一类型的数据 if (bll.GetRecordCount("ConfigEnum!='" + txtConfigEnum.Text.Trim() + "' and School_ID='" + hidtxtSchool.Value.Trim() + "' and D_Type='" + ddlDType.SelectedValue + "'") > 0) { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script>layer.msg('该学校已添加此类型数据', { time: 2000, icon: 2})</script>"); return; } if (bll.Update(model)) { new Rc.Cloud.BLL.BLL_clsAuth().AddLogFromBS("90207000", "修改学校配置标识成功"); ClientScript.RegisterStartupScript(this.GetType(), "update", "<script type='text/javascript'>layer.msg('修改成功!',{ time: 2000,icon:1},function(){parent.loadData();parent.layer.close(index);});</script>"); } #endregion } } catch (Exception) { new Rc.Cloud.BLL.BLL_clsAuth().AddLogErrorFromBS("90207000", "操作学校配置标识失败"); ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('操作失败!',{ time: 2000,icon:2},function(){parent.loadData();parent.layer.close(index);});</script>"); } }
public static string GetDataList(string Key, string Name, int PageIndex, int PageSize) { try { BLL_ConfigSchool bll = new BLL_ConfigSchool(); Key = Key.Filter(); Name = Name.Filter(); DataTable dt = new DataTable(); List <object> listReturn = new List <object>(); string strWhere = " 1=1 "; if (!string.IsNullOrEmpty(Key)) { strWhere += " and ConfigEnum='" + Key + "' "; } if (!string.IsNullOrEmpty(Name)) { strWhere += string.Format(" and (D_Name like '%{0}%' or School_Name like '%{0}%') ", Name); } string orderBy = "D_Order"; dt = bll.GetListByPage(strWhere, orderBy, ((PageIndex - 1) * PageSize + 1), (PageIndex * PageSize)).Tables[0]; int rCount = bll.GetRecordCount(strWhere); for (int i = 0; i < dt.Rows.Count; i++) { listReturn.Add(new { ConfigEnum = dt.Rows[i]["ConfigEnum"].ToString(), School_Id = dt.Rows[i]["School_Id"].ToString(), School_Name = dt.Rows[i]["School_Name"].ToString(), D_Name = dt.Rows[i]["D_Name"].ToString(), D_Value = dt.Rows[i]["D_Value"].ToString(), D_PublicValue = dt.Rows[i]["D_PublicValue"].ToString(), D_Type = dt.Rows[i]["D_Type"].ToString(), D_TypeName = Rc.Common.EnumService.GetDescription <ConfigSchoolTypeEnum>(dt.Rows[i]["D_Type"].ToString()), D_Order = dt.Rows[i]["D_Order"].ToString(), D_Remark = dt.Rows[i]["D_Remark"].ToString(), SchoolIP = dt.Rows[i]["SchoolIP"].ToString(), CreateTime = pfunction.ConvertToLongDateTime(dt.Rows[i]["D_CreateTime"].ToString()) }); } if (dt.Rows.Count > 0) { return(JsonConvert.SerializeObject(new { err = "null", PageIndex = PageIndex, PageSize = PageSize, TotalCount = rCount, list = listReturn })); } else { return(JsonConvert.SerializeObject(new { err = "暂无数据" })); } } catch (Exception ex) { return(JsonConvert.SerializeObject(new { err = ex.Message.ToString() })); } }