本文整理汇总了C#中Library.AcceptChanges方法的典型用法代码示例。如果您正苦于以下问题:C# Library.AcceptChanges方法的具体用法?C# Library.AcceptChanges怎么用?C# Library.AcceptChanges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Library
的用法示例。
在下文中一共展示了Library.AcceptChanges方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
/// <summary>
/// Update an existing row in the datasource.
/// </summary>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <param name="entity">Library.BLL.BookImage object to update.</param>
/// <remarks>
/// After updating the datasource, the Library.BLL.BookImage 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, Library.BLL.BookImage entity)
{
SqlDatabase database = new SqlDatabase(this._connectionString);
DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "dbo.BookImage_Update", _useStoredProcedure);
database.AddInParameter(commandWrapper, "@ID", DbType.Int32, entity.ID );
database.AddInParameter(commandWrapper, "@Name", DbType.String, entity.Name );
database.AddInParameter(commandWrapper, "@Format", DbType.String, entity.Format );
database.AddInParameter(commandWrapper, "@Size", DbType.String, entity.Size );
database.AddInParameter(commandWrapper, "@Link", DbType.String, entity.Link );
database.AddInParameter(commandWrapper, "@IsAvailable", DbType.String, entity.IsAvailable );
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);
}
示例2: Update
/// <summary>
/// Update an existing row in the datasource.
/// </summary>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <param name="entity">Library.BLL.Book object to update.</param>
/// <remarks>
/// After updating the datasource, the Library.BLL.Book 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, Library.BLL.Book entity)
{
SqlDatabase database = new SqlDatabase(this._connectionString);
DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "dbo.Book_Update", _useStoredProcedure);
database.AddInParameter(commandWrapper, "@ID", DbType.Int32, entity.ID );
database.AddInParameter(commandWrapper, "@Name", DbType.String, entity.Name );
database.AddInParameter(commandWrapper, "@Publisher", DbType.String, entity.Publisher );
database.AddInParameter(commandWrapper, "@Publish_Date", DbType.Date, (entity.Publish_Date.HasValue ? (object) entity.Publish_Date : System.DBNull.Value) );
database.AddInParameter(commandWrapper, "@IsAvailablePdf", DbType.Boolean, (entity.IsAvailablePdf.HasValue ? (object) entity.IsAvailablePdf : System.DBNull.Value) );
database.AddInParameter(commandWrapper, "@IsAvailablePaper", DbType.Boolean, (entity.IsAvailablePaper.HasValue ? (object) entity.IsAvailablePaper : System.DBNull.Value) );
database.AddInParameter(commandWrapper, "@IsBorrowed", DbType.Boolean, entity.IsBorrowed );
database.AddInParameter(commandWrapper, "@User_ID", DbType.Int32, entity.User_ID );
database.AddInParameter(commandWrapper, "@BorrowDate", DbType.Date, (entity.BorrowDate.HasValue ? (object) entity.BorrowDate : System.DBNull.Value) );
database.AddInParameter(commandWrapper, "@Borrow_Times", DbType.Int32, (entity.Borrow_Times.HasValue ? (object) entity.Borrow_Times : System.DBNull.Value) );
database.AddInParameter(commandWrapper, "@IsLost", DbType.Boolean, (entity.IsLost.HasValue ? (object) entity.IsLost : System.DBNull.Value) );
database.AddInParameter(commandWrapper, "@Type_ID", DbType.Int32, entity.Type_ID );
database.AddInParameter(commandWrapper, "@Publisher_ID", DbType.Int32, entity.Publisher_ID );
database.AddInParameter(commandWrapper, "@Papers_no", DbType.Int32, (entity.Papers_no.HasValue ? (object) entity.Papers_no : System.DBNull.Value) );
database.AddInParameter(commandWrapper, "@Introducer_ID", DbType.Int32, (entity.Introducer_ID.HasValue ? (object) entity.Introducer_ID : System.DBNull.Value) );
database.AddInParameter(commandWrapper, "@EmployeeI_D", DbType.Int32, entity.EmployeeI_D );
database.AddInParameter(commandWrapper, "@Size", DbType.Double, (entity.Size.HasValue ? (object) entity.Size : System.DBNull.Value) );
database.AddInParameter(commandWrapper, "@Price", DbType.Int32, (entity.Price.HasValue ? (object) entity.Price : System.DBNull.Value) );
database.AddInParameter(commandWrapper, "@Pdf_Link", DbType.String, entity.Pdf_Link );
database.AddInParameter(commandWrapper, "@Image_ID", DbType.Int32, entity.Image_ID );
database.AddInParameter(commandWrapper, "@ISBN", DbType.String, entity.ISBN );
database.AddInParameter(commandWrapper, "@CreatedOn", DbType.DateTime, (entity.CreatedOn.HasValue ? (object) entity.CreatedOn : System.DBNull.Value) );
database.AddInParameter(commandWrapper, "@CreatedBy", DbType.Int32, (entity.CreatedBy.HasValue ? (object) entity.CreatedBy : System.DBNull.Value) );
database.AddInParameter(commandWrapper, "@UpdatedOn", DbType.DateTime, (entity.UpdatedOn.HasValue ? (object) entity.UpdatedOn : System.DBNull.Value) );
database.AddInParameter(commandWrapper, "@UpdatedBy", DbType.Int32, (entity.UpdatedBy.HasValue ? (object) entity.UpdatedBy : System.DBNull.Value) );
database.AddInParameter(commandWrapper, "@DeletedOn", DbType.DateTime, (entity.DeletedOn.HasValue ? (object) entity.DeletedOn : System.DBNull.Value) );
database.AddInParameter(commandWrapper, "@DeletedBy", DbType.Int32, (entity.DeletedBy.HasValue ? (object) entity.DeletedBy : System.DBNull.Value) );
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);
}
示例3: Insert
/// <summary>
/// Inserts a Library.BLL.BookImage object into the datasource using a transaction.
/// </summary>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <param name="entity">Library.BLL.BookImage object to insert.</param>
/// <remarks>
/// After inserting into the datasource, the Library.BLL.BookImage 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, Library.BLL.BookImage entity)
{
SqlDatabase database = new SqlDatabase(this._connectionString);
DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "dbo.BookImage_Insert", _useStoredProcedure);
database.AddOutParameter(commandWrapper, "@ID", DbType.Int32, 4);
database.AddInParameter(commandWrapper, "@Name", DbType.String, entity.Name );
database.AddInParameter(commandWrapper, "@Format", DbType.String, entity.Format );
database.AddInParameter(commandWrapper, "@Size", DbType.String, entity.Size );
database.AddInParameter(commandWrapper, "@Link", DbType.String, entity.Link );
database.AddInParameter(commandWrapper, "@IsAvailable", DbType.String, entity.IsAvailable );
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 _iD = database.GetParameterValue(commandWrapper, "@ID");
entity.ID = (System.Int32)_iD;
entity.AcceptChanges();
//Provider Data Requested Command Event
OnDataRequested(new CommandEventArgs(commandWrapper, "Insert", entity));
return Convert.ToBoolean(results);
}
示例4: Insert
/// <summary>
/// Inserts a Library.BLL.Employee object into the datasource using a transaction.
/// </summary>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <param name="entity">Library.BLL.Employee object to insert.</param>
/// <remarks>
/// After inserting into the datasource, the Library.BLL.Employee 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, Library.BLL.Employee entity)
{
SqlDatabase database = new SqlDatabase(this._connectionString);
DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "dbo.Employee_Insert", _useStoredProcedure);
database.AddOutParameter(commandWrapper, "@ID", DbType.Int32, 4);
database.AddInParameter(commandWrapper, "@UserName", DbType.String, entity.UserName );
database.AddInParameter(commandWrapper, "@Password", DbType.String, entity.Password );
database.AddInParameter(commandWrapper, "@Last_Login", DbType.DateTime, (entity.Last_Login.HasValue ? (object) entity.Last_Login : System.DBNull.Value));
database.AddInParameter(commandWrapper, "@Last_Logout", DbType.DateTime, entity.Last_Logout );
database.AddInParameter(commandWrapper, "@Is_Online", DbType.Boolean, (entity.Is_Online.HasValue ? (object) entity.Is_Online : System.DBNull.Value));
database.AddInParameter(commandWrapper, "@Is_Active", DbType.Boolean, (entity.Is_Active.HasValue ? (object) entity.Is_Active : System.DBNull.Value));
database.AddInParameter(commandWrapper, "@Is_Admin", DbType.Boolean, (entity.Is_Admin.HasValue ? (object) entity.Is_Admin : System.DBNull.Value));
database.AddInParameter(commandWrapper, "@First_Name", DbType.String, entity.First_Name );
database.AddInParameter(commandWrapper, "@Last_Name", DbType.String, entity.Last_Name );
database.AddInParameter(commandWrapper, "@Email", DbType.String, entity.Email );
database.AddInParameter(commandWrapper, "@Country", DbType.String, entity.Country );
database.AddInParameter(commandWrapper, "@City", DbType.String, entity.City );
database.AddInParameter(commandWrapper, "@Address", DbType.String, entity.Address );
database.AddInParameter(commandWrapper, "@Mobile", DbType.String, entity.Mobile );
database.AddInParameter(commandWrapper, "@Phone", DbType.String, entity.Phone );
database.AddInParameter(commandWrapper, "@Postion", DbType.String, entity.Postion );
database.AddInParameter(commandWrapper, "@Is_Deleted", DbType.Boolean, (entity.Is_Deleted.HasValue ? (object) entity.Is_Deleted : System.DBNull.Value));
database.AddInParameter(commandWrapper, "@CreatedOn", DbType.DateTime, (entity.CreatedOn.HasValue ? (object) entity.CreatedOn : System.DBNull.Value));
database.AddInParameter(commandWrapper, "@CreatedBy", DbType.Int32, (entity.CreatedBy.HasValue ? (object) entity.CreatedBy : System.DBNull.Value));
database.AddInParameter(commandWrapper, "@UpdatedOn", DbType.DateTime, (entity.UpdatedOn.HasValue ? (object) entity.UpdatedOn : System.DBNull.Value));
database.AddInParameter(commandWrapper, "@UpdatedBy", DbType.Int32, (entity.UpdatedBy.HasValue ? (object) entity.UpdatedBy : System.DBNull.Value));
database.AddInParameter(commandWrapper, "@DeletedOn", DbType.DateTime, (entity.DeletedOn.HasValue ? (object) entity.DeletedOn : System.DBNull.Value));
database.AddInParameter(commandWrapper, "@DeletedBy", DbType.Int32, (entity.DeletedBy.HasValue ? (object) entity.DeletedBy : 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);
}
object _iD = database.GetParameterValue(commandWrapper, "@ID");
entity.ID = (System.Int32)_iD;
entity.AcceptChanges();
//Provider Data Requested Command Event
OnDataRequested(new CommandEventArgs(commandWrapper, "Insert", entity));
return Convert.ToBoolean(results);
}
示例5: Update
/// <summary>
/// Update an existing row in the datasource.
/// </summary>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <param name="entity">Library.BLL.Publisher object to update.</param>
/// <remarks>
/// After updating the datasource, the Library.BLL.Publisher 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, Library.BLL.Publisher entity)
{
SqlDatabase database = new SqlDatabase(this._connectionString);
DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "dbo.Publisher_Update", _useStoredProcedure);
database.AddInParameter(commandWrapper, "@ID", DbType.Int32, entity.ID );
database.AddInParameter(commandWrapper, "@Name", DbType.String, entity.Name );
database.AddInParameter(commandWrapper, "@Mobile", DbType.StringFixedLength, entity.Mobile );
database.AddInParameter(commandWrapper, "@Email", DbType.String, entity.Email );
database.AddInParameter(commandWrapper, "@Website", DbType.String, entity.Website );
database.AddInParameter(commandWrapper, "@FounedOn", DbType.Date, (entity.FounedOn.HasValue ? (object) entity.FounedOn : System.DBNull.Value) );
database.AddInParameter(commandWrapper, "@Country", DbType.String, entity.Country );
database.AddInParameter(commandWrapper, "@City", DbType.String, entity.City );
database.AddInParameter(commandWrapper, "@Address", DbType.String, entity.Address );
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);
}
示例6: Insert
/// <summary>
/// Inserts a Library.BLL.Publisher object into the datasource using a transaction.
/// </summary>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <param name="entity">Library.BLL.Publisher object to insert.</param>
/// <remarks>
/// After inserting into the datasource, the Library.BLL.Publisher 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, Library.BLL.Publisher entity)
{
SqlDatabase database = new SqlDatabase(this._connectionString);
DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "dbo.Publisher_Insert", _useStoredProcedure);
database.AddOutParameter(commandWrapper, "@ID", DbType.Int32, 4);
database.AddInParameter(commandWrapper, "@Name", DbType.String, entity.Name );
database.AddInParameter(commandWrapper, "@Mobile", DbType.StringFixedLength, entity.Mobile );
database.AddInParameter(commandWrapper, "@Email", DbType.String, entity.Email );
database.AddInParameter(commandWrapper, "@Website", DbType.String, entity.Website );
database.AddInParameter(commandWrapper, "@FounedOn", DbType.Date, (entity.FounedOn.HasValue ? (object) entity.FounedOn : System.DBNull.Value));
database.AddInParameter(commandWrapper, "@Country", DbType.String, entity.Country );
database.AddInParameter(commandWrapper, "@City", DbType.String, entity.City );
database.AddInParameter(commandWrapper, "@Address", DbType.String, entity.Address );
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 _iD = database.GetParameterValue(commandWrapper, "@ID");
entity.ID = (System.Int32)_iD;
entity.AcceptChanges();
//Provider Data Requested Command Event
OnDataRequested(new CommandEventArgs(commandWrapper, "Insert", entity));
return Convert.ToBoolean(results);
}
示例7: Update
/// <summary>
/// Update an existing row in the datasource.
/// </summary>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <param name="entity">Library.BLL.Course object to update.</param>
/// <remarks>
/// After updating the datasource, the Library.BLL.Course 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, Library.BLL.Course entity)
{
SqlDatabase database = new SqlDatabase(this._connectionString);
DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "dbo.Course_Update", _useStoredProcedure);
database.AddInParameter(commandWrapper, "@ID", DbType.Int32, entity.ID );
database.AddInParameter(commandWrapper, "@Course_Name", DbType.String, entity.Course_Name );
database.AddInParameter(commandWrapper, "@Course_Scope", DbType.Int32, entity.Course_Scope );
database.AddInParameter(commandWrapper, "@Duration", DbType.Int32, entity.Duration );
database.AddInParameter(commandWrapper, "@DurationType_ID", DbType.Int32, entity.DurationType_ID );
database.AddInParameter(commandWrapper, "@Is_Deleted", DbType.Boolean, (entity.Is_Deleted.HasValue ? (object) entity.Is_Deleted : System.DBNull.Value) );
database.AddInParameter(commandWrapper, "@CreatedOn", DbType.DateTime, (entity.CreatedOn.HasValue ? (object) entity.CreatedOn : System.DBNull.Value) );
database.AddInParameter(commandWrapper, "@CreatedBy", DbType.Int32, (entity.CreatedBy.HasValue ? (object) entity.CreatedBy : System.DBNull.Value) );
database.AddInParameter(commandWrapper, "@UpdatedOn", DbType.DateTime, (entity.UpdatedOn.HasValue ? (object) entity.UpdatedOn : System.DBNull.Value) );
database.AddInParameter(commandWrapper, "@UpdatedBy", DbType.Int32, (entity.UpdatedBy.HasValue ? (object) entity.UpdatedBy : System.DBNull.Value) );
database.AddInParameter(commandWrapper, "@DeletedOn", DbType.DateTime, (entity.DeletedOn.HasValue ? (object) entity.DeletedOn : System.DBNull.Value) );
database.AddInParameter(commandWrapper, "@DeletedBy", DbType.Int32, (entity.DeletedBy.HasValue ? (object) entity.DeletedBy : System.DBNull.Value) );
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);
}
示例8: Insert
/// <summary>
/// Inserts a Library.BLL.Course object into the datasource using a transaction.
/// </summary>
/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
/// <param name="entity">Library.BLL.Course object to insert.</param>
/// <remarks>
/// After inserting into the datasource, the Library.BLL.Course 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, Library.BLL.Course entity)
{
SqlDatabase database = new SqlDatabase(this._connectionString);
DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "dbo.Course_Insert", _useStoredProcedure);
database.AddOutParameter(commandWrapper, "@ID", DbType.Int32, 4);
database.AddInParameter(commandWrapper, "@Course_Name", DbType.String, entity.Course_Name );
database.AddInParameter(commandWrapper, "@Course_Scope", DbType.Int32, entity.Course_Scope );
database.AddInParameter(commandWrapper, "@Duration", DbType.Int32, entity.Duration );
database.AddInParameter(commandWrapper, "@DurationType_ID", DbType.Int32, entity.DurationType_ID );
database.AddInParameter(commandWrapper, "@Is_Deleted", DbType.Boolean, (entity.Is_Deleted.HasValue ? (object) entity.Is_Deleted : System.DBNull.Value));
database.AddInParameter(commandWrapper, "@CreatedOn", DbType.DateTime, (entity.CreatedOn.HasValue ? (object) entity.CreatedOn : System.DBNull.Value));
database.AddInParameter(commandWrapper, "@CreatedBy", DbType.Int32, (entity.CreatedBy.HasValue ? (object) entity.CreatedBy : System.DBNull.Value));
database.AddInParameter(commandWrapper, "@UpdatedOn", DbType.DateTime, (entity.UpdatedOn.HasValue ? (object) entity.UpdatedOn : System.DBNull.Value));
database.AddInParameter(commandWrapper, "@UpdatedBy", DbType.Int32, (entity.UpdatedBy.HasValue ? (object) entity.UpdatedBy : System.DBNull.Value));
database.AddInParameter(commandWrapper, "@DeletedOn", DbType.DateTime, (entity.DeletedOn.HasValue ? (object) entity.DeletedOn : System.DBNull.Value));
database.AddInParameter(commandWrapper, "@DeletedBy", DbType.Int32, (entity.DeletedBy.HasValue ? (object) entity.DeletedBy : 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);
}
object _iD = database.GetParameterValue(commandWrapper, "@ID");
entity.ID = (System.Int32)_iD;
entity.AcceptChanges();
//Provider Data Requested Command Event
OnDataRequested(new CommandEventArgs(commandWrapper, "Insert", entity));
return Convert.ToBoolean(results);
}