Ejemplo n.º 1
0
        public ExecuteResultEntity <ICollection <TicketPeriod> > QueryAll()
        {
            try
            {
                TicketPeriodRepository repo = RepositoryHelper.GetTicketPeriodRepository();
                database = repo.UnitOfWork;
                var queryresult = from q in repo.All()
                                  orderby q.DayLimit ascending
                                  select q;

                return(ExecuteResultEntity <ICollection <TicketPeriod> > .CreateResultEntity(
                           new Collection <TicketPeriod>(queryresult.ToList())));
            }
            catch (Exception ex)
            {
                return(ExecuteResultEntity <ICollection <TicketPeriod> > .CreateErrorResultEntity(ex));
            }
        }
Ejemplo n.º 2
0
        public Task <ExecuteResultEntity <ICollection <TicketPeriod> > > QueryForSelectBusinessItemAsync(Guid MaterialCategoriesId, string BusinessItem, Guid ManufacturersId)
        {
            try
            {
                TicketPeriodRepository repo = RepositoryHelper.GetTicketPeriodRepository();
                database = repo.UnitOfWork;
                var queryresult = from q in repo.All()
                                  from b in q.ManufacturersBussinessItems
                                  where b.MaterialCategoriesId == MaterialCategoriesId &&
                                  b.Name.Contains(BusinessItem) && b.ManufacturersId == ManufacturersId
                                  orderby q.DayLimit ascending
                                  select q;

                return(Task.FromResult(ExecuteResultEntity <ICollection <TicketPeriod> > .CreateResultEntity(
                                           new Collection <TicketPeriod>(queryresult.Distinct().ToList()))));
            }
            catch (Exception ex)
            {
                return(Task.FromResult(ExecuteResultEntity <ICollection <TicketPeriod> > .CreateErrorResultEntity(ex)));

                throw;
            }
        }