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

            sb.AppendFormat(" FROM      EM_MESSAGE");
            sb.AppendFormat(" WHERE   1=1");
            if (string.IsNullOrEmpty(sw.EM_MESSAGEID) == false)
            {
                sb.AppendFormat(" AND EM_MESSAGEID = '{0}'", ClsSql.EncodeSql(sw.EM_MESSAGEID));
            }
            if (string.IsNullOrEmpty(sw.MessageContent) == false)
            {
                sb.AppendFormat(" AND TMPCONTENT = '{0}'", ClsSql.EncodeSql(sw.MessageContent));
            }
            string sql = "SELECT EM_MESSAGEID, TMPCONTENT, ORDERBY"
                         + sb.ToString()
                         + " order by EM_MESSAGEID,ORDERBY";
            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]);
        }
Beispiel #2
0
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="sw"></param>
        /// <returns></returns>
        public static IEnumerable <SendMessage_Model> getModelList(EM_Message_SW sw)
        {
            var       result = new List <SendMessage_Model>();
            DataTable dt     = BaseDT.EM_Message.getDT(sw);//列表

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                SendMessage_Model m = new SendMessage_Model();
                m.EM_MESSAGEID   = dt.Rows[i]["EM_MESSAGEID"].ToString();
                m.MessageContent = dt.Rows[i]["TMPCONTENT"].ToString();
                m.ORDERBY        = dt.Rows[i]["ORDERBY"].ToString();
                result.Add(m);
            }
            dt.Clear();
            dt.Dispose();
            return(result);
        }
Beispiel #3
0
        /// <summary>
        /// 根据查询条件获取某一条用户信息记录,用于修改、删除、用户登录验证
        /// </summary>
        /// <param name="sw">参见模型</param>
        /// <returns>参见模型</returns>
        public static SendMessage_Model getModel(EM_Message_SW sw)
        {
            var result = new List <SendMessage_Model>();

            DataTable         dt = BaseDT.EM_Message.getDT(sw);//列表
            SendMessage_Model m  = new SendMessage_Model();

            if (dt.Rows.Count > 0)
            {
                int i = 0;
                m.EM_MESSAGEID   = dt.Rows[i]["EM_MESSAGEID"].ToString();
                m.MessageContent = dt.Rows[i]["TMPCONTENT"].ToString();
                m.ORDERBY        = dt.Rows[i]["ORDERBY"].ToString();
            }
            dt.Clear();
            dt.Dispose();
            return(m);
        }
Beispiel #4
0
        /// <summary>
        /// 获取记录
        /// </summary>
        /// <param name="sw"></param>
        /// <returns></returns>
        public static DataTable getDT(EM_Message_SW sw)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat(" FROM      EM_MESSAGE");
            sb.AppendFormat(" WHERE   1=1");
            if (string.IsNullOrEmpty(sw.EM_MESSAGEID) == false)
            {
                sb.AppendFormat(" AND EM_MESSAGEID = '{0}'", ClsSql.EncodeSql(sw.EM_MESSAGEID));
            }
            if (string.IsNullOrEmpty(sw.MessageContent) == false)
            {
                sb.AppendFormat(" AND TMPCONTENT = '{0}'", ClsSql.EncodeSql(sw.MessageContent));
            }
            string sql = "SELECT EM_MESSAGEID, TMPCONTENT, ORDERBY"
                         + sb.ToString()
                         + " order by EM_MESSAGEID,ORDERBY";

            DataSet ds = DataBaseClass.FullDataSet(sql);

            return(ds.Tables[0]);
        }