当前位置: 首页>>代码示例>>C#>>正文


C# Nettiers.AcceptChanges方法代码示例

本文整理汇总了C#中Nettiers.AcceptChanges方法的典型用法代码示例。如果您正苦于以下问题:C# Nettiers.AcceptChanges方法的具体用法?C# Nettiers.AcceptChanges怎么用?C# Nettiers.AcceptChanges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Nettiers的用法示例。


在下文中一共展示了Nettiers.AcceptChanges方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Convert

		/// <summary>
		/// Convert a nettiers collection to the ws proxy collection.
		/// </summary>
		public static Nettiers.AdventureWorks.Entities.SalesTerritoryHistory Convert(Nettiers.AdventureWorks.Entities.SalesTerritoryHistory outItem , WsProxy.SalesTerritoryHistory item)
		{	
			if (item != null && outItem != null)
			{
				outItem.SalesPersonId = item.SalesPersonId;
				outItem.TerritoryId = item.TerritoryId;
				outItem.StartDate = item.StartDate;
				outItem.EndDate = item.EndDate;
				outItem.Rowguid = item.Rowguid;
				outItem.ModifiedDate = item.ModifiedDate;
				
				outItem.OriginalSalesPersonId = item.SalesPersonId;
				outItem.OriginalStartDate = item.StartDate;
				outItem.OriginalTerritoryId = item.TerritoryId;
				outItem.AcceptChanges();			
			}
							
			return outItem;
		}
开发者ID:netTiers,项目名称:netTiers,代码行数:22,代码来源:WsSalesTerritoryHistoryProviderBase.generated.cs

示例2: Update

		/// <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);
		}
开发者ID:WildGenie,项目名称:NetTiers,代码行数:54,代码来源:SqlStoreContactProviderBase.generated.cs

示例3: Insert

		/// <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);
		}	
开发者ID:WildGenie,项目名称:NetTiers,代码行数:53,代码来源:SqlTransactionHistoryProviderBase.generated.cs

示例4: Update

		/// <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);
		}
开发者ID:WildGenie,项目名称:NetTiers,代码行数:50,代码来源:SqlUnitMeasureProviderBase.generated.cs

示例5: Update

		/// <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;
			}
		}
开发者ID:netTiers,项目名称:netTiers,代码行数:30,代码来源:WsErrorLogProviderBase.generated.cs

示例6: Insert

		/// <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);
		}	
开发者ID:netTiers,项目名称:netTiers,代码行数:48,代码来源:SqlJobCandidateProviderBase.generated.cs

示例7: Convert

		/// <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;
		}
开发者ID:WildGenie,项目名称:NetTiers,代码行数:25,代码来源:WsSalesOrderDetailProviderBase.generated.cs

示例8: Convert

		/// <summary>
		/// Convert a nettiers collection to the ws proxy collection.
		/// </summary>
		public static Nettiers.AdventureWorks.Entities.EmployeeDepartmentHistory Convert(Nettiers.AdventureWorks.Entities.EmployeeDepartmentHistory outItem , WsProxy.EmployeeDepartmentHistory item)
		{	
			if (item != null && outItem != null)
			{
				outItem.EmployeeId = item.EmployeeId;
				outItem.DepartmentId = item.DepartmentId;
				outItem.ShiftId = item.ShiftId;
				outItem.StartDate = item.StartDate;
				outItem.EndDate = item.EndDate;
				outItem.ModifiedDate = item.ModifiedDate;
				
				outItem.OriginalEmployeeId = item.EmployeeId;
				outItem.OriginalStartDate = item.StartDate;
				outItem.OriginalDepartmentId = item.DepartmentId;
				outItem.OriginalShiftId = item.ShiftId;
				outItem.AcceptChanges();			
			}
							
			return outItem;
		}
开发者ID:WildGenie,项目名称:NetTiers,代码行数:23,代码来源:WsEmployeeDepartmentHistoryProviderBase.generated.cs

