Ejemplo n.º 1
0
        public static IEnumerable <SubscribeMessage> LoadMessages(MessageQueryFilter filter, out int totalCount)
        {
            var sql = DataCommandHelper.GetDataCommandSql("LoadMessages", out string connectionString);

            using (IDbConnection conn = MysqlFactory.CreateConnection(connectionString))
            {
                string whereStr = "WHERE 1 = 1";
                if (!string.IsNullOrWhiteSpace(filter.Topic))
                {
                    whereStr += " AND `subscribemessage`.`Topic`=@Topic";
                }
                if (!string.IsNullOrWhiteSpace(filter.ReferenceIdentifier))
                {
                    whereStr += " AND `message`.`ReferenceIdentifier`=@ReferenceIdentifier";
                }
                if (filter.CreateDateFrom.HasValue)
                {
                    whereStr += " AND `message`.`CreateDate`>=@CreateDateFrom";
                }
                if (filter.CreateDateTo.HasValue)
                {
                    whereStr += " AND `message`.`CreateDate`<@CreateDateTo";
                }
                whereStr += " Order By `message`.`CreateDate` DESC";
                sql       = sql.Replace("#StrWhere#", whereStr);
                var result   = conn.QueryMultiple(sql, filter);
                var messages = result.Read <SubscribeMessage>();
                totalCount = result.ReadFirstOrDefault <int>();
                return(messages);
            }
        }
Ejemplo n.º 2
0
 public static IEnumerable <SubscribeMessage> LoadFailedMessages(MessageQueryFilter filter, out int totalCount)
 {
     return(MessageDA.LoadFailedMessages(filter, out totalCount));
 }