Ejemplo n.º 1
0
        /// <summary>
        /// 連動下拉單查詢交易品項
        /// </summary>
        /// <param name="MaterialCategoriesId"></param>
        /// <returns></returns>
        public Task <ExecuteResultEntity <ICollection <ManufacturersBussinessItems> > > GetBussinessItemsListWithMaterialCategoriesAsync(Guid MaterialCategoriesId)
        {
            //, Guid TranscationCategoriesId, Guid TicketPeriodId
            try
            {
                ManufacturersBussinessItemsRepository repo = RepositoryHelper.GetManufacturersBussinessItemsRepository();
                database = repo.UnitOfWork;

                var matchedresult = repo
                                    .Where(w => w.MaterialCategoriesId == MaterialCategoriesId)
                                    .Distinct()
                                    .ToList();

                return(Task.FromResult(ExecuteResultEntity <ICollection <ManufacturersBussinessItems> > .CreateResultEntity(
                                           new Collection <ManufacturersBussinessItems>(matchedresult))));
            }
            catch (Exception ex)
            {
                return(Task.FromResult(ExecuteResultEntity <ICollection <ManufacturersBussinessItems> > .CreateErrorResultEntity(ex)));
            }
        }