private void Search(SearchMetadata searchMetadata)
 {
     switch (SearchOptions)
     {
         case SearchOptions.DateRange:
             SearchResult = WposContext.TransactionRepository.GetTransctions(x => !x.IsSales && !x.IsReturn
                                                                                  &&x.EntityDate >= searchMetadata.FromDate
                                                                                  &&x.EntityDate <=searchMetadata.ToDate
                                                                                  && (!IsNameInclude || x.TransactionLedgers.Any(y => y.Product.ProductName.Equals(searchMetadata.Name))));
             break;
         case SearchOptions.SingleDate:
             SearchResult = WposContext.TransactionRepository.GetTransctions(x => !x.IsSales
                                                                                  && !x.IsReturn
                                                                                  &&x.EntityDate ==searchMetadata.FromDate
                                                                                  && (!IsNameInclude || x.TransactionLedgers.Any(y => y.Product.ProductName.Equals(searchMetadata.Name))));
             break;
         default:
             SearchResult = WposContext.TransactionRepository.GetTransctions(x => !x.IsSales
                                                                                  && !x.IsReturn
                                                                                  && (!IsNameInclude || x.TransactionLedgers.Any(y => y.Product.ProductName.Equals(searchMetadata.Name))));
             break;
     }
 }
Пример #2
0
 public override void SearchCommandExecute(SearchMetadata searchMetadata)
 {
     IsBusy = true;
     try
     {
         switch (SearchOptions)
         {
             case SearchOptions.DateRange:
                 SearchResult = WposContext.TransactionRepository.GetTransctions(x => x.IsSales
                                                                                      && !x.IsReturn
                                                                                      && x.EntityDate >= searchMetadata.FromDate
                                                                                      && x.EntityDate <= searchMetadata.ToDate
                                                                                      && (!IsNameInclude || x.TransactionLedgers.Any(y => y.Product.ProductName.Equals(searchMetadata.Name))));
                 break;
             case SearchOptions.SingleDate:
                 SearchResult = WposContext.TransactionRepository.GetTransctions(x => x.IsSales
                                                                                      && !x.IsReturn
                                                                                      && x.EntityDate == searchMetadata.FromDate
                                                                                      && (!IsNameInclude || x.TransactionLedgers.Any(y => y.Product.ProductName.Equals(searchMetadata.Name))));
                 break;
             default:
                 SearchResult = WposContext.TransactionRepository.GetTransctions(x => x.IsSales
                                                                                       && !x.IsReturn
                                                                                       && (!IsNameInclude || x.TransactionLedgers.Any(y => y.Product.ProductName.Equals(searchMetadata.Name))));
                 break;
         }
     }
     catch (Exception ex)
     {
         LogExceptions.LogException(ex);
         ShowMessage.ShowMessage(String.Format("{0} Is unable To Search.", Title), MessageBoxImage.Error);
     }
     finally
     {
         IsBusy = false;
     }
 }