/// <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; }
/// <summary> /// Update an existing row in the datasource. /// </summary> /// <param name="transactionManager"><see cref="TransactionManager"/> object</param> /// <param name="entity">Nettiers.AdventureWorks.Entities.StoreContact object to update.</param> /// <remarks> /// After updating the datasource, the Nettiers.AdventureWorks.Entities.StoreContact object will be updated /// to refelect any changes made by the datasource. (ie: identity or computed columns) /// </remarks> /// <returns>Returns true if operation is successful.</returns> /// <exception cref="System.Exception">The command could not be executed.</exception> /// <exception cref="System.Data.DataException">The <paramref name="transactionManager"/> is not open.</exception> /// <exception cref="System.Data.Common.DbException">The command could not be executed.</exception> public override bool Update(TransactionManager transactionManager, Nettiers.AdventureWorks.Entities.StoreContact entity) { SqlDatabase database = new SqlDatabase(this._connectionString); DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "Sales.usp_adwTiers_StoreContact_Update", _useStoredProcedure); database.AddInParameter(commandWrapper, "@CustomerId", DbType.Int32, entity.CustomerId ); database.AddInParameter(commandWrapper, "@OriginalCustomerId", DbType.Int32, entity.OriginalCustomerId); database.AddInParameter(commandWrapper, "@ContactId", DbType.Int32, entity.ContactId ); database.AddInParameter(commandWrapper, "@OriginalContactId", DbType.Int32, entity.OriginalContactId); database.AddInParameter(commandWrapper, "@ContactTypeId", DbType.Int32, entity.ContactTypeId ); database.AddInParameter(commandWrapper, "@Rowguid", DbType.Guid, entity.Rowguid ); database.AddInParameter(commandWrapper, "@ModifiedDate", DbType.DateTime, entity.ModifiedDate ); int results = 0; //Provider Data Requesting Command Event OnDataRequesting(new CommandEventArgs(commandWrapper, "Update", entity)); if (transactionManager != null) { results = Utility.ExecuteNonQuery(transactionManager, commandWrapper); } else { results = Utility.ExecuteNonQuery(database,commandWrapper); } //Stop Tracking Now that it has been updated and persisted. if (DataRepository.Provider.EnableEntityTracking) EntityManager.StopTracking(entity.EntityTrackingKey); entity.OriginalCustomerId = entity.CustomerId; entity.OriginalContactId = entity.ContactId; entity.AcceptChanges(); //Provider Data Requested Command Event OnDataRequested(new CommandEventArgs(commandWrapper, "Update", entity)); return Convert.ToBoolean(results); }
/// <summary> /// Inserts a Nettiers.AdventureWorks.Entities.TransactionHistory object into the datasource using a transaction. /// </summary> /// <param name="transactionManager"><see cref="TransactionManager"/> object</param> /// <param name="entity">Nettiers.AdventureWorks.Entities.TransactionHistory object to insert.</param> /// <remarks> /// After inserting into the datasource, the Nettiers.AdventureWorks.Entities.TransactionHistory object will be updated /// to refelect any changes made by the datasource. (ie: identity or computed columns) /// </remarks> /// <returns>Returns true if operation is successful.</returns> /// <exception cref="System.Exception">The command could not be executed.</exception> /// <exception cref="System.Data.DataException">The <paramref name="transactionManager"/> is not open.</exception> /// <exception cref="System.Data.Common.DbException">The command could not be executed.</exception> public override bool Insert(TransactionManager transactionManager, Nettiers.AdventureWorks.Entities.TransactionHistory entity) { SqlDatabase database = new SqlDatabase(this._connectionString); DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "Production.usp_adwTiers_TransactionHistory_Insert", _useStoredProcedure); database.AddOutParameter(commandWrapper, "@TransactionId", DbType.Int32, 4); database.AddInParameter(commandWrapper, "@ProductId", DbType.Int32, entity.ProductId ); database.AddInParameter(commandWrapper, "@ReferenceOrderId", DbType.Int32, entity.ReferenceOrderId ); database.AddInParameter(commandWrapper, "@ReferenceOrderLineId", DbType.Int32, entity.ReferenceOrderLineId ); database.AddInParameter(commandWrapper, "@TransactionDate", DbType.DateTime, entity.TransactionDate ); database.AddInParameter(commandWrapper, "@TransactionType", DbType.StringFixedLength, entity.TransactionType ); database.AddInParameter(commandWrapper, "@Quantity", DbType.Int32, entity.Quantity ); database.AddInParameter(commandWrapper, "@ActualCost", DbType.Currency, entity.ActualCost ); database.AddInParameter(commandWrapper, "@ModifiedDate", DbType.DateTime, entity.ModifiedDate ); int results = 0; //Provider Data Requesting Command Event OnDataRequesting(new CommandEventArgs(commandWrapper, "Insert", entity)); if (transactionManager != null) { results = Utility.ExecuteNonQuery(transactionManager, commandWrapper); } else { results = Utility.ExecuteNonQuery(database,commandWrapper); } object _transactionId = database.GetParameterValue(commandWrapper, "@TransactionId"); entity.TransactionId = (System.Int32)_transactionId; entity.AcceptChanges(); //Provider Data Requested Command Event OnDataRequested(new CommandEventArgs(commandWrapper, "Insert", entity)); return Convert.ToBoolean(results); }
/// <summary> /// Convert a collection from to a nettiers collection to a the ws proxy collection. /// </summary> public static WsProxy.ErrorLog[] Convert(Nettiers.AdventureWorks.Entities.TList<ErrorLog> items) { WsProxy.ErrorLog[] outItems = new WsProxy.ErrorLog[items.Count]; int count = 0; foreach (Nettiers.AdventureWorks.Entities.ErrorLog item in items) { outItems[count++] = Convert(item); } return outItems; }
/// <summary> /// Update an existing row in the datasource. /// </summary> /// <param name="transactionManager"><see cref="TransactionManager"/> object</param> /// <param name="entity">Nettiers.AdventureWorks.Entities.ErrorLog object to update.</param> /// <remarks></remarks> /// <returns>Returns true if operation is successful.</returns> public override bool Update(TransactionManager transactionManager, Nettiers.AdventureWorks.Entities.ErrorLog entity) { WsProxy.AdventureWorksServices proxy = new WsProxy.AdventureWorksServices(); proxy.Url = Url; try { WsProxy.ErrorLog result = proxy.ErrorLogProvider_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; } }
/// <summary> /// Convert a nettiers collection to the ws proxy collection. /// </summary> public static Nettiers.AdventureWorks.Entities.ProductReview Convert(Nettiers.AdventureWorks.Entities.ProductReview outItem , WsProxy.ProductReview item) { if (item != null && outItem != null) { outItem.ProductReviewId = item.ProductReviewId; outItem.ProductId = item.ProductId; outItem.ReviewerName = item.ReviewerName; outItem.ReviewDate = item.ReviewDate; outItem.EmailAddress = item.EmailAddress; outItem.Rating = item.Rating; outItem.Comments = item.Comments; outItem.ModifiedDate = item.ModifiedDate; outItem.AcceptChanges(); } return outItem; }
/// <summary> /// Initializes a new instance of the <see cref="T:WorkOrderRoutingItem"/> class. /// </summary> public WorkOrderRoutingItem(Nettiers.AdventureWorks.Entities.WorkOrderRouting entity) : base() { _entity = entity; }
/// <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; }
/// <summary> /// Convert a nettiers entity to the ws proxy entity. /// </summary> public static WsProxy.StateProvince Convert(Nettiers.AdventureWorks.Entities.StateProvince item) { WsProxy.StateProvince outItem = new WsProxy.StateProvince(); outItem.StateProvinceId = item.StateProvinceId; outItem.StateProvinceCode = item.StateProvinceCode; outItem.CountryRegionCode = item.CountryRegionCode; outItem.IsOnlyStateProvinceFlag = item.IsOnlyStateProvinceFlag; outItem.Name = item.Name; outItem.TerritoryId = item.TerritoryId; outItem.Rowguid = item.Rowguid; outItem.ModifiedDate = item.ModifiedDate; return outItem; }
/// <summary> /// Convert a nettiers entity to the ws proxy entity. /// </summary> public static WsProxy.SalesOrderDetail Convert(Nettiers.AdventureWorks.Entities.SalesOrderDetail item) { WsProxy.SalesOrderDetail outItem = new WsProxy.SalesOrderDetail(); 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.OriginalSalesOrderId; return outItem; }
/// <summary> /// Convert a collection from to a nettiers collection to a the ws proxy collection. /// </summary> public static WsProxy.SalesOrderDetail[] Convert(Nettiers.AdventureWorks.Entities.TList<SalesOrderDetail> items) { WsProxy.SalesOrderDetail[] outItems = new WsProxy.SalesOrderDetail[items.Count]; int count = 0; foreach (Nettiers.AdventureWorks.Entities.SalesOrderDetail item in items) { outItems[count++] = Convert(item); } return outItems; }
/// <summary> /// Initializes a new instance of the <see cref="T:SalesOrderHeaderSalesReasonItem"/> class. /// </summary> public SalesOrderHeaderSalesReasonItem(Nettiers.AdventureWorks.Entities.SalesOrderHeaderSalesReason entity) : base() { _entity = entity; }
/// <summary> /// Update an existing row in the datasource. /// </summary> /// <param name="transactionManager"><see cref="TransactionManager"/> object</param> /// <param name="entity">Nettiers.AdventureWorks.Entities.JobCandidate object to update.</param> /// <remarks> /// After updating the datasource, the Nettiers.AdventureWorks.Entities.JobCandidate object will be updated /// to refelect any changes made by the datasource. (ie: identity or computed columns) /// </remarks> /// <returns>Returns true if operation is successful.</returns> /// <exception cref="System.Exception">The command could not be executed.</exception> /// <exception cref="System.Data.DataException">The <paramref name="transactionManager"/> is not open.</exception> /// <exception cref="System.Data.Common.DbException">The command could not be executed.</exception> public override bool Update(TransactionManager transactionManager, Nettiers.AdventureWorks.Entities.JobCandidate entity) { SqlDatabase database = new SqlDatabase(this._connectionString); DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "HumanResources.usp_adwTiers_JobCandidate_Update", _useStoredProcedure); database.AddInParameter(commandWrapper, "@JobCandidateId", DbType.Int32, entity.JobCandidateId ); database.AddInParameter(commandWrapper, "@EmployeeId", DbType.Int32, (entity.EmployeeId.HasValue ? (object) entity.EmployeeId : System.DBNull.Value) ); database.AddInParameter(commandWrapper, "@Resume", DbType.Xml, entity.Resume ); database.AddInParameter(commandWrapper, "@ModifiedDate", DbType.DateTime, entity.ModifiedDate ); int results = 0; //Provider Data Requesting Command Event OnDataRequesting(new CommandEventArgs(commandWrapper, "Update", entity)); if (transactionManager != null) { results = Utility.ExecuteNonQuery(transactionManager, commandWrapper); } else { results = Utility.ExecuteNonQuery(database,commandWrapper); } //Stop Tracking Now that it has been updated and persisted. if (DataRepository.Provider.EnableEntityTracking) EntityManager.StopTracking(entity.EntityTrackingKey); entity.AcceptChanges(); //Provider Data Requested Command Event OnDataRequested(new CommandEventArgs(commandWrapper, "Update", entity)); return Convert.ToBoolean(results); }
/// <summary> /// Inserts a Nettiers.AdventureWorks.Entities.JobCandidate object into the datasource using a transaction. /// </summary> /// <param name="transactionManager"><see cref="TransactionManager"/> object</param> /// <param name="entity">Nettiers.AdventureWorks.Entities.JobCandidate object to insert.</param> /// <remarks> /// After inserting into the datasource, the Nettiers.AdventureWorks.Entities.JobCandidate object will be updated /// to refelect any changes made by the datasource. (ie: identity or computed columns) /// </remarks> /// <returns>Returns true if operation is successful.</returns> /// <exception cref="System.Exception">The command could not be executed.</exception> /// <exception cref="System.Data.DataException">The <paramref name="transactionManager"/> is not open.</exception> /// <exception cref="System.Data.Common.DbException">The command could not be executed.</exception> public override bool Insert(TransactionManager transactionManager, Nettiers.AdventureWorks.Entities.JobCandidate entity) { SqlDatabase database = new SqlDatabase(this._connectionString); DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "HumanResources.usp_adwTiers_JobCandidate_Insert", _useStoredProcedure); database.AddOutParameter(commandWrapper, "@JobCandidateId", DbType.Int32, 4); database.AddInParameter(commandWrapper, "@EmployeeId", DbType.Int32, (entity.EmployeeId.HasValue ? (object) entity.EmployeeId : System.DBNull.Value)); database.AddInParameter(commandWrapper, "@Resume", DbType.Xml, entity.Resume ); database.AddInParameter(commandWrapper, "@ModifiedDate", DbType.DateTime, entity.ModifiedDate ); int results = 0; //Provider Data Requesting Command Event OnDataRequesting(new CommandEventArgs(commandWrapper, "Insert", entity)); if (transactionManager != null) { results = Utility.ExecuteNonQuery(transactionManager, commandWrapper); } else { results = Utility.ExecuteNonQuery(database,commandWrapper); } object _jobCandidateId = database.GetParameterValue(commandWrapper, "@JobCandidateId"); entity.JobCandidateId = (System.Int32)_jobCandidateId; entity.AcceptChanges(); //Provider Data Requested Command Event OnDataRequested(new CommandEventArgs(commandWrapper, "Insert", entity)); return Convert.ToBoolean(results); }
/// <summary> /// Convert a collection from to a nettiers collection to a the ws proxy collection. /// </summary> public static WsProxy.ProductReview[] Convert(Nettiers.AdventureWorks.Entities.TList<ProductReview> items) { WsProxy.ProductReview[] outItems = new WsProxy.ProductReview[items.Count]; int count = 0; foreach (Nettiers.AdventureWorks.Entities.ProductReview item in items) { outItems[count++] = Convert(item); } return outItems; }
/// <summary> /// Convert a collection from to a nettiers collection to a the ws proxy collection. /// </summary> public static WsProxy.StateProvince[] Convert(Nettiers.AdventureWorks.Entities.TList<StateProvince> items) { WsProxy.StateProvince[] outItems = new WsProxy.StateProvince[items.Count]; int count = 0; foreach (Nettiers.AdventureWorks.Entities.StateProvince item in items) { outItems[count++] = Convert(item); } return outItems; }
/// <summary> /// Inserts a Nettiers.AdventureWorks.Entities.ProductReview object into the datasource using a transaction. /// </summary> /// <param name="transactionManager"><see cref="TransactionManager"/> object</param> /// <param name="entity">Nettiers.AdventureWorks.Entities.ProductReview object to insert.</param> /// <remarks></remarks> /// <returns>Returns true if operation is successful.</returns> public override bool Insert(TransactionManager transactionManager, Nettiers.AdventureWorks.Entities.ProductReview entity) { WsProxy.AdventureWorksServices proxy = new WsProxy.AdventureWorksServices(); proxy.Url = Url; try { WsProxy.ProductReview result = proxy.ProductReviewProvider_Insert(Convert(entity)); Convert(entity, result); return true; } catch(SoapException soex) { System.Diagnostics.Debug.WriteLine(soex); throw soex; } catch(Exception ex) { System.Diagnostics.Debug.WriteLine(ex); throw ex; } }
/// <summary> /// Convert a nettiers collection to the ws proxy collection. /// </summary> public static Nettiers.AdventureWorks.Entities.StateProvince Convert(Nettiers.AdventureWorks.Entities.StateProvince outItem , WsProxy.StateProvince item) { if (item != null && outItem != null) { outItem.StateProvinceId = item.StateProvinceId; outItem.StateProvinceCode = item.StateProvinceCode; outItem.CountryRegionCode = item.CountryRegionCode; outItem.IsOnlyStateProvinceFlag = item.IsOnlyStateProvinceFlag; outItem.Name = item.Name; outItem.TerritoryId = item.TerritoryId; outItem.Rowguid = item.Rowguid; outItem.ModifiedDate = item.ModifiedDate; outItem.AcceptChanges(); } return outItem; }
/// <summary> /// Initializes a new instance of the <see cref="T:ContactItem"/> class. /// </summary> public ContactItem(Nettiers.AdventureWorks.Entities.Contact entity) : base() { _entity = entity; }
/// <summary> /// Initializes a new instance of the <see cref="T:VStateProvinceCountryRegionItem"/> class. /// </summary> public VStateProvinceCountryRegionItem(Nettiers.AdventureWorks.Entities.VStateProvinceCountryRegion entity) : base() { _entity = entity; }
/// <summary> /// Convert a nettiers entity to the ws proxy entity. /// </summary> public static WsProxy.ErrorLog Convert(Nettiers.AdventureWorks.Entities.ErrorLog item) { WsProxy.ErrorLog outItem = new WsProxy.ErrorLog(); outItem.ErrorLogId = item.ErrorLogId; outItem.ErrorTime = item.ErrorTime; outItem.UserName = item.UserName; outItem.ErrorNumber = item.ErrorNumber; outItem.ErrorSeverity = item.ErrorSeverity; outItem.ErrorState = item.ErrorState; outItem.ErrorProcedure = item.ErrorProcedure; outItem.ErrorLine = item.ErrorLine; outItem.ErrorMessage = item.ErrorMessage; return outItem; }
/// <summary> /// Initializes a new instance of the <see cref="T:ProductReviewItem"/> class. /// </summary> public ProductReviewItem(Nettiers.AdventureWorks.Entities.ProductReview entity) : base() { _entity = entity; }
/// <summary> /// Lets you efficiently bulk many entity to the database. /// </summary> /// <param name="transactionManager">NOTE: The transaction manager should be null for the web service client implementation.</param> /// <param name="entityList">The entities.</param> /// <remarks> /// After inserting into the datasource, the Nettiers.AdventureWorks.Entities.ErrorLog object will be updated /// to refelect any changes made by the datasource. (ie: identity or computed columns) /// </remarks> public override void BulkInsert(TransactionManager transactionManager, Nettiers.AdventureWorks.Entities.TList<ErrorLog> entityList) { WsProxy.AdventureWorksServices proxy = new WsProxy.AdventureWorksServices(); proxy.Url = Url; try { proxy.ErrorLogProvider_BulkInsert(Convert(entityList)); } catch(SoapException soex) { System.Diagnostics.Debug.WriteLine(soex); throw soex; } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); throw ex; } }
/// <summary> /// Update an existing row in the datasource. /// </summary> /// <param name="transactionManager"><see cref="TransactionManager"/> object</param> /// <param name="entity">Nettiers.AdventureWorks.Entities.UnitMeasure object to update.</param> /// <remarks> /// After updating the datasource, the Nettiers.AdventureWorks.Entities.UnitMeasure object will be updated /// to refelect any changes made by the datasource. (ie: identity or computed columns) /// </remarks> /// <returns>Returns true if operation is successful.</returns> /// <exception cref="System.Exception">The command could not be executed.</exception> /// <exception cref="System.Data.DataException">The <paramref name="transactionManager"/> is not open.</exception> /// <exception cref="System.Data.Common.DbException">The command could not be executed.</exception> public override bool Update(TransactionManager transactionManager, Nettiers.AdventureWorks.Entities.UnitMeasure entity) { SqlDatabase database = new SqlDatabase(this._connectionString); DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "Production.usp_adwTiers_UnitMeasure_Update", _useStoredProcedure); database.AddInParameter(commandWrapper, "@UnitMeasureCode", DbType.StringFixedLength, entity.UnitMeasureCode ); database.AddInParameter(commandWrapper, "@OriginalUnitMeasureCode", DbType.StringFixedLength, entity.OriginalUnitMeasureCode); database.AddInParameter(commandWrapper, "@Name", DbType.String, entity.Name ); database.AddInParameter(commandWrapper, "@ModifiedDate", DbType.DateTime, entity.ModifiedDate ); int results = 0; //Provider Data Requesting Command Event OnDataRequesting(new CommandEventArgs(commandWrapper, "Update", entity)); if (transactionManager != null) { results = Utility.ExecuteNonQuery(transactionManager, commandWrapper); } else { results = Utility.ExecuteNonQuery(database,commandWrapper); } //Stop Tracking Now that it has been updated and persisted. if (DataRepository.Provider.EnableEntityTracking) EntityManager.StopTracking(entity.EntityTrackingKey); entity.OriginalUnitMeasureCode = entity.UnitMeasureCode; entity.AcceptChanges(); //Provider Data Requested Command Event OnDataRequested(new CommandEventArgs(commandWrapper, "Update", entity)); return Convert.ToBoolean(results); }
/// <summary> /// Convert a nettiers collection to the ws proxy collection. /// </summary> public static Nettiers.AdventureWorks.Entities.ErrorLog Convert(Nettiers.AdventureWorks.Entities.ErrorLog outItem , WsProxy.ErrorLog item) { if (item != null && outItem != null) { outItem.ErrorLogId = item.ErrorLogId; outItem.ErrorTime = item.ErrorTime; outItem.UserName = item.UserName; outItem.ErrorNumber = item.ErrorNumber; outItem.ErrorSeverity = item.ErrorSeverity; outItem.ErrorState = item.ErrorState; outItem.ErrorProcedure = item.ErrorProcedure; outItem.ErrorLine = item.ErrorLine; outItem.ErrorMessage = item.ErrorMessage; outItem.AcceptChanges(); } return outItem; }
/// <summary> /// Initializes a new instance of the <see cref="T:ScrapReasonItem"/> class. /// </summary> public ScrapReasonItem(Nettiers.AdventureWorks.Entities.ScrapReason entity) : base() { _entity = entity; }
/// <summary> /// Inserts a Nettiers.AdventureWorks.Entities.StoreContact object into the datasource using a transaction. /// </summary> /// <param name="transactionManager"><see cref="TransactionManager"/> object</param> /// <param name="entity">Nettiers.AdventureWorks.Entities.StoreContact object to insert.</param> /// <remarks> /// After inserting into the datasource, the Nettiers.AdventureWorks.Entities.StoreContact object will be updated /// to refelect any changes made by the datasource. (ie: identity or computed columns) /// </remarks> /// <returns>Returns true if operation is successful.</returns> /// <exception cref="System.Exception">The command could not be executed.</exception> /// <exception cref="System.Data.DataException">The <paramref name="transactionManager"/> is not open.</exception> /// <exception cref="System.Data.Common.DbException">The command could not be executed.</exception> public override bool Insert(TransactionManager transactionManager, Nettiers.AdventureWorks.Entities.StoreContact entity) { SqlDatabase database = new SqlDatabase(this._connectionString); DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "Sales.usp_adwTiers_StoreContact_Insert", _useStoredProcedure); database.AddInParameter(commandWrapper, "@CustomerId", DbType.Int32, entity.CustomerId ); database.AddInParameter(commandWrapper, "@ContactId", DbType.Int32, entity.ContactId ); database.AddInParameter(commandWrapper, "@ContactTypeId", DbType.Int32, entity.ContactTypeId ); database.AddOutParameter(commandWrapper, "@Rowguid", DbType.Guid, 16); database.AddInParameter(commandWrapper, "@ModifiedDate", DbType.DateTime, entity.ModifiedDate ); int results = 0; //Provider Data Requesting Command Event OnDataRequesting(new CommandEventArgs(commandWrapper, "Insert", entity)); if (transactionManager != null) { results = Utility.ExecuteNonQuery(transactionManager, commandWrapper); } else { results = Utility.ExecuteNonQuery(database,commandWrapper); } object _rowguid = database.GetParameterValue(commandWrapper, "@Rowguid"); entity.Rowguid = (System.Guid)_rowguid; entity.OriginalCustomerId = entity.CustomerId; entity.OriginalContactId = entity.ContactId; entity.AcceptChanges(); //Provider Data Requested Command Event OnDataRequested(new CommandEventArgs(commandWrapper, "Insert", entity)); return Convert.ToBoolean(results); }
/// <summary> /// Convert a nettiers entity to the ws proxy entity. /// </summary> public static WsProxy.ProductReview Convert(Nettiers.AdventureWorks.Entities.ProductReview item) { WsProxy.ProductReview outItem = new WsProxy.ProductReview(); outItem.ProductReviewId = item.ProductReviewId; outItem.ProductId = item.ProductId; outItem.ReviewerName = item.ReviewerName; outItem.ReviewDate = item.ReviewDate; outItem.EmailAddress = item.EmailAddress; outItem.Rating = item.Rating; outItem.Comments = item.Comments; outItem.ModifiedDate = item.ModifiedDate; return outItem; }
/// <summary> /// Update an existing row in the datasource. /// </summary> /// <param name="transactionManager"><see cref="TransactionManager"/> object</param> /// <param name="entity">Nettiers.AdventureWorks.Entities.TransactionHistory object to update.</param> /// <remarks> /// After updating the datasource, the Nettiers.AdventureWorks.Entities.TransactionHistory object will be updated /// to refelect any changes made by the datasource. (ie: identity or computed columns) /// </remarks> /// <returns>Returns true if operation is successful.</returns> /// <exception cref="System.Exception">The command could not be executed.</exception> /// <exception cref="System.Data.DataException">The <paramref name="transactionManager"/> is not open.</exception> /// <exception cref="System.Data.Common.DbException">The command could not be executed.</exception> public override bool Update(TransactionManager transactionManager, Nettiers.AdventureWorks.Entities.TransactionHistory entity) { SqlDatabase database = new SqlDatabase(this._connectionString); DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "Production.usp_adwTiers_TransactionHistory_Update", _useStoredProcedure); database.AddInParameter(commandWrapper, "@TransactionId", DbType.Int32, entity.TransactionId ); database.AddInParameter(commandWrapper, "@ProductId", DbType.Int32, entity.ProductId ); database.AddInParameter(commandWrapper, "@ReferenceOrderId", DbType.Int32, entity.ReferenceOrderId ); database.AddInParameter(commandWrapper, "@ReferenceOrderLineId", DbType.Int32, entity.ReferenceOrderLineId ); database.AddInParameter(commandWrapper, "@TransactionDate", DbType.DateTime, entity.TransactionDate ); database.AddInParameter(commandWrapper, "@TransactionType", DbType.StringFixedLength, entity.TransactionType ); database.AddInParameter(commandWrapper, "@Quantity", DbType.Int32, entity.Quantity ); database.AddInParameter(commandWrapper, "@ActualCost", DbType.Currency, entity.ActualCost ); database.AddInParameter(commandWrapper, "@ModifiedDate", DbType.DateTime, entity.ModifiedDate ); int results = 0; //Provider Data Requesting Command Event OnDataRequesting(new CommandEventArgs(commandWrapper, "Update", entity)); if (transactionManager != null) { results = Utility.ExecuteNonQuery(transactionManager, commandWrapper); } else { results = Utility.ExecuteNonQuery(database,commandWrapper); } //Stop Tracking Now that it has been updated and persisted. if (DataRepository.Provider.EnableEntityTracking) EntityManager.StopTracking(entity.EntityTrackingKey); entity.AcceptChanges(); //Provider Data Requested Command Event OnDataRequested(new CommandEventArgs(commandWrapper, "Update", entity)); return Convert.ToBoolean(results); }
/// <summary> /// Convert a nettiers entity to the ws proxy entity. /// </summary> public static WsProxy.ProductModel Convert(Nettiers.AdventureWorks.Entities.ProductModel item) { WsProxy.ProductModel outItem = new WsProxy.ProductModel(); outItem.ProductModelId = item.ProductModelId; outItem.Name = item.Name; outItem.CatalogDescription = item.CatalogDescription; outItem.Instructions = item.Instructions; outItem.Rowguid = item.Rowguid; outItem.ModifiedDate = item.ModifiedDate; return outItem; }