/// <summary> /// check activty code template /// </summary> /// <param name="storeOrders"></param> /// <param name="productActivityType"></param> /// <param name="func"></param> /// <returns></returns> private ServiceResult CheckActivity(IList <StoreOrderItem> storeOrders, ProductActivityType productActivityType, Func <Activity, ServiceResult> func) { //get order products var orderProductCounts = GetOrderProducts(storeOrders); var orderProductIds = orderProductCounts.Select(o => o.ProductId).ToList(); //get all activities var currentOrderActivities = Resolve <IActivityApiService>().GetList(productActivityType, orderProductIds).ToList(); if (currentOrderActivities.Count <= 0) { return(ServiceResult.Success); } //loop proccess acitity foreach (var item in currentOrderActivities) { var result = func(item); if (!result.Succeeded) { return(result); } } return(ServiceResult.Success); }
/// <summary> /// get list by product activity type /// </summary> /// <param name="activityType"></param> /// <param name="productIds"></param> /// <returns></returns> public IList <Activity> GetList(ProductActivityType activityType, IList <long> productIds) { var key = activityType.GetDisplayResourceTypeName(); return(Resolve <IActivityService>().GetList(u => u.Key == key && productIds.Contains(u.ProductId))); }
public static ProductActivityType Create() { var doc = new ProductActivityType { UBLVersionID = "2.1", ProfileID = "bpid:urn:oasis:names:draft:bpss:ubl-2-1-cpfr-product-activity-draft", ID = "PA_758494", CopyIndicator = false, UUID = "349ABBAE-DF9D-40B4-849F-94C5FF9D1AF4", IssueDate = "2005-01-10", IssueTime = "12:00:01.000", Note = new TextType[] { new TextType { Value = "sample Document" } }, ActivityPeriod = new PeriodType { StartDate = "2005-02-26", EndDate = "2005-12-26" }, SenderParty = new PartyType { PartyIdentification = new PartyIdentificationType[] { new PartyIdentificationType { ID = "6903148000007" } }, PartyName = new PartyNameType[] { new PartyNameType { Name = "Consortial" } }, PostalAddress = new AddressType { StreetName = "Busy Street", BuildingName = "Thereabouts", BuildingNumber = "56A", CityName = "Farthing", PostalZone = "AA99 1BB", CountrySubentity = "Heremouthshire", AddressLine = new AddressLineType[] { new AddressLineType { Line = "The Roundabout" } }, Country = new CountryType { IdentificationCode = "GB" } }, PartyTaxScheme = new PartyTaxSchemeType[] { new PartyTaxSchemeType { RegistrationName = "Farthing Purchasing Consortium", CompanyID = "175 269 2355", ExemptionReason = new TextType[] { new TextType { Value = "N/A" } }, TaxScheme = new TaxSchemeType { ID = "VAT", TaxTypeCode = "VAT" } } }, Contact = new ContactType { Name = "Mrs Bouquet", Telephone = "0158 1233714", Telefax = "0158 1233856", ElectronicMail = "*****@*****.**" } }, ReceiverParty = new PartyType { PartyIdentification = new PartyIdentificationType[] { new PartyIdentificationType { ID = "2203148000007" } }, PartyName = new PartyNameType[] { new PartyNameType { Name = "IYT Corporation" } }, PostalAddress = new AddressType { StreetName = "Avon Way", BuildingName = "Thereabouts", BuildingNumber = "56A", CityName = "Bridgtow", PostalZone = "ZZ99 1ZZ", CountrySubentity = "Avon", AddressLine = new AddressLineType[] { new AddressLineType { Line = "3rd Floor, Room 5" } }, Country = new CountryType { IdentificationCode = "GB" } }, PartyTaxScheme = new PartyTaxSchemeType[] { new PartyTaxSchemeType { RegistrationName = "Bridgtow District Council", CompanyID = "12356478", ExemptionReason = new TextType[] { new TextType { Value = "Local Authority" } }, TaxScheme = new TaxSchemeType { ID = "UK VAT", TaxTypeCode = "VAT" } } }, Contact = new ContactType { Name = "Mr Fred Churchill", Telephone = "0127 2653214", Telefax = "0127 2653215", ElectronicMail = "*****@*****.**" } }, SupplyChainActivityDataLine = new ActivityDataLineType[] { new ActivityDataLineType { ID = "SCADL_SHIPMENT001", SupplyChainActivityTypeCode = "SHIPMENTS", BuyerCustomerParty = new CustomerPartyType { Party = new PartyType { PartyIdentification = new PartyIdentificationType[] { new PartyIdentificationType { ID = "2203148000007" } } } }, SellerSupplierParty = new SupplierPartyType { Party = new PartyType { PartyIdentification = new PartyIdentificationType[] { new PartyIdentificationType { ID = "6903148000007" } } } }, ActivityOriginLocation = new LocationType { }, SalesItem = new SalesItemType[] { new SalesItemType { Quantity = new QuantityType { unitCode = "KGM", Value = 20M }, Item = new ItemType { StandardItemIdentification = new ItemIdentificationType { ID = "06110123456784" } } } } } } }; doc.Xmlns = new System.Xml.Serialization.XmlSerializerNamespaces(new[] { new XmlQualifiedName("cac", "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"), new XmlQualifiedName("cbc", "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"), }); return(doc); }
public static ProductActivityType Create() { var doc = new ProductActivityType { UBLVersionID = "2.1", ID = "ID0009", CopyIndicator = false, IssueDate = "2010-04-10", Note = new List <TextType>() { new TextType { Value = @"Report about movements of goods between Beta Shop's locations located in Emilia-Romagna." } }, ActivityPeriod = new PeriodType { StartDate = "2010-04-09" }, SenderParty = new PartyType { PartyName = new List <PartyNameType>() { new PartyNameType { Name = "Beta Shop" } }, PostalAddress = new AddressType { StreetName = "Via Emilia", BuildingNumber = "1", CityName = "Modena", PostalZone = "41121", Country = new CountryType { IdentificationCode = "IT", Name = "Italy" } }, Contact = new ContactType { Name = "Mr Delta", Telephone = "0039 059 33000000", Telefax = "0039 059 33000055", ElectronicMail = "*****@*****.**" } }, ReceiverParty = new PartyType { PartyName = new List <PartyNameType>() { new PartyNameType { Name = "Arancio Forniture spa" } }, PostalAddress = new AddressType { StreetName = "Via Dell'Arcoveggio", BuildingNumber = "403", CityName = "Bologna", PostalZone = "40129", Country = new CountryType { IdentificationCode = "IT", Name = "Italy" } }, Contact = new ContactType { Name = "Mr Rossi", Telephone = "0039 051 23000000", Telefax = "0039 051 23000023", ElectronicMail = "*****@*****.**" } }, SupplyChainActivityDataLine = new List <ActivityDataLineType>() { new ActivityDataLineType { ID = "1", SupplyChainActivityTypeCode = "SHIPMENTS", ActivityOriginLocation = new LocationType { Address = new AddressType { StreetName = "Via Dell'Arcoveggio", BuildingNumber = "403", CityName = "Bologna", PostalZone = "40129", Country = new CountryType { IdentificationCode = "IT", Name = "Italy" } } }, ActivityFinalLocation = new LocationType { Description = new List <TextType>() { new TextType { Value = "Shop in the city center" } }, Address = new AddressType { StreetName = "Via Rizzoli", BuildingNumber = "208", CityName = "Bologna", PostalZone = "40121", Country = new CountryType { IdentificationCode = "IT", Name = "Italy" } } }, SalesItem = new List <SalesItemType>() { new SalesItemType { Quantity = new QuantityType { unitCode = "NAR", Value = 20M }, Item = new ItemType { Description = new List <TextType>() { new TextType { Value = "shirt" } }, BuyersItemIdentification = new ItemIdentificationType { ID = "SH009" }, SellersItemIdentification = new ItemIdentificationType { ID = "DD88" } } } }, }, new ActivityDataLineType { ID = "2", SupplyChainActivityTypeCode = "SHIPMENTS", ActivityOriginLocation = new LocationType { Address = new AddressType { StreetName = "Via Dell'Arcoveggio", BuildingNumber = "403", CityName = "Bologna", PostalZone = "40129", Country = new CountryType { IdentificationCode = "IT", Name = "Italy" } } }, ActivityFinalLocation = new LocationType { Description = new List <TextType>() { new TextType { Value = "Store" } }, Address = new AddressType { StreetName = "Via Delle Fonti", BuildingNumber = "209", CityName = "Bologna", PostalZone = "40128", Country = new CountryType { IdentificationCode = "IT", Name = "Italy" } } }, SalesItem = new List <SalesItemType>() { new SalesItemType { Quantity = new QuantityType { unitCode = "NAR", Value = 200M }, Item = new ItemType { Description = new List <TextType>() { new TextType { Value = "shirt" } }, BuyersItemIdentification = new ItemIdentificationType { ID = "SH009" }, SellersItemIdentification = new ItemIdentificationType { ID = "DD88" } } }, new SalesItemType { Quantity = new QuantityType { unitCode = "NAR", Value = 150M }, Item = new ItemType { Description = new List <TextType>() { new TextType { Value = "trousers" } }, BuyersItemIdentification = new ItemIdentificationType { ID = "TH009" }, SellersItemIdentification = new ItemIdentificationType { ID = "DA008" } } } }, } }, }; doc.Xmlns = new System.Xml.Serialization.XmlSerializerNamespaces(new[] { new XmlQualifiedName("cbc", "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"), new XmlQualifiedName("cac", "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"), }); return(doc); }
public static ProductActivityType Create() { var doc = new ProductActivityType { UBLVersionID = "2.1", ID = "ID0113", CopyIndicator = false, IssueDate = "2010-04-08", Note = new TextType[] { new TextType { Value = "Report about sales of goods in Beta Shop's shops located in Bologna." } }, ActivityPeriod = new PeriodType { StartDate = "2010-04-07" }, SenderParty = new PartyType { PartyName = new PartyNameType[] { new PartyNameType { Name = "Beta Shop" } }, PostalAddress = new AddressType { StreetName = "Via Emilia", BuildingNumber = "1", CityName = "Modena", PostalZone = "41121", Country = new CountryType { IdentificationCode = "IT", Name = "Italy" } }, Contact = new ContactType { Name = "Mr Delta", Telephone = "0039 059 33000000", Telefax = "0039 059 33000055", ElectronicMail = "*****@*****.**" } }, ReceiverParty = new PartyType { PartyName = new PartyNameType[] { new PartyNameType { Name = "Arancio Forniture spa" } }, PostalAddress = new AddressType { Floor = "5", Room = "29", StreetName = "Via Dell'Arcoveggio", BuildingNumber = "403", Department = "Marketing Office", CityName = "Bologna", PostalZone = "40129", Country = new CountryType { IdentificationCode = "IT", Name = "Italy" } }, Contact = new ContactType { Name = "Mr Rossi", Telephone = "0039 051 23000000", Telefax = "0039 051 23000023", ElectronicMail = "*****@*****.**" } }, SupplyChainActivityDataLine = new ActivityDataLineType[] { new ActivityDataLineType { ID = "1", SupplyChainActivityTypeCode = "SALES", ActivityOriginLocation = new LocationType { Description = new TextType[] { new TextType { Value = "Shop in the city center" } }, Address = new AddressType { StreetName = "Via Rizzoli", BuildingNumber = "208", CityName = "Bologna", PostalZone = "40121", Country = new CountryType { IdentificationCode = "IT", Name = "Italy" } } }, SalesItem = new SalesItemType[] { new SalesItemType { Quantity = new QuantityType { unitCode = "NAR", Value = 8M }, Item = new ItemType { Description = new TextType[] { new TextType { Value = "shirt" } }, BuyersItemIdentification = new ItemIdentificationType { ID = "SH009" }, SellersItemIdentification = new ItemIdentificationType { ID = "DD88" } } }, new SalesItemType { Quantity = new QuantityType { unitCode = "NAR", Value = 3M }, Item = new ItemType { Description = new TextType[] { new TextType { Value = "trousers" } }, BuyersItemIdentification = new ItemIdentificationType { ID = "TH009" }, SellersItemIdentification = new ItemIdentificationType { ID = "DA008" } } } } } } }; doc.Xmlns = new System.Xml.Serialization.XmlSerializerNamespaces(new[] { new XmlQualifiedName("cbc","urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"), new XmlQualifiedName("cac","urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"), }); return doc; }