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


C# IWorkspace.Add方法代码示例

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


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

示例1: BatchCreateMenuItems

        public IEnumerable<MenuItem> BatchCreateMenuItems(string[] values, IWorkspace workspace)
        {
            var ds = CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;

            IList<MenuItem> result = new List<MenuItem>();
            if (values.Length > 0)
            {
                var currentCategory = Resources.Common;

                foreach (var item in values)
                {
                    if (item.StartsWith("#"))
                    {
                        currentCategory = item.Trim('#', ' ');
                    }
                    else if (item.Contains(" "))
                    {
                        IList<string> parts = new List<string>(item.Split(' '));
                        var price = ConvertToDecimal(parts[parts.Count - 1], ds);
                        parts.RemoveAt(parts.Count - 1);

                        var itemName = string.Join(" ", parts.ToArray());
                        var mi = MenuItem.Create();
                        mi.Name = itemName;
                        mi.Portions[0].Price.Amount = price;
                        mi.GroupCode = currentCategory;
                        workspace.Add(mi);
                        workspace.Add(mi.Portions[0]);
                        result.Add(mi);
                    }
                }
            }
            return result;
        }
开发者ID:basio,项目名称:veropos,代码行数:34,代码来源:DataCreationService.cs

示例2: BatchCreateReasons

 public IEnumerable<Reason> BatchCreateReasons(string[] values, int reasonType, IWorkspace workspace)
 {
     IList<Reason> result = new List<Reason>();
     if (values.Length > 0)
     {
         foreach (var reason in values.Select(value => new Reason { Name = value, ReasonType = reasonType }))
         {
             workspace.Add(reason);
             result.Add(reason);
         }
     }
     return result;
 }
开发者ID:basio,项目名称:veropos,代码行数:13,代码来源:DataCreationService.cs

示例3: StartWorkPeriod

        public void StartWorkPeriod(string description, IWorkspace workspace)
        {
            var latestWorkPeriod = workspace.Last<WorkPeriod>();
            if (latestWorkPeriod != null && latestWorkPeriod.StartDate == latestWorkPeriod.EndDate)
            {
                return;
            }

            var now = DateTime.Now;
            var newPeriod = new WorkPeriod
            {
                StartDate = now,
                EndDate = now,
                StartDescription = description,
            };

            workspace.Add(newPeriod);
            workspace.CommitChanges();
        }
开发者ID:GHLabs,项目名称:SambaPOS-3,代码行数:19,代码来源:WorkPeriodDao.cs

示例4: BatchCreateTables

 public IEnumerable<Table> BatchCreateTables(string[] values, IWorkspace workspace)
 {
     IList<Table> result = new List<Table>();
     if (values.Length > 0)
     {
         var currentCategory = Resources.Common;
         foreach (var value in values)
         {
             if (value.StartsWith("#"))
             {
                 currentCategory = value.Trim('#', ' ');
             }
             else
             {
                 var tableName = value;
                 var count = Dao.Count<Table>(y => y.Name == tableName.Trim());
                 if (count == 0)
                 {
                     var table = new Table { Name = value.Trim(), Category = currentCategory };
                     if (result.Count(x => x.Name.ToLower() == table.Name.ToLower()) == 0)
                     {
                         result.Add(table);
                         workspace.Add(table);
                     }
                 }
             }
         }
     }
     return result;
 }
开发者ID:hpbaotho,项目名称:sambapos,代码行数:30,代码来源:DataCreationService.cs

示例5: RestartWorkperiod

        private void RestartWorkperiod(IWorkspace workspace)
        {
            WorkPeriodService.StopWorkPeriod("");
            Thread.Sleep(1);
            InventoryService.DoWorkPeriodEnd();
            var pc = InventoryService.GetCurrentPeriodicConsumption();
            InventoryService.SavePeriodicConsumption(pc);
            foreach (var warehouseConsumption in pc.WarehouseConsumptions)
            {
                warehouseConsumption.PeriodicConsumptionId = pc.Id;
                workspace.Add(warehouseConsumption);
                warehouseConsumption.PeriodicConsumptionItems.ToList().ForEach(x =>
                {
                    x.WarehouseConsumptionId = warehouseConsumption.Id;
                    workspace.Add(x);
                });
            }

            WorkPeriodService.StartWorkPeriod("");
            Thread.Sleep(1);
            InventoryService.DoWorkPeriodStart();
        }
