/// <summary> /// 删除 /// </summary> /// <param name="m">参见模型</param> /// <returns>参见模型</returns> public static Message Del(E_GROUP_Model m) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("delete E_GROUP"); sb.AppendFormat(" where EGROUPID= '{0}'", ClsSql.EncodeSql(m.EGROUPID)); bool bln = DataBaseClass.ExeSql(sb.ToString()); if (bln == true) { return(new Message(true, "删除成功!", "")); } else { return(new Message(false, "删除失败,请检查各输入框是否正确!", "")); } }
/// <summary> /// 增、删、改 /// </summary> /// <param name="m">参见模型</param> /// <returns>参见模型</returns> public static Message Manager(E_GROUP_Model m) { if (m.opMethod == "Add") { Message msgUser = BaseDT.E_GROUP.Add(m); return(new Message(msgUser.Success, msgUser.Msg, msgUser.Url)); } if (m.opMethod == "Mdy") { Message msgUser = BaseDT.E_GROUP.Mdy(m); return(new Message(msgUser.Success, msgUser.Msg, msgUser.Url)); } if (m.opMethod == "Del") { Message msgUser = BaseDT.E_GROUP.Del(m); return(new Message(msgUser.Success, msgUser.Msg, msgUser.Url)); } return(new Message(false, "无效操作", "")); }
/// <summary> /// 获取列表 /// </summary> /// <param name="sw"></param> /// <returns></returns> public static IEnumerable <E_GROUP_Model> getModelList(E_GROUP_SW sw) { var result = new List <E_GROUP_Model>(); DataTable dt = BaseDT.E_GROUP.getDT(sw);//列表 for (int i = 0; i < dt.Rows.Count; i++) { E_GROUP_Model m = new E_GROUP_Model(); m.EGROUPID = dt.Rows[i]["EGROUPID"].ToString(); m.EGROUPUSERID = dt.Rows[i]["EGROUPUSERID"].ToString(); m.EGROUPMEMBERLIST = dt.Rows[i]["EGROUPMEMBERLIST"].ToString(); m.EGROUPNAME = dt.Rows[i]["EGROUPNAME"].ToString(); m.EGROUPTYPE = dt.Rows[i]["EGROUPTYPE"].ToString(); m.EGROUPPHONELIST = dt.Rows[i]["EGROUPPHONELIST"].ToString(); result.Add(m); } dt.Clear(); dt.Dispose(); return(result); }
/// <summary> /// 根据查询条件获取某一条用户信息记录,用于修改、删除、用户登录验证 /// </summary> /// <param name="sw">参见模型</param> /// <returns>参见模型</returns> public static E_GROUP_Model getModel(E_GROUP_SW sw) { var result = new List <E_GROUP_Model>(); DataTable dt = BaseDT.E_GROUP.getDT(sw);//列表 E_GROUP_Model m = new E_GROUP_Model(); if (dt.Rows.Count > 0) { int i = 0; m.EGROUPID = dt.Rows[i]["EGROUPID"].ToString(); m.EGROUPUSERID = dt.Rows[i]["EGROUPUSERID"].ToString(); m.EGROUPMEMBERLIST = dt.Rows[i]["EGROUPMEMBERLIST"].ToString(); m.EGROUPNAME = dt.Rows[i]["EGROUPNAME"].ToString(); m.EGROUPTYPE = dt.Rows[i]["EGROUPTYPE"].ToString(); m.EGROUPPHONELIST = dt.Rows[i]["EGROUPPHONELIST"].ToString(); } dt.Clear(); dt.Dispose(); return(m); }
/// <summary> /// 修改 /// </summary> /// <param name="m">参见模型</param> /// <returns>参见模型</returns> public static Message Mdy(E_GROUP_Model m) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("UPDATE E_GROUP"); sb.AppendFormat(" set "); sb.AppendFormat("EGROUPUSERID={0}", ClsSql.saveNullField(m.EGROUPUSERID)); sb.AppendFormat(",EGROUPNAME={0}", ClsSql.saveNullField(m.EGROUPNAME)); sb.AppendFormat(",EGROUPMEMBERLIST={0}", ClsSql.saveNullField(m.EGROUPMEMBERLIST)); sb.AppendFormat(",EGROUPTYPE={0}", ClsSql.saveNullField(m.EGROUPTYPE)); sb.AppendFormat(",EGROUPPHONELIST={0}", ClsSql.saveNullField(m.EGROUPPHONELIST)); sb.AppendFormat(" where EGROUPID= '{0}'", ClsSql.EncodeSql(m.EGROUPID)); bool bln = DataBaseClass.ExeSql(sb.ToString()); if (bln == true) { return(new Message(true, "修改成功!", m.EGROUPID)); } else { return(new Message(false, "修改失败,请检查各输入框是否正确!", "")); } }
/// <summary> /// 添加 /// </summary> /// <param name="m">参见模型</param> /// <returns>参见模型</returns> public static Message Add(E_GROUP_Model m) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("INSERT INTO E_GROUP(EGROUPUSERID, EGROUPNAME, EGROUPMEMBERLIST, EGROUPTYPE,EGROUPPHONELIST)"); sb.AppendFormat("VALUES("); sb.AppendFormat("{0}", ClsSql.saveNullField(m.EGROUPUSERID)); sb.AppendFormat(",{0}", ClsSql.saveNullField(m.EGROUPNAME)); sb.AppendFormat(",{0}", ClsSql.saveNullField(m.EGROUPMEMBERLIST)); sb.AppendFormat(",{0}", ClsSql.saveNullField(m.EGROUPTYPE)); sb.AppendFormat(",{0}", ClsSql.saveNullField(m.EGROUPPHONELIST)); sb.AppendFormat(")"); bool bln = DataBaseClass.ExeSql(sb.ToString()); if (bln == true) { return(new Message(true, "添加成功!", "")); } else { return(new Message(false, "添加失败,请检查各输入框是否正确!", "")); } }