Example #1
0
        /// <summary>
        /// 获取记录
        /// </summary>
        /// <param name="sw"></param>
        ///  <param name="total">总共</param>
        /// <returns></returns>
        public static DataTable getDT(E_GROUP_SW sw, out int total)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat(" FROM      E_GROUP");
            sb.AppendFormat(" WHERE   1=1");
            if (string.IsNullOrEmpty(sw.EGROUPID) == false)
            {
                sb.AppendFormat(" AND EGROUPID = '{0}'", ClsSql.EncodeSql(sw.EGROUPID));
            }
            if (string.IsNullOrEmpty(sw.EGROUPUSERID) == false)
            {
                sb.AppendFormat(" AND EGROUPUSERID = '{0}'", ClsSql.EncodeSql(sw.EGROUPUSERID));
            }
            if (string.IsNullOrEmpty(sw.EGROUPNAME) == false)
            {
                sb.AppendFormat(" AND EGROUPNAME = '{0}'", ClsSql.EncodeSql(sw.EGROUPNAME));
            }
            if (string.IsNullOrEmpty(sw.EGROUPTYPE) == false)
            {
                sb.AppendFormat(" AND EGROUPTYPE = '{0}'", ClsSql.EncodeSql(sw.EGROUPTYPE));
            }
            string sql = "SELECT EGROUPID, EGROUPUSERID, EGROUPNAME, EGROUPMEMBERLIST, EGROUPTYPE,EGROUPPHONELIST"
                         + sb.ToString() + " order by EGROUPID";
            string sqlC = "select count(1) " + sb.ToString();

            total      = int.Parse(DataBaseClass.ReturnSqlField(sqlC));
            sw.curPage = PagerCls.getCurPage(new PagerSW {
                curPage = sw.curPage, pageSize = sw.pageSize, rowCount = total
            });
            DataSet ds = DataBaseClass.FullDataSet(sql, (sw.curPage - 1) * sw.pageSize, sw.pageSize, "a");

            //DataSet ds = DataBaseClass.FullDataSet(sql);
            return(ds.Tables[0]);
        }
Example #2
0
        /// <summary>
        /// 获取记录
        /// </summary>
        /// <param name="sw"></param>
        /// <returns></returns>
        public static DataTable getDT(E_GROUP_SW sw)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat(" FROM      E_GROUP");
            sb.AppendFormat(" WHERE   1=1");
            if (string.IsNullOrEmpty(sw.EGROUPID) == false)
            {
                sb.AppendFormat(" AND EGROUPID = '{0}'", ClsSql.EncodeSql(sw.EGROUPID));
            }
            if (string.IsNullOrEmpty(sw.EGROUPUSERID) == false)
            {
                sb.AppendFormat(" AND EGROUPUSERID = '{0}'", ClsSql.EncodeSql(sw.EGROUPUSERID));
            }
            if (string.IsNullOrEmpty(sw.EGROUPNAME) == false)
            {
                sb.AppendFormat(" AND EGROUPNAME = '{0}'", ClsSql.EncodeSql(sw.EGROUPNAME));
            }
            if (string.IsNullOrEmpty(sw.EGROUPTYPE) == false)
            {
                sb.AppendFormat(" AND EGROUPTYPE = '{0}'", ClsSql.EncodeSql(sw.EGROUPTYPE));
            }
            string sql = "SELECT EGROUPID, EGROUPUSERID, EGROUPNAME, EGROUPMEMBERLIST, EGROUPTYPE,EGROUPPHONELIST"
                         + sb.ToString()
                         + " order by EGROUPID";

            DataSet ds = DataBaseClass.FullDataSet(sql);

            return(ds.Tables[0]);
        }
Example #3
0
        /// <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);
        }
Example #4
0
        /// <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);
        }