/// <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;
		}
コード例 #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.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);
		}	
コード例 #4
0
		/// <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);
		}
コード例 #5
0
		/// <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;
			}
		}
コード例 #6
0
		/// <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);
		}	
コード例 #7
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;
		}
		/// <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;
		}
コード例 #9
0
		/// <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;
		}
コード例 #10
0
		/// <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;
		}
コード例 #11
0
		/// <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;
		}
コード例 #12
0
		/// <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;
		}
コード例 #13
0
		/// <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;
		}
		/// <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);
		}
コード例 #15
0
		/// <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);
		}
		/// <summary>
		/// Convert a nettiers collection to the ws proxy collection.
		/// </summary>
		public static Nettiers.AdventureWorks.Entities.SalesOrderHeaderSalesReason Convert(Nettiers.AdventureWorks.Entities.SalesOrderHeaderSalesReason outItem , WsProxy.SalesOrderHeaderSalesReason item)
		{	
			if (item != null && outItem != null)
			{
				outItem.SalesOrderId = item.SalesOrderId;
				outItem.SalesReasonId = item.SalesReasonId;
				outItem.ModifiedDate = item.ModifiedDate;
				
				outItem.OriginalSalesOrderId = item.SalesOrderId;
				outItem.OriginalSalesReasonId = item.SalesReasonId;
				outItem.AcceptChanges();			
			}
							
			return outItem;
		}
コード例 #17
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;
		}
コード例 #18
0
		/// <summary>
		/// 	Inserts a Nettiers.AdventureWorks.Entities.TimestampPk object into the datasource using a transaction.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="entity">Nettiers.AdventureWorks.Entities.TimestampPk object to insert.</param>
		/// <remarks>
		///		After inserting into the datasource, the Nettiers.AdventureWorks.Entities.TimestampPk 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.TimestampPk entity)
		{
			SqlDatabase database = new SqlDatabase(this._connectionString);
			DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "Test.usp_adwTiers_TimestampPK_Insert", _useStoredProcedure);
			
			database.AddOutParameter(commandWrapper, "@TimestampPk", DbType.Binary, 8);
			database.AddInParameter(commandWrapper, "@SomeText", DbType.AnsiString, entity.SomeText );
			
			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 _timestampPk = database.GetParameterValue(commandWrapper, "@TimestampPk");
			entity.TimestampPk = (System.Byte[])_timestampPk;
			
			
			entity.AcceptChanges();
	
			//Provider Data Requested Command Event
			OnDataRequested(new CommandEventArgs(commandWrapper, "Insert", entity));

			return Convert.ToBoolean(results);
		}	
コード例 #19
0
		/// <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);
		}
コード例 #20
0
		/// <summary>
		/// 	Update an existing row in the datasource.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="entity">Nettiers.AdventureWorks.Entities.TimestampPk object to update.</param>
		/// <remarks>
		///		After updating the datasource, the Nettiers.AdventureWorks.Entities.TimestampPk 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>
        /// <exception cref="DBConcurrencyException">The record has been modified by an other user. Please reload the instance before updating.</exception>
		public override bool Update(TransactionManager transactionManager, Nettiers.AdventureWorks.Entities.TimestampPk entity)
		{
			SqlDatabase database = new SqlDatabase(this._connectionString);
			DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "Test.usp_adwTiers_TimestampPK_Update", _useStoredProcedure);
			
			database.AddInParameter(commandWrapper, "@TimestampPk", DbType.Binary, entity.TimestampPk );
			database.AddInParameter(commandWrapper, "@SomeText", DbType.AnsiString, entity.SomeText );
			database.AddOutParameter(commandWrapper, "@ReturnedTimestampPk", DbType.Binary, 8);
			
			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);
			
			if (results == 0)
			{
				throw new DBConcurrencyException("Concurrency exception");
			}
			entity.TimestampPk = (System.Byte[])database.GetParameterValue(commandWrapper, "@ReturnedTimestampPk");
			
			entity.AcceptChanges();
			
			//Provider Data Requested Command Event
			OnDataRequested(new CommandEventArgs(commandWrapper, "Update", entity));

			return Convert.ToBoolean(results);
		}
コード例 #21
0
		/// <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;
		}
