public SearchResult<EmployeeCost> Search(DateRangeSearchInfo searchInfo)
        {
            string url = string.Format("{0}?page={1}&limit={2}&start={3}&end={4}",
                ResourceUrl, searchInfo.PageIndex, searchInfo.PageSize, searchInfo.Start, searchInfo.End);

            return CreateGetRequest<SearchResult<EmployeeCost>>(Guid.Empty, url);
        }
        public SearchResult<EggProduction> GetByCriteria(int page, int limit, DateTime? start = null, DateTime? end = null)
        {
            var searchInfo = new DateRangeSearchInfo
            {
                Start = start,
                End = end,
                PageIndex = page,
                PageSize = limit
            };

            return service.Search(searchInfo);
        }
        public SearchResult<EggProduction> Search(DateRangeSearchInfo searchInfo)
        {
            int start = (searchInfo.PageIndex - 1) * searchInfo.PageSize;

            var result = new SearchResult<EggProduction>();

            using (var conn = factory.OpenDbConnection())
            {
                var ev = OrmLiteConfig.DialectProvider.ExpressionVisitor<Models.Data.EggProduction>();

                if (searchInfo.Start.HasValue && searchInfo.End.HasValue)
                {
                    ev = ev.Where(e => e.Date >= searchInfo.Start.Value.Date && e.Date <= searchInfo.End.Value.Date);
                }

                ev.OrderByDescending(e => e.Date).Limit(start, searchInfo.PageSize);

                var productionList = conn.Select(ev);
                foreach (var productionData in productionList)
                {
                    var list = conn.Where<Models.Data.EggProductionDetail>(new { ProductionId = productionData.Id });

                    var production = MapDataToModel(productionData, list);
                    result.Items.Add(production);
                }

                if (searchInfo.Start.HasValue && searchInfo.End.HasValue)
                {
                    result.Total = (int)conn.Count<Models.Data.EggProduction>(
                        e => e.Date >= searchInfo.Start.Value.Date && e.Date <= searchInfo.End.Value.Date);
                }
                else
                {
                    result.Total = (int)conn.Count<Models.Data.EggProduction>();
                }
            }

            return result;
        }
 void OnRefresh(object param)
 {
     var searchInfo = new DateRangeSearchInfo
         {
             Start = startDate,
             End = endDate,
             PageIndex = pageIndex,
             PageSize = pageSize
         };
     var result = costService.Search(searchInfo);
     CostList = new ObservableCollection<Models.EmployeeCost>(result.Items);
     TotalRecords = result.Total;
     DeleteCommand.EntityId = Guid.Empty;
 }