开发者ID:hperassi,项目名称:SambaPOS-3,代码行数:22,代码来源:InventoryTests.cs

示例6: CreateWarehouseTestContext

        private static void CreateWarehouseTestContext(WarehouseTestContext testContext, IWorkspace workspace)
        {
            workspace.Delete<InventoryTransactionType>(x => x.Id > 0);
            workspace.Delete<Entity>(x => x.Id > 0);

            testContext.Iskender = workspace.Single<MenuItem>(x => x.Name == "İskender");
            testContext.Iskender.Portions[0].MenuItemId = testContext.Iskender.Id;

            testContext.DonerEti = new InventoryItem { Name = "Döner Eti", BaseUnit = "GR", GroupCode = "", TransactionUnit = "KG", TransactionUnitMultiplier = 1000 };
            testContext.Yogurt = new InventoryItem { Name = "Yoğurt", BaseUnit = "GR", GroupCode = "", TransactionUnit = "KG", TransactionUnitMultiplier = 1000 };
            testContext.Pide = new InventoryItem { Name = "Pide", BaseUnit = "Yarım", GroupCode = "", TransactionUnit = "Adet", TransactionUnitMultiplier = 2 };
            testContext.ZeytinYagi = new InventoryItem { Name = "Zeytin Yağı", BaseUnit = "Ölçü", GroupCode = "", TransactionUnit = "Litre", TransactionUnitMultiplier = 100 };

            workspace.Add(testContext.DonerEti);
            workspace.Add(testContext.Yogurt);
            workspace.Add(testContext.Pide);
            workspace.Add(testContext.ZeytinYagi);

            testContext.IskenderRecipe = new Recipe { Name = "İskender Reçetesi", Portion = testContext.Iskender.Portions[0] };
            workspace.Add(testContext.IskenderRecipe);

            testContext.IskenderRecipe.RecipeItems.Add(new RecipeItem { InventoryItem = testContext.DonerEti, Quantity = 120 });
            testContext.IskenderRecipe.RecipeItems.Add(new RecipeItem { InventoryItem = testContext.Yogurt, Quantity = 50 });
            testContext.IskenderRecipe.RecipeItems.Add(new RecipeItem { InventoryItem = testContext.Pide, Quantity = 2 });
            testContext.IskenderRecipe.RecipeItems.Add(new RecipeItem { InventoryItem = testContext.ZeytinYagi, Quantity = 1 });

            testContext.LocalWarehouseAccountType = new AccountType { Name = "Local Warehouse Account Type" };
            testContext.SellerWarehouseAccountType = new AccountType { Name = "Seller Warehouse Account Type" };

            workspace.Add(testContext.LocalWarehouseAccountType);
            workspace.Add(testContext.SellerWarehouseAccountType);

            testContext.WarehouseType = workspace.Single<WarehouseType>(x => x.Name == Resources.Warehouses);
            testContext.WarehouseEntityType = new EntityType { Name = "Warehouse Resource Type" };
            workspace.Add(testContext.WarehouseEntityType);

            testContext.LocalWarehouseAccount = new Account { AccountTypeId = testContext.LocalWarehouseAccountType.Id };
            testContext.Seller1Account = new Account { AccountTypeId = testContext.SellerWarehouseAccountType.Id };
            testContext.Seller2Account = new Account { AccountTypeId = testContext.SellerWarehouseAccountType.Id };

            workspace.Add(testContext.LocalWarehouseAccount);
            workspace.Add(testContext.Seller1Account);
            workspace.Add(testContext.Seller2Account);

            testContext.LocalWarehouse = new Warehouse
                {
                    WarehouseTypeId = testContext.WarehouseType.Id
                };
            testContext.BarWarehouse = new Warehouse
                {
                    WarehouseTypeId = testContext.WarehouseType.Id
                };
            testContext.Seller1Warehouse = new Warehouse
                {
                    WarehouseTypeId = testContext.WarehouseType.Id
                };
            testContext.Seller2Warehouse = new Warehouse
                {
                    WarehouseTypeId = testContext.WarehouseType.Id
                };

            workspace.Add(testContext.LocalWarehouse);
            workspace.Add(testContext.BarWarehouse);
            workspace.Add(testContext.Seller1Warehouse);
            workspace.Add(testContext.Seller2Warehouse);

            testContext.LocalWarehouseEntity = new Entity
                {
                    WarehouseId = testContext.LocalWarehouse.Id,
                    EntityTypeId = testContext.WarehouseEntityType.Id,
                    AccountId = testContext.LocalWarehouseAccount.Id
                };
            testContext.BarWarehouseEntity = new Entity
                {
                    WarehouseId = testContext.BarWarehouse.Id,
                    EntityTypeId = testContext.WarehouseEntityType.Id
                };
            testContext.Seller1WarehouseEntity = new Entity
                {
                    WarehouseId = testContext.Seller1Warehouse.Id,
                    EntityTypeId = testContext.WarehouseEntityType.Id,
                    AccountId = testContext.Seller1Account.Id
                };
            testContext.Seller2WarehouseEntity = new Entity
                {
                    WarehouseId = testContext.Seller2Warehouse.Id,
                    EntityTypeId = testContext.WarehouseEntityType.Id,
                    AccountId = testContext.Seller2Account.Id
                };

            workspace.Add(testContext.LocalWarehouseEntity);
            workspace.Add(testContext.BarWarehouseEntity);
            workspace.Add(testContext.Seller1WarehouseEntity);
            workspace.Add(testContext.Seller2WarehouseEntity);

            testContext.PurchaseAccountTransactionType = new AccountTransactionType
                                                             {
                                                                 SourceAccountTypeId =
                                                                     testContext.SellerWarehouseAccountType.Id,
                                                                 TargetAccountTypeId =
//.........这里部分代码省略.........
开发者ID:hperassi,项目名称:SambaPOS-3,代码行数:101,代码来源:InventoryTests.cs

示例7: BatchCreateMenuItems

        public IEnumerable<MenuItem> BatchCreateMenuItems(string[] values, IWorkspace workspace)
        {
            var ds = CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;

            IList<MenuItem> result = new List<MenuItem>();
            if (values.Length > 0)
            {
                var currentCategory = Resources.Common;

                foreach (var item in values)
                {
                    if (item.StartsWith("#"))
                    {
                        currentCategory = item.Trim('#', ' ');
                    }
                    else if (item.Contains("|"))
                    {
                        //Sundae|Small:1.99|Medium:2.99|Large:3.99
                        IList<string> parts = new List<string>(item.Split('|'));
                        var mi = MenuItem.Create();
                        mi.Name = parts[0];
                        for (int i = 1; i < parts.Count; i++)
                        {

                            var tokens = parts[i].Split(':');
                            if (tokens.Count() != 2)
                            {
                                var price = ConvertToDecimal(tokens[0], ds);
                                mi.Portions[i - 1].Price.Amount = price;
                            }
                            else
                            {

                                var price = ConvertToDecimal(tokens[1], ds);
                                if (mi.Portions.Count < i - 1)
                                {
                                    var mp = new MenuItemPortion();
                                    mp.Price = new Price(price,"");
                                    mp.Name = tokens[0];
                                    mi.Portions.Add(mp);
                                }

                            }

                        }
                        mi.GroupCode = currentCategory;
                        workspace.Add(mi);
                        foreach (var p in mi.Portions)
                        {
                            workspace.Add(p);
                        }

                        result.Add(mi);
                    }
                    else if (item.Contains(" "))
                    {
                        //Sundae 2.99
                        IList<string> parts = new List<string>(item.Split(' '));
                        var price = ConvertToDecimal(parts[parts.Count - 1], ds);
                        parts.RemoveAt(parts.Count - 1);

                        var itemName = string.Join(" ", parts.ToArray());
                        var mi = MenuItem.Create();
                        mi.Name = itemName;
                        mi.Portions[0].Price.Amount = price;
                        mi.GroupCode = currentCategory;
                        workspace.Add(mi);
                        workspace.Add(mi.Portions[0]);
                        result.Add(mi);
                    }
                }
            }
            return result;
        }
开发者ID:emreeren,项目名称:SambaPOS-2,代码行数:74,代码来源:DataCreationService.cs


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