コード例 #22
0
		/// <summary>
		/// 	Inserts a Nettiers.AdventureWorks.Entities.CountryRegion object into the datasource using a transaction.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="entity">Nettiers.AdventureWorks.Entities.CountryRegion object to insert.</param>
		/// <remarks>
		///		After inserting into the datasource, the Nettiers.AdventureWorks.Entities.CountryRegion 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.CountryRegion entity)
		{
			SqlDatabase database = new SqlDatabase(this._connectionString);
			DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "Person.usp_adwTiers_CountryRegion_Insert", _useStoredProcedure);
			
			database.AddInParameter(commandWrapper, "@CountryRegionCode", DbType.String, entity.CountryRegionCode );
			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, "Insert", entity));
				
			if (transactionManager != null)
			{
				results = Utility.ExecuteNonQuery(transactionManager, commandWrapper);
			}
			else
			{
				results = Utility.ExecuteNonQuery(database,commandWrapper);
			}
					
			
			entity.OriginalCountryRegionCode = entity.CountryRegionCode;
			
			entity.AcceptChanges();
	
			//Provider Data Requested Command Event
			OnDataRequested(new CommandEventArgs(commandWrapper, "Insert", entity));

			return Convert.ToBoolean(results);
		}	
コード例 #23
0
		/// <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>
		/// Convert a nettiers collection to the ws proxy collection.
		/// </summary>
		public static Nettiers.AdventureWorks.Entities.CountryRegionCurrency Convert(Nettiers.AdventureWorks.Entities.CountryRegionCurrency outItem , WsProxy.CountryRegionCurrency item)
		{	
			if (item != null && outItem != null)
			{
				outItem.CountryRegionCode = item.CountryRegionCode;
				outItem.CurrencyCode = item.CurrencyCode;
				outItem.ModifiedDate = item.ModifiedDate;
				
				outItem.OriginalCountryRegionCode = item.CountryRegionCode;
				outItem.OriginalCurrencyCode = item.CurrencyCode;
				outItem.AcceptChanges();			
			}
							
			return outItem;
		}
コード例 #25
0
		/// <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;
		}
コード例 #26
0
		/// <summary>
		/// 	Inserts a Nettiers.AdventureWorks.Entities.StudentMasterIndex object into the datasource using a transaction.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="entity">Nettiers.AdventureWorks.Entities.StudentMasterIndex object to insert.</param>
		/// <remarks>
		///		After inserting into the datasource, the Nettiers.AdventureWorks.Entities.StudentMasterIndex 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.StudentMasterIndex entity)
		{
			SqlDatabase database = new SqlDatabase(this._connectionString);
			DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "Test.usp_adwTiers_STUDENT_MASTER_INDEX_Insert", _useStoredProcedure);
			
			database.AddInParameter(commandWrapper, "@StudentId", DbType.Int32, entity.StudentId );
			database.AddInParameter(commandWrapper, "@EpassId", DbType.AnsiString, entity.EpassId );
			database.AddInParameter(commandWrapper, "@StudentUpn", DbType.AnsiString, entity.StudentUpn );
			database.AddInParameter(commandWrapper, "@SsabsaId", DbType.AnsiString, entity.SsabsaId );
			database.AddInParameter(commandWrapper, "@Surname", DbType.AnsiString, entity.Surname );
			database.AddInParameter(commandWrapper, "@FirstName", DbType.AnsiString, entity.FirstName );
			database.AddInParameter(commandWrapper, "@OtherNames", DbType.AnsiString, entity.OtherNames );
			database.AddInParameter(commandWrapper, "@KnownName", DbType.AnsiString, entity.KnownName );
			database.AddInParameter(commandWrapper, "@LegalName", DbType.AnsiString, entity.LegalName );
			database.AddInParameter(commandWrapper, "@Dob", DbType.DateTime, (entity.Dob.HasValue ? (object) entity.Dob  : System.DBNull.Value));
			database.AddInParameter(commandWrapper, "@Gender", DbType.AnsiString, entity.Gender );
			database.AddInParameter(commandWrapper, "@IndigeneousStatus", DbType.AnsiString, entity.IndigeneousStatus );
			database.AddInParameter(commandWrapper, "@Lbote", DbType.AnsiString, entity.Lbote );
			database.AddInParameter(commandWrapper, "@EslPhase", DbType.AnsiString, entity.EslPhase );
			database.AddInParameter(commandWrapper, "@TribalGroup", DbType.AnsiString, entity.TribalGroup );
			database.AddInParameter(commandWrapper, "@SlpCreatedFlag", DbType.AnsiString, entity.SlpCreatedFlag );
			database.AddInParameter(commandWrapper, "@AddressLine1", DbType.AnsiString, entity.AddressLine1 );
			database.AddInParameter(commandWrapper, "@AddressLine2", DbType.AnsiString, entity.AddressLine2 );
			database.AddInParameter(commandWrapper, "@AddressLine3", DbType.AnsiString, entity.AddressLine3 );
			database.AddInParameter(commandWrapper, "@AddressLine4", DbType.AnsiString, entity.AddressLine4 );
			database.AddInParameter(commandWrapper, "@Suburb", DbType.AnsiString, entity.Suburb );
			database.AddInParameter(commandWrapper, "@Postcode", DbType.AnsiString, entity.Postcode );
			database.AddInParameter(commandWrapper, "@Phone1", DbType.AnsiString, entity.Phone1 );
			database.AddInParameter(commandWrapper, "@Phone2", DbType.AnsiString, entity.Phone2 );
			database.AddInParameter(commandWrapper, "@SourceSystem", DbType.AnsiString, entity.SourceSystem );
			database.AddInParameter(commandWrapper, "@PhoneticMatchId", DbType.Int32, (entity.PhoneticMatchId.HasValue ? (object) entity.PhoneticMatchId  : System.DBNull.Value));
			
			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);
			}
					
			
			entity.OriginalStudentId = entity.StudentId;
			
			entity.AcceptChanges();
	
			//Provider Data Requested Command Event
			OnDataRequested(new CommandEventArgs(commandWrapper, "Insert", entity));

			return Convert.ToBoolean(results);
		}	
