public override bool Update(TransactionManager transactionManager, Trouble entity) { SqlDatabase database = new SqlDatabase(this._connectionString); DbCommand command = StoredProcedureProvider.GetCommandWrapper(database, "dbo.Trouble_Update", this._useStoredProcedure); database.AddInParameter(command, "@TroubleID", DbType.Int32, entity.TroubleID); database.AddInParameter(command, "@InspectSituationID", DbType.Int32, entity.InspectSituationID); database.AddInParameter(command, "@Requirement", DbType.AnsiString, entity.Requirement); database.AddInParameter(command, "@Suggestion", DbType.AnsiString, entity.Suggestion); database.AddInParameter(command, "@ExecutionTime", DbType.DateTime, entity.ExecutionTime.HasValue ? ((object)entity.ExecutionTime) : ((object)DBNull.Value)); database.AddInParameter(command, "@Place", DbType.AnsiString, entity.Place); database.AddInParameter(command, "@TroubleCompendium", DbType.AnsiString, entity.TroubleCompendium); database.AddInParameter(command, "@Remark", DbType.AnsiString, entity.Remark); database.AddInParameter(command, "@Status", DbType.Int32, entity.Status); int num = 0; if (transactionManager != null) { num = Utility.ExecuteNonQuery(transactionManager, command); } else { num = Utility.ExecuteNonQuery(database, command); } if (DataRepository.Provider.EnableEntityTracking) { EntityManager.StopTracking(entity.EntityTrackingKey); } entity.AcceptChanges(); return(Convert.ToBoolean(num)); }
public virtual Trouble Copy() { Trouble trouble = new Trouble(); trouble.TroubleID = this.TroubleID; trouble.InspectSituationID = this.InspectSituationID; trouble.Requirement = this.Requirement; trouble.Suggestion = this.Suggestion; trouble.ExecutionTime = this.ExecutionTime; trouble.Place = this.Place; trouble.TroubleCompendium = this.TroubleCompendium; trouble.Remark = this.Remark; trouble.Status = this.Status; trouble.AcceptChanges(); return(trouble); }