public static void ReadItemAttributes(Resources context, string autheader) { var colorGroups = AXServiceConnector.CallOdataEndpoint <VariantGroupDTO>("ProductColorGroups", "", autheader).Result.value; DataAccess.DataWriter.WriteToTable <VariantGroupDTO>(colorGroups.GetDataReader(), "[ax].[ProductColorGroup]"); var sizeGroups = AXServiceConnector.CallOdataEndpoint <VariantGroupDTO>("ProductSizeGroups", "", autheader).Result.value; DataAccess.DataWriter.WriteToTable <VariantGroupDTO>(sizeGroups.GetDataReader(), "[ax].[ProductSizeGroup]"); var styleGroups = AXServiceConnector.CallOdataEndpoint <VariantGroupDTO>("ProductStyleGroups", "", autheader).Result.value; DataAccess.DataWriter.WriteToTable <VariantGroupDTO>(styleGroups.GetDataReader(), "[ax].[ProductStyleGroup]"); var seasonGroups = AXServiceConnector.CallOdataEndpoint <VariantGroupDTO>("RetailSeasonGroups", "", autheader).Result.value; DataAccess.DataWriter.WriteToTable <VariantGroupDTO>(seasonGroups.GetDataReader(), "[ax].[SeasonGroup]"); var season = ReadSeasonTable(context); DataAccess.DataWriter.WriteToTable(season, "[ax].[SeasonTable]"); var colorGroupLines = ReadColorGroupLines(context); DataAccess.DataWriter.WriteToTable(colorGroupLines, "[ax].[ProductColorGroupLine]"); var sizeGroupLines = ReadSizeGroupLines(context); DataAccess.DataWriter.WriteToTable(sizeGroupLines, "[ax].[ProductSizeGroupLine]"); var styleGroupLines = ReadStyleGroupLines(context); DataAccess.DataWriter.WriteToTable(styleGroupLines, "[ax].[ProductStyleGroupLine]"); }
public long GetNextRecId(long recId, string webMethod, string adalHeader) { string postData = "{ \"lastRecId\": " + recId.ToString() + " }"; var result = AXServiceConnector.CallAGRServiceScalar <Int64>("AGRInventTransService", webMethod, postData, adalHeader); return(result.Result); }
private bool WriteInventTrans <T>(Int64 recId, Int64 pageSize, string webMethod, string destTable, string adalHeader) { AXServiceConnector connector = new AXServiceConnector(); string postData = "{ \"minRecId\": " + recId.ToString() + ", \"maxRecId\" : " + (recId + pageSize).ToString() + "}"; var result = AXServiceConnector.CallAGRServiceArray <T>("AGRInventTransService", webMethod, postData, adalHeader); var reader = result.Result.GetDataReader(); DataAccess.DataWriter.WriteToTable(reader, "[ax]." + destTable); return(result.Result.Any()); }
public static void GetBom(string header) { var bomHeaders = AXServiceConnector.CallOdataEndpoint <BillOfMaterialsHeader>("BillOfMaterialsHeaders", null, header).Result; DataAccess.DataWriter.WriteToTable <BillOfMaterialsHeader>(bomHeaders.value.GetDataReader(), "[ax].[BillOfMaterialsHeaders]"); var bomLines = AXServiceConnector.CallOdataEndpoint <BillOfMaterialsLine>("BillOfMaterialsLines", null, header).Result; DataAccess.DataWriter.WriteToTable <BillOfMaterialsLine>(bomLines.value.GetDataReader(), "[ax].[BillOfMaterialsLines]"); var bomVersion = AXServiceConnector.CallOdataEndpoint <BillOfMaterialsVersion>("BillOfMaterialsVersions", null, header).Result; DataAccess.DataWriter.WriteToTable <BillOfMaterialsVersion>(bomVersion.value.GetDataReader(), "[ax].[BillOfMaterialsVersions]"); }
public static void WriteCategories(string authHeader) { var roles = AXServiceConnector.CallOdataEndpoint <CategoryRoleDTO>("RetailEcoResCategoryHierarchyRole", "", authHeader).Result.value; DataAccess.DataWriter.WriteToTable(roles.GetDataReader(), "[ax].[ECORESCATEGORYHIERARCHYROLE]"); var hierarchy = AXServiceConnector.CallOdataEndpoint <RetailEcoResCategoryHierarchy>("RetailEcoResCategoryHierarchy", "", authHeader).Result.value; DataAccess.DataWriter.WriteToTable(hierarchy.GetDataReader(), "[ax].[ECORESCATEGORYHIERARCHY]"); var category = AXServiceConnector.CallOdataEndpoint <RetailEcoResCategory>("RetailEcoResCategory", "", authHeader).Result.value; DataAccess.DataWriter.WriteToTable <RetailEcoResCategory>(category.GetDataReader(), "[ax].[ECORESCATEGORY]"); var prodCat = AXServiceConnector.CallOdataEndpoint <AGREcoResProductCategory>("AGREcoResProductCategories", "", authHeader).Result.value; DataAccess.DataWriter.WriteToTable <AGREcoResProductCategory>(prodCat.GetDataReader(), "[ax].[ECORESPRODUCTCATEGORY]"); }
public static void CreateSku(Resources context, string adalHeader, DistinctProduct distinctProduct, ReleasedDistinctProductsWriteDTO releasedDistinctProduct, List <ReleasedProductVariantDTO> variants) { //First add distinct product //context.AddToDistinctProducts(distinctProduct); //context.SaveChanges(); //var result = AXServiceConnector.CallOdataEndpointPost<ReleasedDistinctProductsDTO>("ReleasedDistinctProducts", null, adalHeader, releasedDistinctProduct).Result; //Add distinct product //context.AddToReleasedDistinctProducts(releasedDistinctProduct); //context.SaveChanges(); foreach (var variant in variants) { //context.AddToReleasedProductVariants(variant); //context.SaveChanges(); var variantResult = AXServiceConnector.CallOdataEndpointPost <ReleasedProductVariantDTO>("ReleasedProductVariants", null, adalHeader, variant).Result; } }
public static void WriteLocationsAndVendors(Resources context, string authHeader) { //var channel = ReadRetailChannel(context); var channel = AXServiceConnector.CallOdataEndpoint <RetailChannel>("RetailChannels", // "?$filter=ChannelType eq Microsoft.Dynamics.DataEntities.RetailChannelType'RetailStore'", "", authHeader).Result.value.GetDataReader(); DataAccess.DataWriter.WriteToTable <RetailChannel>(channel, "[ax].[RETAILCHANNELTABLE]"); //var assortment = ReadRetailAssortment(context); var assortment = AXServiceConnector.CallOdataEndpoint <RetailAssortment>("RetailAssortments", "?$filter=Status eq Microsoft.Dynamics.DataEntities.RetailAssortmentStatusType'Published'", authHeader).Result.value.GetDataReader(); DataAccess.DataWriter.WriteToTable <RetailAssortment>(assortment, "[ax].[RETAILASSORTMENTTABLE]"); var locSetup = context.Locations.ToList().GetDataReader <Location>(); DataAccess.DataWriter.WriteToTable <Location>(locSetup, "[ax].[INVENTLOCATION]"); var dir = context.DirParties.ToList().GetDataReader <DirParty>(); DataAccess.DataWriter.WriteToTable <DirParty>(dir, "[ax].[DIRPARTYTABLE]"); var vendor = context.Vendors.ToList().GetDataReader <Vendor>(); DataAccess.DataWriter.WriteToTable <Vendor>(vendor, "[ax].[VENDTABLE]"); var channelLines = ReadRetailAssortmentChannelLines(context); DataAccess.DataWriter.WriteToTable(channelLines, "[ax].[RETAILASSORTMENTCHANNELLINE]"); var productLines = ReadRetailAssortmentProductLine(context); DataAccess.DataWriter.WriteToTable(productLines, "[ax].[RETAILASSORTMENTPRODUCTLINE]"); }
public static ItemDTO CreateItem(ItemDTO item, string header) { //ProductMasterWriteDTO master = new ProductMasterWriteDTO(); //master.AreIdenticalConfigurationsAllowed = NoYes.No; //master.HarmonizedSystemCode = ""; //master.IsAutomaticVariantGenerationEnabled = NoYes.Yes; //master.IsCatchWeightProduct = NoYes.No; //master.IsProductKit = NoYes.No; //master.IsProductVariantUnitConversionEnabled = NoYes.No; ////master.KPMInstructionGroupId = ""; ////master.KRFColorRatioCurve = ""; ////master.KRFSizeRatioCurve = ""; ////master.KRFStyleRatioCurve = ""; ////master.KRFUseRatioCurves = NoYes.Yes; //master.NMFCCode = ""; //master.ProductColorGroupId = "Basic"; //master.ProductDescription = ""; ////master.ProductDimensionGroupName = "CSF"; //master.ProductDimensionGroupName = "SizeCol"; //master.ProductName = dp.ProductName; //master.ProductNumber = dp.ProductNumber; //master.ProductSearchName = dp.ProductSearchName; //master.ProductSizeGroupId = "10-18"; //master.ProductStyleGroupId = ""; //master.VariantConfigurationTechnology = EcoResVariantConfigurationTechnologyType.PredefinedVariants; //master.RetailProductCategoryName = ""; //master.ProductType = EcoResProductType.Item; //master.STCCCode = ""; //master.TrackingDimensionGroupName = "None"; //master.StorageDimensionGroupName = "Ware"; var r = AXServiceConnector.CreateEntity <ProductMasterWriteDTO>("ProductMasters", null, header, item.productMaster, item.ErrorMessages).Result; item.productMaster = r; return(item); }
public static void WriteItems(Resources context, string authHeader) { var productMaster = AXServiceConnector.CallOdataEndpoint <ProductMasterReadDTO>("ProductMasters", "", authHeader).Result.value; DataAccess.DataWriter.WriteToTable <ProductMasterReadDTO>(productMaster.GetDataReader(), "[ax].[ProductMaster]"); var releasedMasters = AXServiceConnector.CallOdataEndpoint <ReleasedProductMasterReadDTO>("ReleasedProductMasters", "", authHeader).Result.value; DataAccess.DataWriter.WriteToTable <ReleasedProductMasterReadDTO>(releasedMasters.GetDataReader(), "[ax].[ReleasedProductMaster]"); //var items = ReadProducts(context); var distinctProducts = AXServiceConnector.CallOdataEndpoint <DistinctProductsDTO>("DistinctProducts", "", authHeader).Result.value; DataAccess.DataWriter.WriteToTable <DistinctProductsDTO>(distinctProducts.GetDataReader(), "[ax].[DistinctProduct]"); var items = AXServiceConnector.CallOdataEndpoint <ReleasedDistinctProductsReadDTO>("ReleasedDistinctProducts", "", authHeader).Result.value; DataAccess.DataWriter.WriteToTable <ReleasedDistinctProductsReadDTO>(items.GetDataReader(), "[ax].[ReleasedDistinctProducts]"); var inventDim = AXServiceConnector.CallOdataEndpoint <InventDimDTO>("InventDims", "", authHeader).Result.value; DataAccess.DataWriter.WriteToTable(inventDim.GetDataReader(), "[ax].[INVENTDIM]"); var custVendExt = AXServiceConnector.CallOdataEndpoint <CustVendExternalItemsDTO>("CustVendExternalItems", "", authHeader).Result.value; DataAccess.DataWriter.WriteToTable(custVendExt.GetDataReader(), "[ax].[CUSTVENDEXTERNALITEM]"); var variants = ReadVariants(context); DataAccess.DataWriter.WriteToTable(variants, "[ax].[ReleasedProductVariants]"); var combos = AXServiceConnector.CallOdataEndpoint <InventDimComboDTO>("InventDimCombinations", "", authHeader).Result.value; DataAccess.DataWriter.WriteToTable(combos.GetDataReader(), "[ax].[INVENTDIMCOMBINATIONS]"); WriteServiceData <RetailAssortmentLookupDTO>("[ax]", "[RETAILASSORTMENTLOOKUP]", "GetRetailAssortmentLookup", authHeader); WriteServiceData <RetailAssortmentLookupChannelGroupDTO>("[ax]", "[RETAILASSORTMENTLOOKUPCHANNELGROUP]", "GetRetailAssortmentLookupChannelGroup", authHeader); var reqItems = context.AGRReqItemTables.ToList().GetDataReader <AGRReqItemTable>(); DataAccess.DataWriter.WriteToTable <AGRReqItemTable>(reqItems, "[ax].[REQITEMTABLE]"); var reqKey = ReadReqSafetyKey(context); DataAccess.DataWriter.WriteToTable(reqKey, "[ax].[REQSAFETYKEY]"); WriteServiceData <ReqSafetyLineDTO>("[ax]", "[REQSAFETYLINE]", "GetSafetyLines", authHeader); // item_order_routes var itemPurchSetup = AXServiceConnector.CallOdataEndpoint <ItemPurchSetup>("ItemPurchSetups", "", authHeader).Result.value; DataAccess.DataWriter.WriteToTable <ItemPurchSetup>(itemPurchSetup.GetDataReader(), "[ax].[INVENTITEMPURCHSETUP]"); var itemInventSetup = AXServiceConnector.CallOdataEndpoint <ItemInventSetup>("ItemInventSetups", "", authHeader).Result.value; DataAccess.DataWriter.WriteToTable <ItemInventSetup>(itemInventSetup.GetDataReader(), "[ax].[INVENTITEMINVENTSETUP]"); WriteServiceData <UnitOfMeasureDTO>("[ax]", "[UNITOFMEASURE]", "GetUnitOfMeasure", authHeader); WriteServiceData <UnitOfMeasureConversionDTO>("[ax]", "[UNITOFMEASURECONVERSION]", "GetUnitOfMeasureConversion", authHeader); var inventSeason = context.InventSeasonTables.ToList().GetDataReader <InventSeasonTable>(); DataAccess.DataWriter.WriteToTable <InventSeasonTable>(inventSeason, "[ax].[InventSeasonTable]"); //WriteServiceData<InventColorSeasonDTO>("[ax]", "[InventColorSeason]", "GetInventSeasonColor"); var inventColorSeason = GetFromService <InventColorSeasonDTO>("AGRFashionServiceGroup", "AGRFashionService", "GetInventSeasonColor", null, authHeader); DataAccess.DataWriter.WriteToTable(inventColorSeason.GetDataReader(), "[ax].[InventColorSeason]"); }
private static List <T> GetFromService <T>(string serviceGroup, string service, string serviceMethod, string postData, string adalHeader) { return(AXServiceConnector.CallAGRServiceArray <T>(service, serviceMethod, postData, adalHeader, serviceGroup).Result); }