public dynamic GetAllMessageLog(MessageLogSearch MessageLogSearch)
        {
            var NotificationLogList = this.NotificationLogList(MessageLogSearch);

            var notifications = (from n in NotificationLogList
                                 select new
                                 {
                                     n.SentTo,
                                     n.FirstName,
                                     n.Surname,
                                     n.SentFrom,
                                     n.Message,
                                     n.Status,
                                     n.LogComment,
                                     n.CreateDate
                                 }).ToList();

            var customer = (from row in notifications
                            select new
                            {
                                SentTo = row.SentTo,
                                FullName = row.Surname + " " + row.FirstName,
                                SentFrom = row.SentFrom,
                                Message = row.Message,
                                Status = row.Status,
                                LogComment = row.LogComment,
                                CreateDate = row.CreateDate
                            }).OrderByDescending(x => x.CreateDate).AsQueryable();

            if (MessageLogSearch.iSortingCols == 1)
            {
                if (MessageLogSearch.sSortDir_0 == "asc" && MessageLogSearch.iSortCol_0 == 0) { customer = customer.OrderBy(p => p.SentTo); }
                if (MessageLogSearch.sSortDir_0 == "desc" && MessageLogSearch.iSortCol_0 == 0) { customer = customer.OrderByDescending(p => p.SentTo); }

                if (MessageLogSearch.sSortDir_0 == "asc" && MessageLogSearch.iSortCol_0 == 1) { customer = customer.OrderBy(p => p.FullName); }
                if (MessageLogSearch.sSortDir_0 == "desc" && MessageLogSearch.iSortCol_0 == 1) { customer = customer.OrderByDescending(p => p.FullName); }

                if (MessageLogSearch.sSortDir_0 == "asc" && MessageLogSearch.iSortCol_0 == 2) { customer = customer.OrderBy(p => p.SentFrom); }
                if (MessageLogSearch.sSortDir_0 == "desc" && MessageLogSearch.iSortCol_0 == 2) { customer = customer.OrderByDescending(p => p.SentFrom); }

                if (MessageLogSearch.sSortDir_0 == "asc" && MessageLogSearch.iSortCol_0 == 3) { customer = customer.OrderBy(p => p.Message); }
                if (MessageLogSearch.sSortDir_0 == "desc" && MessageLogSearch.iSortCol_0 == 3) { customer = customer.OrderByDescending(p => p.Message); }

                if (MessageLogSearch.sSortDir_0 == "asc" && MessageLogSearch.iSortCol_0 == 4) { customer = customer.OrderBy(p => p.Status); }
                if (MessageLogSearch.sSortDir_0 == "desc" && MessageLogSearch.iSortCol_0 == 4) { customer = customer.OrderByDescending(p => p.Status); }

                if (MessageLogSearch.sSortDir_0 == "asc" && MessageLogSearch.iSortCol_0 == 5) { customer = customer.OrderBy(p => p.LogComment); }
                if (MessageLogSearch.sSortDir_0 == "desc" && MessageLogSearch.iSortCol_0 == 5) { customer = customer.OrderByDescending(p => p.LogComment); }

                if (MessageLogSearch.sSortDir_0 == "asc" && MessageLogSearch.iSortCol_0 == 6) { customer = customer.OrderBy(p => p.CreateDate); }
                if (MessageLogSearch.sSortDir_0 == "desc" && MessageLogSearch.iSortCol_0 == 6) { customer = customer.OrderByDescending(p => p.CreateDate); }
            }
            var datatable = new
            {
                sEcho = MessageLogSearch.sEcho,
                iTotalRecords = customer.Skip(MessageLogSearch.iDisplayStart).Take(MessageLogSearch.iDisplayLength).Count(),
                iTotalDisplayRecords = customer.Count(),
                aaData = customer.Skip(MessageLogSearch.iDisplayStart).Take(MessageLogSearch.iDisplayLength).ToList()
            };
            return datatable;
        }
 public dynamic GetAllMessageLog(MessageLogSearch MessageLogSearch)
 {
     try
     {
         dynamic NotificationList;
         NotificationList = _NotificationService.GetAllMessageLog(MessageLogSearch);
         return NotificationList;
     }
     catch (Exception e)
     {
         return null;
     }
 }
 public IQueryable<NotificationLog> NotificationLogList(MessageLogSearch MessageLogSearch)
 {
     try
     {
         var NotificationLogList = _CustomerService.NotificationLog.AsQueryable();
         if (!string.IsNullOrEmpty(MessageLogSearch.SentTo))
         {
             NotificationLogList = from e in NotificationLogList where e.SentTo.ToString().Trim().ToLower() == MessageLogSearch.SentTo.ToString().Trim().ToLower() select e;
         }
         if (!string.IsNullOrEmpty(MessageLogSearch.FirstName))
         {
             NotificationLogList = from e in NotificationLogList where e.FirstName.ToString().Trim().ToLower() == MessageLogSearch.FirstName.ToString().Trim().ToLower() select e;
         }
         if (!string.IsNullOrEmpty(MessageLogSearch.Surname))
         {
             NotificationLogList = from e in NotificationLogList where e.Surname.ToString().Trim().ToLower() == MessageLogSearch.Surname.ToString().Trim().ToLower() select e;
         }
         if (!string.IsNullOrEmpty(MessageLogSearch.SentFrom))
         {
             NotificationLogList = from e in NotificationLogList where e.SentFrom.ToString().Trim().ToLower() == MessageLogSearch.SentFrom.ToString().Trim().ToLower() select e;
         }
         if (MessageLogSearch.CreateDate != null)
         {
             NotificationLogList = from e in NotificationLogList where DbFunctions.TruncateTime(e.CreateDate) == DbFunctions.TruncateTime(MessageLogSearch.CreateDate) select e;
         }
         return NotificationLogList;
     }
     catch (Exception)
     {
         throw;
     }
 }