Example #1
0
        /// <summary>
        /// Convert a nettiers collection to the ws proxy collection.
        /// </summary>
        public static Nettiers.AdventureWorks.Entities.ProductModel Convert(Nettiers.AdventureWorks.Entities.ProductModel outItem, WsProxy.ProductModel item)
        {
            if (item != null && outItem != null)
            {
                outItem.ProductModelId     = item.ProductModelId;
                outItem.Name               = item.Name;
                outItem.CatalogDescription = item.CatalogDescription;
                outItem.Instructions       = item.Instructions;
                outItem.Rowguid            = item.Rowguid;
                outItem.ModifiedDate       = item.ModifiedDate;

                outItem.AcceptChanges();
            }

            return(outItem);
        }
Example #2
0
        /// <summary>
        ///     Update an existing row in the datasource.
        /// </summary>
        /// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
        /// <param name="entity">Nettiers.AdventureWorks.Entities.ProductModel object to update.</param>
        /// <remarks></remarks>
        /// <returns>Returns true if operation is successful.</returns>
        public override bool Update(TransactionManager transactionManager, Nettiers.AdventureWorks.Entities.ProductModel entity)
        {
            WsProxy.AdventureWorksServices proxy = new WsProxy.AdventureWorksServices();
            proxy.Url = Url;

            try
            {
                WsProxy.ProductModel result = proxy.ProductModelProvider_Update(Convert(entity));
                Convert(entity, result);
                entity.AcceptChanges();
                return(true);
            }
            catch (SoapException soex)
            {
                System.Diagnostics.Debug.WriteLine(soex);
                throw soex;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
                throw ex;
            }
        }