Example #1
0
        public static AxBaseException WriteLocationsAndVendors(int actionId)
        {
            //var channel = ReadRetailChannel(context);
            var channel = ServiceConnector.CallOdataEndpoint <RetailChannel>("RetailChannels",
                                                                             // "?$filter=ChannelType eq Microsoft.Dynamics.DataEntities.RetailChannelType'RetailStore'",
                                                                             "", "[ax].[RETAILCHANNELTABLE]", actionId).Result;
            //if (channel != null)
            //{
            //    return channel;
            //}

            //var assortment = ReadRetailAssortment(context);
            var assortment = ServiceConnector.CallOdataEndpoint <RetailAssortment>("RetailAssortments",
                                                                                   "?$filter=Status eq Microsoft.Dynamics.DataEntities.RetailAssortmentStatusType'Published'"
                                                                                   , "[ax].[RETAILASSORTMENTTABLE]", actionId).Result;

            //if (assortment != null)
            //{
            //    return assortment;
            //}
            //var locSetup = context.Locations.ToList().GetDataReader<Location>();
            var locSetup = ServiceConnector.CallOdataEndpoint <Location>("Locations", "", "[ax].[INVENTLOCATION]", actionId).Result;
            //if (locSetup != null)
            //{
            //    return locSetup;
            //}
            //var dir = context.DirParties.ToList().GetDataReader<DirParty>();
            var dir = ServiceConnector.CallOdataEndpoint <DirParty>("DirParties", "", "[ax].[DIRPARTYTABLE]", actionId).Result;
            //if (dir != null)
            //{
            //    return dir;
            //}
            //var vendor = context.Vendors.ToList().GetDataReader<Vendor>();
            var vendor = ServiceConnector.CallOdataEndpointWithPageSize <Vendor>("Vendors", 200, "[ax].[VENDTABLE]", actionId).Result;
            //if (vendor != null)
            //{
            //    return vendor;
            //}

            var channelLines = ServiceConnector.CallOdataEndpoint <RetailAssortmentChannelLine>("RetailAssortmentChannelLines",
                                                                                                "?$filter=Status eq Microsoft.Dynamics.DataEntities.RetailAssortmentStatusType'Published'", "[ax].[RETAILASSORTMENTCHANNELLINE]", actionId)
                               .Result;
            //if (channelLines != null)
            //{
            //    return channelLines;
            //}

            var productLines = ServiceConnector.CallOdataEndpoint <RetailAssortmentProductLine>("RetailAssortmentProductLines",
                                                                                                "?$filter=Status eq Microsoft.Dynamics.DataEntities.RetailAssortmentStatusType'Published'", "[ax].[RETAILASSORTMENTPRODUCTLINE]", actionId)
                               .Result;

            //if (productLines != null)
            //{
            //    return productLines;
            //}
            return(null);
        }
