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


C# IWorkspace.All方法代码示例

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


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

示例1: CreatePeriodicConsumptionItems

        private static void CreatePeriodicConsumptionItems(PeriodicConsumption pc, IWorkspace workspace)
        {
            var previousPc = GetPreviousPeriodicConsumption(workspace);
            var transactionItems = GetTransactionItems();
            foreach (var inventoryItem in workspace.All<InventoryItem>())
            {
                var iItem = inventoryItem;
                var pci = new PeriodicConsumptionItem { InventoryItem = inventoryItem };
                pci.UnitMultiplier = pci.InventoryItem.TransactionUnitMultiplier > 0 ? pci.InventoryItem.TransactionUnitMultiplier : 1;
                pc.PeriodicConsumptionItems.Add(pci);
                var previousCost = 0m;
                if (previousPc != null)
                {
                    var previousPci = previousPc.PeriodicConsumptionItems.SingleOrDefault(x => x.InventoryItem.Id == iItem.Id);
                    if (previousPci != null) pci.InStock =
                        previousPci.PhysicalInventory != null
                        ? previousPci.PhysicalInventory.GetValueOrDefault(0)
                        : previousPci.GetInventoryPrediction();
                    if (previousPci != null)
                        previousCost = previousPci.Cost * pci.InStock;
                }
                var tim = transactionItems.Where(x => x.InventoryItem.Id == iItem.Id);
                pci.Purchase = tim.Sum(x => x.Quantity * x.Multiplier) / pci.UnitMultiplier;
                var totalPrice = tim.Sum(x => x.Price * x.Quantity);
                if (pci.InStock > 0 || pci.Purchase > 0)
                {
                    pci.Cost = pci.InStock > 0
                                   ? decimal.Round((totalPrice + previousCost)/(pci.InStock + pci.Purchase), 2)
                                   : decimal.Round(totalPrice/pci.Purchase, 2);
                }

            }
        }
开发者ID:hpbaotho,项目名称:sambapos,代码行数:33,代码来源:InventoryService.cs

示例2: ImportPlainText

        private static IEnumerable<Entity> ImportPlainText(string[] values, IWorkspace workspace)
        {
            IList<Entity> result = new List<Entity>();
            if (values.Length > 0)
            {
                var entityTypes = workspace.All<EntityType>().ToList();
                EntityType currentEntityType = null;

                foreach (var value in values)
                {
                    if (value.StartsWith("#"))
                    {
                        currentEntityType = CreateEntityType(value, entityTypes);
                    }
                    else if (currentEntityType != null)
                    {
                        var entity = CreateEntity(workspace, value, currentEntityType);
                        if (entity != null)
                        {
                            result.Add(entity);
                        }
                    }
                }
            }
            return result;
        }
开发者ID:GHLabs,项目名称:SambaPOS-3,代码行数:26,代码来源:EntityCreator.cs

示例3: GetTickets

 private static IEnumerable<Ticket> GetTickets(IWorkspace workspace)
 {
     try
     {
         if (CurrentWorkPeriod.StartDate == CurrentWorkPeriod.EndDate)
             return Dao.Query<Ticket>(x => x.LastPaymentDate >= CurrentWorkPeriod.StartDate,
                                      x => x.Payments, x => x.TaxServices,
                                      x => x.Discounts, x => x.TicketItems,
                                      x => x.TicketItems.Select(y => y.Properties));
         return
             Dao.Query<Ticket>(x =>
                 x.LastPaymentDate >= CurrentWorkPeriod.StartDate && x.LastPaymentDate < CurrentWorkPeriod.EndDate,
                 x => x.Payments, x => x.TaxServices, x => x.Discounts, x => x.TicketItems.Select(y => y.Properties));
     }
     catch (SqlException)
     {
         if (CurrentWorkPeriod.StartDate == CurrentWorkPeriod.EndDate)
             return workspace.All<Ticket>(x => x.LastPaymentDate >= CurrentWorkPeriod.StartDate);
         return
             workspace.All<Ticket>(x =>
                 x.LastPaymentDate >= CurrentWorkPeriod.StartDate && x.LastPaymentDate < CurrentWorkPeriod.EndDate);
     }
 }
开发者ID:hpbaotho,项目名称:sambapos,代码行数:23,代码来源:ReportContext.cs


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