コード例 #27
0
		/// <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);
		}	
コード例 #28
0
		/// <summary>
		/// Convert a nettiers collection to the ws proxy collection.
		/// </summary>
		public static Nettiers.AdventureWorks.Entities.Illustration Convert(Nettiers.AdventureWorks.Entities.Illustration outItem , WsProxy.Illustration item)
		{	
			if (item != null && outItem != null)
			{
				outItem.IllustrationId = item.IllustrationId;
				outItem.Diagram = item.Diagram;
				outItem.ModifiedDate = item.ModifiedDate;
				
				outItem.AcceptChanges();			
			}
							
			return outItem;
		}
コード例 #29
0
		/// <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);
		}
コード例 #30
0
		/// <summary>
		/// 	Inserts a Nettiers.AdventureWorks.Entities.WorkOrderRouting object into the datasource using a transaction.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="entity">Nettiers.AdventureWorks.Entities.WorkOrderRouting object to insert.</param>
		/// <remarks>
		///		After inserting into the datasource, the Nettiers.AdventureWorks.Entities.WorkOrderRouting 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.WorkOrderRouting entity)
		{
			SqlDatabase database = new SqlDatabase(this._connectionString);
			DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "Production.usp_adwTiers_WorkOrderRouting_Insert", _useStoredProcedure);
			
			database.AddInParameter(commandWrapper, "@WorkOrderId", DbType.Int32, entity.WorkOrderId );
			database.AddInParameter(commandWrapper, "@ProductId", DbType.Int32, entity.ProductId );
			database.AddInParameter(commandWrapper, "@OperationSequence", DbType.Int16, entity.OperationSequence );
			database.AddInParameter(commandWrapper, "@LocationId", DbType.Int16, entity.LocationId );
			database.AddInParameter(commandWrapper, "@ScheduledStartDate", DbType.DateTime, entity.ScheduledStartDate );
			database.AddInParameter(commandWrapper, "@ScheduledEndDate", DbType.DateTime, entity.ScheduledEndDate );
			database.AddInParameter(commandWrapper, "@ActualStartDate", DbType.DateTime, (entity.ActualStartDate.HasValue ? (object) entity.ActualStartDate  : System.DBNull.Value));
			database.AddInParameter(commandWrapper, "@ActualEndDate", DbType.DateTime, (entity.ActualEndDate.HasValue ? (object) entity.ActualEndDate  : System.DBNull.Value));
			database.AddInParameter(commandWrapper, "@ActualResourceHrs", DbType.Decimal, (entity.ActualResourceHrs.HasValue ? (object) entity.ActualResourceHrs  : System.DBNull.Value));
			database.AddInParameter(commandWrapper, "@PlannedCost", DbType.Currency, entity.PlannedCost );
			database.AddInParameter(commandWrapper, "@ActualCost", DbType.Currency, (entity.ActualCost.HasValue ? (object) entity.ActualCost  : System.DBNull.Value));
			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);
			}
					
			
			entity.OriginalWorkOrderId = entity.WorkOrderId;
			entity.OriginalProductId = entity.ProductId;
			entity.OriginalOperationSequence = entity.OperationSequence;
			
			entity.AcceptChanges();
	
			//Provider Data Requested Command Event
			OnDataRequested(new CommandEventArgs(commandWrapper, "Insert", entity));

			return Convert.ToBoolean(results);
		}