public HttpResponseMessage SearchMessageDetail(string endTime, string startTime, string type, EnumMessageDetailSearchOrderBy orderByAll = EnumMessageDetailSearchOrderBy .OrderById, bool isDes = true, int page = 1, int pageSize = 10)
        {
            //================================================赵旭初 by 2015-05-13 start===============================================================
            string strStarttime = "";
            string strEndtime = "";
            string strType = "";

            if (startTime == null || startTime.Length <= 0) strStarttime = "1900-01-01";
            else strStarttime = startTime.Substring(0, 10);

            if (endTime == null || endTime.Length <= 0)
                strEndtime = string.Format(DateTime.Now.ToShortDateString(), "yyyy-mm-dd");
            else
                strEndtime = endTime.Substring(0, 10);

            if(!string.IsNullOrEmpty(type))
            {
                strType = type;

            }
            

            var mDetailCondition = new MessageDetailSearchCondition()
            {
                AddtimeBegin = Convert.ToDateTime(strStarttime),
                AddtimeEnd = Convert.ToDateTime(strEndtime).AddDays(1),
                Title = strType,
                Page = Convert.ToInt32(page),
                PageCount = pageSize,
                OrderBy =orderByAll ,
                isDescending =isDes 
            };


            var list = _messageDetailService.GetMessageDetailsByCondition(mDetailCondition).Select(c => new { c.Id, c.Title, c.Sender, c.Mobile, c.Content, c.Addtime }).ToList();
            var listCount = _messageDetailService.GetMessageDetailCount(mDetailCondition);
            return PageHelper.toJson(new { List = list, Condition = mDetailCondition, totalCount = listCount });

            //================================================赵旭初 by 2015-05-13 end===============================================================
        }
Пример #2
0
        public HttpResponseMessage SearchMessageDetail(string endTime, string startTime, string type, EnumMessageDetailSearchOrderBy orderByAll = EnumMessageDetailSearchOrderBy.OrderById, bool isDes = true, int page = 1, int pageSize = 10)
        {
            //================================================赵旭初 by 2015-05-13 start===============================================================
            string strStarttime = "";
            string strEndtime   = "";
            string strType      = "";

            if (startTime == null || startTime.Length <= 0)
            {
                strStarttime = "1900-01-01";
            }
            else
            {
                strStarttime = startTime.Substring(0, 10);
            }

            if (endTime == null || endTime.Length <= 0)
            {
                strEndtime = string.Format(DateTime.Now.ToShortDateString(), "yyyy-mm-dd");
            }
            else
            {
                strEndtime = endTime.Substring(0, 10);
            }

            if (!string.IsNullOrEmpty(type))
            {
                strType = type;
            }


            var mDetailCondition = new MessageDetailSearchCondition()
            {
                AddtimeBegin = Convert.ToDateTime(strStarttime),
                AddtimeEnd   = Convert.ToDateTime(strEndtime).AddDays(1),
                Title        = strType,
                Page         = Convert.ToInt32(page),
                PageCount    = pageSize,
                OrderBy      = orderByAll,
                isDescending = isDes
            };


            var list      = _messageDetailService.GetMessageDetailsByCondition(mDetailCondition).Select(c => new { c.Id, c.Title, c.Sender, c.Mobile, c.Content, c.Addtime }).ToList();
            var listCount = _messageDetailService.GetMessageDetailCount(mDetailCondition);

            return(PageHelper.toJson(new { List = list, Condition = mDetailCondition, totalCount = listCount }));

            //================================================赵旭初 by 2015-05-13 end===============================================================
        }