当前位置: 首页>>代码示例>>C#>>正文


C# ISearchService.GetOrdersByWorkgroups方法代码示例

本文整理汇总了C#中ISearchService.GetOrdersByWorkgroups方法的典型用法代码示例。如果您正苦于以下问题:C# ISearchService.GetOrdersByWorkgroups方法的具体用法?C# ISearchService.GetOrdersByWorkgroups怎么用?C# ISearchService.GetOrdersByWorkgroups使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISearchService的用法示例。


在下文中一共展示了ISearchService.GetOrdersByWorkgroups方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GenerateDisplayTable

        public void GenerateDisplayTable(ISearchService indexSearchService, IRepositoryFactory repositoryFactory,IWorkgroupService workgroupService, int workgroupId, DateTime month)
        {
            Check.Require(month.Day == 1);
            var endMonth = month.AddMonths(1);

            var workgroup = repositoryFactory.WorkgroupRepository.Queryable.Single(a => a.Id == workgroupId);
            var allChildWorkgroups = new List<int>();
            allChildWorkgroups.Add(workgroupId);
            if (workgroup.Administrative)
            {
                allChildWorkgroups = workgroupService.GetChildWorkgroups(workgroupId);
            }

            Columns = new List<ReportProcessingColumns>();
            var workgroups = repositoryFactory.WorkgroupRepository.Queryable.Where(a => allChildWorkgroups.Contains(a.Id)).ToList();
            var matchingOrders = indexSearchService.GetOrdersByWorkgroups(workgroups, month, endMonth);
            foreach (var matchingOrder in matchingOrders.Where(a => a.IsComplete && a.StatusId != OrderStatusCode.Codes.Denied && a.StatusId != OrderStatusCode.Codes.Cancelled))
            {

                var column = new ReportProcessingColumns();
                var order = repositoryFactory.OrderRepository.Queryable.Single(a => a.Id == matchingOrder.OrderId);

                column.Organization = order.Workgroup.PrimaryOrganization.Id;
                column.Workgroup = order.Workgroup.Name;
                column.OrderRequestNumber = order.RequestNumber;
                column.OrderId = order.Id;
                var orderHistory = order.OrderTrackings.LastOrDefault(a => a.StatusCode.Id == OrderStatusCode.Codes.AccountManager && a.Description.StartsWith("approved"));
                if (orderHistory != null)
                {
                    column.ArrivedAtPurchaser = orderHistory.DateCreated;
                }

                orderHistory = order.OrderTrackings.LastOrDefault(a => a.Description.StartsWith("rerouted to purchaser"));
                if (orderHistory != null)
                {
                    column.ReroutedToPurchaserDate = orderHistory.DateCreated;
                    column.ReRoutedToPurchaserBy = orderHistory.User.FullName;
                    column.ReroutedToPurchaserName = orderHistory.Description.Substring(22);
                    if (column.ArrivedAtPurchaser != null)
                    {
                        column.ReRoutTime = column.ReroutedToPurchaserDate.Value - column.ArrivedAtPurchaser.Value;
                    }
                }
                else if(OnlyShowReRouted)
                {
                    continue;
                }
                orderHistory = order.OrderTrackings.FirstOrDefault(a => a.StatusCode.IsComplete);
                if (orderHistory != null)
                {
                    column.CompletedByPurchaserDate = orderHistory.DateCreated;
                    column.CompletedByPurchaserName = orderHistory.User.FullName;
                    if (column.ArrivedAtPurchaser != null && column.ReroutedToPurchaserDate != null)
                    {
                        column.CompletionTime = column.CompletedByPurchaserDate.Value - column.ReroutedToPurchaserDate.Value;
                    }
                    else if (column.ArrivedAtPurchaser != null && column.ReroutedToPurchaserDate == null)
                    {
                        column.CompletionTime = column.CompletedByPurchaserDate.Value - column.ArrivedAtPurchaser.Value;
                    }
                }
                Columns.Add(column);
            }
        }
开发者ID:ucdavis,项目名称:Purchasing,代码行数:64,代码来源:ReportProcessingTimeViewModel.cs


注:本文中的ISearchService.GetOrdersByWorkgroups方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。