Esempio n. 1
0
        /// <summary>
        /// Convert a nettiers collection to the ws proxy collection.
        /// </summary>
        public static Nettiers.AdventureWorks.Entities.Contact Convert(Nettiers.AdventureWorks.Entities.Contact outItem, WsProxy.Contact item)
        {
            if (item != null && outItem != null)
            {
                outItem.ContactId             = item.ContactId;
                outItem.NameStyle             = item.NameStyle;
                outItem.Title                 = item.Title;
                outItem.FirstName             = item.FirstName;
                outItem.MiddleName            = item.MiddleName;
                outItem.LastName              = item.LastName;
                outItem.Suffix                = item.Suffix;
                outItem.EmailAddress          = item.EmailAddress;
                outItem.EmailPromotion        = item.EmailPromotion;
                outItem.Phone                 = item.Phone;
                outItem.PasswordHash          = item.PasswordHash;
                outItem.PasswordSalt          = item.PasswordSalt;
                outItem.AdditionalContactInfo = item.AdditionalContactInfo;
                outItem.Rowguid               = item.Rowguid;
                outItem.ModifiedDate          = item.ModifiedDate;

                outItem.AcceptChanges();
            }

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

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