示例#1
0
        /// <summary>
        /// Convert a nettiers collection to the ws proxy collection.
        /// </summary>
        public static Nettiers.AdventureWorks.Entities.SalesOrderDetail Convert(Nettiers.AdventureWorks.Entities.SalesOrderDetail outItem, WsProxy.SalesOrderDetail item)
        {
            if (item != null && outItem != null)
            {
                outItem.SalesOrderId          = item.SalesOrderId;
                outItem.SalesOrderDetailId    = item.SalesOrderDetailId;
                outItem.CarrierTrackingNumber = item.CarrierTrackingNumber;
                outItem.OrderQty          = item.OrderQty;
                outItem.ProductId         = item.ProductId;
                outItem.SpecialOfferId    = item.SpecialOfferId;
                outItem.UnitPrice         = item.UnitPrice;
                outItem.UnitPriceDiscount = item.UnitPriceDiscount;
                outItem.LineTotal         = item.LineTotal;
                outItem.Rowguid           = item.Rowguid;
                outItem.ModifiedDate      = item.ModifiedDate;

                outItem.OriginalSalesOrderId = item.SalesOrderId;
                outItem.AcceptChanges();
            }

            return(outItem);
        }
示例#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.SalesOrderDetail object to update.</param>
        /// <remarks></remarks>
        /// <returns>Returns true if operation is successful.</returns>
        public override bool Update(TransactionManager transactionManager, Nettiers.AdventureWorks.Entities.SalesOrderDetail entity)
        {
            WsProxy.AdventureWorksServices proxy = new WsProxy.AdventureWorksServices();
            proxy.Url = Url;

            try
            {
                WsProxy.SalesOrderDetail result = proxy.SalesOrderDetailProvider_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;
            }
        }