Example #2
0
        public static AxBaseException WriteItems(bool includeFashion, int actionId)
        {
            var productMaster = ServiceConnector.CallOdataEndpoint <ProductMasterReadDTO>("ProductMasters", "", "[ax].[ProductMaster]", actionId).Result;
            //if (productMaster != null)
            //{
            //    return productMaster;
            //}

            var releasedMasters = ServiceConnector.CallOdataEndpointWithPageSize <ReleasedProductMaster>("ReleasedProductMasters", 2000, "[ax].[ReleasedProductMaster]", actionId).Result;
            //if (releasedMasters != null)
            //{
            //    return releasedMasters;
            //}

            var distinctProducts = ServiceConnector.CallOdataEndpoint <DistinctProductsDTO>("DistinctProducts", "", "[ax].[DistinctProduct]", actionId).Result;
            //if (distinctProducts != null)
            //{
            //    return distinctProducts;
            //}
            var items = ServiceConnector.CallOdataEndpointWithPageSize <ReleasedDistinctProduct>("ReleasedDistinctProducts", 2000, "[ax].[ReleasedDistinctProducts]", actionId).Result;
            //if (items != null)
            //{
            //    return items;
            //}

            var inventDim = ServiceConnector.CallOdataEndpoint <InventDimDTO>("InventDims", "", "[ax].[INVENTDIM]", actionId).Result;
            //if (inventDim != null)
            //{
            //    return inventDim;
            //}

            var invTableModule = ServiceConnector.CallOdataEndpoint <TableModule>("TableModules", "", "[ax].[INVENTTABLEMODULE]", actionId).Result;
            //if (invTableModule != null)
            //{
            //    return invTableModule;
            //}

            var custVendExt = ServiceConnector.CallOdataEndpoint <CustVendExternalItem>("CustVendExternalItems", "", "[ax].[CUSTVENDEXTERNALITEM]", actionId).Result;
            //if (custVendExt != null)
            //{
            //    return custVendExt;
            //}

            var variants = ServiceConnector.CallOdataEndpoint <ReleasedProductVariant>("ReleasedProductVariants", "", "[ax].[ReleasedProductVariants]", actionId).Result;
            //if (variants != null)
            //{
            //    return variants;
            //}

            var combos = ServiceConnector.CallOdataEndpoint <InventDimComboDTO>("InventDimCombinations", "", "[ax].[INVENTDIMCOMBINATIONS]", actionId).Result;
            //if (combos != null)
            //{
            //    return combos;
            //}

            //var assortLookup = WriteServiceData<RetailAssortmentLookupDTO>("[ax].[RETAILASSORTMENTLOOKUP]", "GetRetailAssortmentLookup");
            //if (assortLookup != null)
            //{
            //    return assortLookup;
            //}

            var retailChannelLookup = ServiceConnector.CallService <RetailAssortmentLookupChannelGroupDTO>(actionId, "GetRetailAssortmentLookupChannelGroup", "AGRItemCustomService", "[ax].[RETAILASSORTMENTLOOKUPCHANNELGROUP]", 10000);
            //if (retailChannelLookup != null)
            //{
            //    return retailChannelLookup;
            //}

            var reqItems = ServiceConnector.CallOdataEndpoint <AGRReqItemTable>("AGRReqItemTables", "", "[ax].[REQITEMTABLE]", actionId).Result;
            //if (reqItems != null)
            //{
            //    return reqItems;
            //}



            var reqKey = ServiceConnector.CallOdataEndpoint <AGRReqSafetyKey>("AGRReqSafetyKeys", "", "[ax].[REQSAFETYKEY]", actionId).Result;
            //if (reqKey != null)
            //{
            //    return reqKey;
            //}

            var saftyLines = ServiceConnector.CallService <ReqSafetyLineDTO>(actionId, "GetSafetyLines", "AGRItemCustomService", "[ax].[REQSAFETYLINE]", 5000);
            //if (saftyLines != null)
            //{
            //    return saftyLines;
            //}

            // item_order_routes
            var itemPurchSetup = ServiceConnector.CallOdataEndpoint <ItemPurchSetup>("ItemPurchSetups", "", "[ax].[INVENTITEMPURCHSETUP]", actionId).Result;
            //if (itemPurchSetup != null)
            //{
            //    return itemPurchSetup;
            //}

            var itemInventSetup = ServiceConnector.CallOdataEndpoint <ItemInventSetup>("ItemInventSetups", "", "[ax].[INVENTITEMINVENTSETUP]", actionId).Result;
            //if (itemInventSetup != null)
            //{
            //    return itemInventSetup;
            //}

            var unitOfMeasure = ServiceConnector.CallService <UnitOfMeasureDTO>(actionId, "GetUnitOfMeasure", "AGRItemCustomService", "[ax].[UNITOFMEASURE]", 5000);
            //if (unitOfMeasure != null)
            //{
            //    return unitOfMeasure;
            //}
            var unitConv = ServiceConnector.CallService <UnitOfMeasureConversionDTO>(actionId, "GetUnitOfMeasureConversion", "AGRItemCustomService", "[ax].[UNITOFMEASURECONVERSION]", 5000);

            //if (unitConv != null)
            //{
            //    return unitConv;
            //}

            if (includeFashion)
            {
                ////var inventSeason = context.InventSeasonTables.ToList().GetDataReader<InventSeasonTable>();
                ////    DataWriter.WriteToTable<InventSeasonTable>(inventSeason, "[ax].[InventSeasonTable]");

                ////WriteServiceData<InventColorSeasonDTO>("[ax].[InventColorSeason]", "GetInventSeasonColor");
                //    var inventColorSeason = GetFromService<InventColorSeasonDTO>("AGRFashionServiceGroup", "AGRFashionService", "GetInventSeasonColor", null);
                //    if (inventColorSeason.Exception != null)
                //    {
                //        return inventColorSeason.Exception;
                //    }
                //    DataWriter.WriteToTable(inventColorSeason.value.GetDataReader(), "[ax].[InventColorSeason]");
            }
            return(null);
        }