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


C# Guid.Count方法代码示例

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


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

示例1: GetProductVariantDisplayWithAttributes

 /// <summary>
 /// Gets the <see cref="ProductVariantDisplay"/> with matching with attributes from the product.
 /// </summary>
 /// <param name="product">
 /// The product.
 /// </param>
 /// <param name="optionChoices">
 /// The option choices.
 /// </param>
 /// <returns>
 /// The <see cref="ProductVariantDisplay"/>.
 /// </returns>        
 public static ProductVariantDisplay GetProductVariantDisplayWithAttributes(this ProductDisplay product, Guid[] optionChoices)
 {
     return
         product.ProductVariants.FirstOrDefault(
             x =>
             x.Attributes.Count() == optionChoices.Count()
             && optionChoices.All(key => x.Attributes.FirstOrDefault(att => att.Key == key) != null));
 }
开发者ID:EricMunn,项目名称:Merchello,代码行数:20,代码来源:ProductDisplayExtensions.cs

示例2: SendMessage

 public void SendMessage(string subject, string body, Guid authorID, Guid[] recipientIDs)
 {
     var recipients = _repository.FindAllBy<Traveler>(t => recipientIDs.Contains(t.TravelerID));
     if (recipients == null || recipients.Count() != recipientIDs.Count()) throw new TravelerNotFoundException();
     Traveler author = _repository.FindBy<Traveler>(r => r.TravelerID == authorID);
     if (author == null) throw new TravelerNotFoundException();
     Message message = MessageFactory.CreateMessageFrom(subject, body, author, recipients);
     _repository.Add<Message>(message);
     _repository.Commit();
 }
开发者ID:Nimrodda,项目名称:TravelersAround,代码行数:10,代码来源:MessageService.cs

示例3: GetDummyShipments

 private IEnumerable<Shipment> GetDummyShipments(Guid[] keys)
 {
     var shipmentKeys = new[] {Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid()};
     for (int i = 0; i < keys.Count(); i++)
     {
         yield return new Shipment
         {
             Key = keys[i],
             AffiliateKey = Guid.NewGuid(),
             ShipmentTypeKey = shipmentKeys[i],
             Price = 12.23M*(i + 1),
             ReceiverFirstName = string.Format("Receiver {0} FirstName", i),
             ReceiverLastName = string.Format("Receiver {0} Lastname", i),
             ReceiverAddress = string.Format("Receiver {0} Address", i),
             ReceiverCity = string.Format("Receiver {0} City", i),
             ReceiverCountry = string.Format("Receiver {0} Country", i),
             ReceiverPhone = string.Format("Receiver {0} Phone", i),
             ReceiverZipCode = "12345",
             ReceiverEmail = "[email protected]",
             CreatedOn = DateTime.Now,
             ShipmentType = new ShipmentType
             {
                 Key = shipmentKeys[i],
                 CompanyName = "Nile",
                 Price = 4.19M,
                 CreatedOn = DateTime.Now,
             },
             ShipmentStates = new List<ShipmentState>
             {
                 new ShipmentState
                 {
                     Key = Guid.NewGuid(),
                     ShipmentKey = keys[i],
                     Status = ShipmentStatus.Ordered
                 },
                 new ShipmentState
                 {
                     Key = Guid.NewGuid(),
                     ShipmentKey = keys[i],
                     Status = ShipmentStatus.Scheduled
                 }
             }
         };
     }
 }
开发者ID:hakeemsm,项目名称:ShippingExpress,代码行数:45,代码来源:ShipmentControllerIntegrationTests.cs

示例4: GetProductVariantWithAttributes

 /// <summary>
 /// Get a product variant from a product by it's collection of attributes
 /// </summary>
 /// <param name="productKey">The product key</param>
 /// <param name="attributeKeys">The option choices (attributeKeys)</param>
 /// <returns>The <see cref="ProductVariantDisplay"/></returns>
 public ProductVariantDisplay GetProductVariantWithAttributes(Guid productKey, Guid[] attributeKeys)
 {
     var product = Query.Product.GetByKey(productKey);
     return product.ProductVariants.FirstOrDefault(x => x.Attributes.Count() == attributeKeys.Count() && attributeKeys.All(key => x.Attributes.FirstOrDefault(att => att.Key == key) != null));
 }
开发者ID:EricMunn,项目名称:Merchello,代码行数:11,代码来源:MerchelloHelper.cs

示例5: GetProductVariantDisplayWithAttributes

        /// <summary>
        /// Gets the <see cref="ProductVariantDisplay"/> with matching with attributes from the product.
        /// </summary>
        /// <param name="product">
        /// The product.
        /// </param>
        /// <param name="optionChoices">
        /// The option choices.
        /// </param>
        /// <returns>
        /// The <see cref="ProductVariantDisplay"/>.
        /// </returns>        
        public static IProductVariantContent GetProductVariantDisplayWithAttributes(this IProductContent product, Guid[] optionChoices)
        {
            var variant =
                product.ProductVariants.FirstOrDefault(
                    x =>
                    x.Attributes.Count() == optionChoices.Count()
                    && optionChoices.All(key => x.Attributes.FirstOrDefault(att => att.Key == key) != null));

            if (variant == null)
            {
                MultiLogHelper.Debug(typeof(ProductContentExtensions), "Could not find IProductVariantContent with keys matching choices in optionChoices array.");
            }

            return variant;
        }
开发者ID:rustyswayne,项目名称:Merchello,代码行数:27,代码来源:ProductContentExtensions.cs


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