示例9: Convert

		/// <summary>
		/// Convert a nettiers collection to the ws proxy collection.
		/// </summary>
		public static Nettiers.AdventureWorks.Entities.ProductSubcategory Convert(Nettiers.AdventureWorks.Entities.ProductSubcategory outItem , WsProxy.ProductSubcategory item)
		{	
			if (item != null && outItem != null)
			{
				outItem.ProductSubcategoryId = item.ProductSubcategoryId;
				outItem.ProductCategoryId = item.ProductCategoryId;
				outItem.Name = item.Name;
				outItem.Rowguid = item.Rowguid;
				outItem.ModifiedDate = item.ModifiedDate;
				
				outItem.AcceptChanges();			
			}
							
			return outItem;
		}
开发者ID:netTiers,项目名称:netTiers,代码行数:18,代码来源:WsProductSubcategoryProviderBase.generated.cs

示例10: Convert

		/// <summary>
		/// Convert a nettiers collection to the ws proxy collection.
		/// </summary>
		public static Nettiers.AdventureWorks.Entities.AddressType Convert(Nettiers.AdventureWorks.Entities.AddressType outItem , WsProxy.AddressType item)
		{	
			if (item != null && outItem != null)
			{
				outItem.AddressTypeId = item.AddressTypeId;
				outItem.Name = item.Name;
				outItem.Rowguid = item.Rowguid;
				outItem.ModifiedDate = item.ModifiedDate;
				
				outItem.AcceptChanges();			
			}
							
			return outItem;
		}
开发者ID:WildGenie,项目名称:NetTiers,代码行数:17,代码来源:WsAddressTypeProviderBase.generated.cs

示例11: Convert

		/// <summary>
		/// Convert a nettiers collection to the ws proxy collection.
		/// </summary>
		public static Nettiers.AdventureWorks.Entities.ShipMethod Convert(Nettiers.AdventureWorks.Entities.ShipMethod outItem , WsProxy.ShipMethod item)
		{	
			if (item != null && outItem != null)
			{
				outItem.ShipMethodId = item.ShipMethodId;
				outItem.Name = item.Name;
				outItem.ShipBase = item.ShipBase;
				outItem.ShipRate = item.ShipRate;
				outItem.Rowguid = item.Rowguid;
				outItem.ModifiedDate = item.ModifiedDate;
				
				outItem.AcceptChanges();			
			}
							
			return outItem;
		}
开发者ID:WildGenie,项目名称:NetTiers,代码行数:19,代码来源:WsShipMethodProviderBase.generated.cs

示例12: Convert

		/// <summary>
		/// Convert a nettiers collection to the ws proxy collection.
		/// </summary>
		public static Nettiers.AdventureWorks.Entities.PurchaseOrderHeader Convert(Nettiers.AdventureWorks.Entities.PurchaseOrderHeader outItem , WsProxy.PurchaseOrderHeader item)
		{	
			if (item != null && outItem != null)
			{
				outItem.PurchaseOrderId = item.PurchaseOrderId;
				outItem.RevisionNumber = item.RevisionNumber;
				outItem.Status = item.Status;
				outItem.EmployeeId = item.EmployeeId;
				outItem.VendorId = item.VendorId;
				outItem.ShipMethodId = item.ShipMethodId;
				outItem.OrderDate = item.OrderDate;
				outItem.ShipDate = item.ShipDate;
				outItem.SubTotal = item.SubTotal;
				outItem.TaxAmt = item.TaxAmt;
				outItem.Freight = item.Freight;
				outItem.TotalDue = item.TotalDue;
				outItem.ModifiedDate = item.ModifiedDate;
				
				outItem.AcceptChanges();			
			}
							
			return outItem;
		}
开发者ID:WildGenie,项目名称:NetTiers,代码行数:26,代码来源:WsPurchaseOrderHeaderProviderBase.generated.cs

示例13: Convert

		/// <summary>
		/// Convert a nettiers collection to the ws proxy collection.
		/// </summary>
		public static Nettiers.AdventureWorks.Entities.SalesPerson Convert(Nettiers.AdventureWorks.Entities.SalesPerson outItem , WsProxy.SalesPerson item)
		{	
			if (item != null && outItem != null)
			{
				outItem.SalesPersonId = item.SalesPersonId;
				outItem.TerritoryId = item.TerritoryId;
				outItem.SalesQuota = item.SalesQuota;
				outItem.Bonus = item.Bonus;
				outItem.CommissionPct = item.CommissionPct;
				outItem.SalesYtd = item.SalesYtd;
				outItem.SalesLastYear = item.SalesLastYear;
				outItem.Rowguid = item.Rowguid;
				outItem.ModifiedDate = item.ModifiedDate;
				
				outItem.OriginalSalesPersonId = item.SalesPersonId;
				outItem.AcceptChanges();			
			}
							
			return outItem;
		}
