// copy all rows from a List of SOAP Contracts to a List of serialized data objects
 // links:
 //  docLink: http://sql2x.org/documentationLink/1c6c6b9c-e201-4590-8c69-d38a0ad2a9f7
 public static void ContractListToDataList(List <CrudeProductIdentifierContract> contractList, List <CrudeProductIdentifierData> dataList)
 {
     foreach (CrudeProductIdentifierContract contract in contractList)
     {
         var data = new CrudeProductIdentifierData();
         CrudeProductIdentifierService.ContractToData(contract, data);
         dataList.Add(data);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// get product and all entities
        /// </summary>
        /// <param name="productId"></param>
        /// <returns></returns>
        public ProductContract ProductGetCompleteById(
            Guid productId
            )
        {
            var contract = new ProductContract();
            var data     = new Product(productId);

            // move data from data access layer to business logic layer
            contract.Product = new CrudeProductContract();
            CrudeProductService.DataToContract(data.product, contract.Product);

            contract.ProductAttribute     = CrudeProductAttributeService.DataListToContractList(data.ProductAttribute);
            contract.ProductIdentifier    = CrudeProductIdentifierService.DataListToContractList(data.ProductIdentifier);
            contract.ProductInfo          = CrudeProductInfoService.DataListToContractList(data.ProductInfo);
            contract.ProductImage         = CrudeProductImageService.DataListToContractList(data.ProductImage);
            contract.ProductDocumentation = CrudeProductDocumentationService.DataListToContractList(data.ProductDocumentation);

            // generate checksum

            return(contract);
        }
Exemplo n.º 3
0
        /// <summary>
        /// save product and all entities
        /// </summary>
        /// <param name="contract"></param>
        /// <param name="userId"></param>
        /// <returns>new product id</returns>
        public Guid ProductSaveCompleteById(
            ProductContract contract,
            Guid userId
            )
        {
            // check checksum ( object has hash code )

            // move from contract to data
            var data = new Product();

            CrudeProductService.ContractToData(contract.Product, data.product);
            CrudeProductAttributeService.ContractListToDataList(contract.ProductAttribute, data.ProductAttribute);
            CrudeProductIdentifierService.ContractListToDataList(contract.ProductIdentifier, data.ProductIdentifier);
            CrudeProductInfoService.ContractListToDataList(contract.ProductInfo, data.ProductInfo);
            CrudeProductImageService.ContractListToDataList(contract.ProductImage, data.ProductImage);
            CrudeProductDocumentationService.ContractListToDataList(contract.ProductDocumentation, data.ProductDocumentation);

            // save product
            data.Save(userId);

            return(data.product.ProductId);
        }