本文整理汇总了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));
}
示例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();
}
示例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
}
}
};
}
}
示例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));
}
示例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;
}