开发者ID:WildGenie,项目名称:NetTiers,代码行数:23,代码来源:WsSalesPersonProviderBase.generated.cs

示例14: Update

		/// <summary>
		/// 	Update an existing row in the datasource.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="entity">Nettiers.AdventureWorks.Entities.ProductListPriceHistory object to update.</param>
		/// <remarks>
		///		After updating the datasource, the Nettiers.AdventureWorks.Entities.ProductListPriceHistory 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.ProductListPriceHistory entity)
		{
			SqlDatabase database = new SqlDatabase(this._connectionString);
			DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "Production.usp_adwTiers_ProductListPriceHistory_Update", _useStoredProcedure);
			
			database.AddInParameter(commandWrapper, "@ProductId", DbType.Int32, entity.ProductId );
			database.AddInParameter(commandWrapper, "@OriginalProductId", DbType.Int32, entity.OriginalProductId);
			database.AddInParameter(commandWrapper, "@StartDate", DbType.DateTime, entity.StartDate );
			database.AddInParameter(commandWrapper, "@OriginalStartDate", DbType.DateTime, entity.OriginalStartDate);
			database.AddInParameter(commandWrapper, "@EndDate", DbType.DateTime, (entity.EndDate.HasValue ? (object) entity.EndDate : System.DBNull.Value) );
			database.AddInParameter(commandWrapper, "@ListPrice", DbType.Currency, entity.ListPrice );
			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.OriginalProductId = entity.ProductId;
			entity.OriginalStartDate = entity.StartDate;
			
			entity.AcceptChanges();
			
			//Provider Data Requested Command Event
			OnDataRequested(new CommandEventArgs(commandWrapper, "Update", entity));

			return Convert.ToBoolean(results);
		}
开发者ID:netTiers,项目名称:netTiers,代码行数:54,代码来源:SqlProductListPriceHistoryProviderBase.generated.cs

示例15: Update

		/// <summary>
		/// 	Update an existing row in the datasource.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="entity">Nettiers.AdventureWorks.Entities.SalesPerson object to update.</param>
		/// <remarks>
		///		After updating the datasource, the Nettiers.AdventureWorks.Entities.SalesPerson 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.SalesPerson entity)
		{
			SqlDatabase database = new SqlDatabase(this._connectionString);
			DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "Sales.usp_adwTiers_SalesPerson_Update", _useStoredProcedure);
			
			database.AddInParameter(commandWrapper, "@SalesPersonId", DbType.Int32, entity.SalesPersonId );
			database.AddInParameter(commandWrapper, "@OriginalSalesPersonId", DbType.Int32, entity.OriginalSalesPersonId);
			database.AddInParameter(commandWrapper, "@TerritoryId", DbType.Int32, (entity.TerritoryId.HasValue ? (object) entity.TerritoryId : System.DBNull.Value) );
			database.AddInParameter(commandWrapper, "@SalesQuota", DbType.Currency, (entity.SalesQuota.HasValue ? (object) entity.SalesQuota : System.DBNull.Value) );
			database.AddInParameter(commandWrapper, "@Bonus", DbType.Currency, entity.Bonus );
			database.AddInParameter(commandWrapper, "@CommissionPct", DbType.Currency, entity.CommissionPct );
			database.AddInParameter(commandWrapper, "@SalesYtd", DbType.Currency, entity.SalesYtd );
			database.AddInParameter(commandWrapper, "@SalesLastYear", DbType.Currency, entity.SalesLastYear );
			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.OriginalSalesPersonId = entity.SalesPersonId;
			
			entity.AcceptChanges();
			
			//Provider Data Requested Command Event
			OnDataRequested(new CommandEventArgs(commandWrapper, "Update", entity));

			return Convert.ToBoolean(results);
		}
开发者ID:WildGenie,项目名称:NetTiers,代码行数:56,代码来源:SqlSalesPersonProviderBase.generated.cs


注:本文中的Nettiers.AcceptChanges方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。