//[Transactional(TransactionalTypes.TransactionScope)] protected void DataPortal_Delete(BudgetClientAdjustmentCriteria criteria) { bool cancel = false; OnDeleting(criteria, ref cancel); if (cancel) { return; } using (var connection = new SqlConnection(ADOHelper.ConnectionString)) { connection.Open(); using (var command = new SqlCommand("[dbo].[spCFM_BudgetClientAdjustment_Delete]", connection)) { command.CommandType = CommandType.StoredProcedure; command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag)); //result: The number of rows changed, inserted, or deleted. -1 for select statements; 0 if no rows were affected, or the statement failed. int result = command.ExecuteNonQuery(); if (result == 0) { throw new DBConcurrencyException("The entity is out of date on the client. Please update the entity and try again. This could also be thrown if the sql statement failed to execute."); } } } OnDeleted(); }
private BudgetClientAdjustment DataPortal_Fetch(BudgetClientAdjustmentCriteria criteria) { bool cancel = false; OnFetching(criteria, ref cancel); if (cancel) { return(null); } using (var connection = new SqlConnection(ADOHelper.ConnectionString)) { connection.Open(); using (var command = new SqlCommand("[dbo].[spCFM_BudgetClientAdjustment_Select]", connection)) { command.CommandType = CommandType.StoredProcedure; command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag)); command.Parameters.AddWithValue("@p_UpdatedByHasValue", criteria.UpdatedByHasValue); command.Parameters.AddWithValue("@p_UpdatedOnHasValue", criteria.UpdatedOnHasValue); using (var reader = command.ExecuteReader()) { var rowParser = reader.GetRowParser <BudgetClientAdjustment>(); if (reader.Read()) { return(GetBudgetClientAdjustment(rowParser, reader)); } else { throw new Exception(String.Format("The record was not found in 'dbo.BudgetClientAdjustment' using the following criteria: {0}.", criteria)); } } } } OnFetched(); }
/// <summary> /// Returns a <see cref="BudgetClientAdjustmentList"/> object of the specified criteria. /// </summary> /// <param name="homeClientID">No additional detail available.</param> /// <returns>A <see cref="BudgetClientAdjustmentList"/> object of the specified criteria.</returns> public static BudgetClientAdjustmentList GetByHomeClientID(System.Int32 homeClientID) { var criteria = new BudgetClientAdjustmentCriteria { HomeClientID = homeClientID }; return(new BudgetClientAdjustmentList().DataPortal_Fetch(criteria)); }
/// <summary> /// Returns a <see cref="BudgetClientAdjustmentList"/> object of the specified criteria. /// </summary> /// <param name="categoryID">No additional detail available.</param> /// <returns>A <see cref="BudgetClientAdjustmentList"/> object of the specified criteria.</returns> public static BudgetClientAdjustmentList GetByCategoryID(System.Int32 categoryID) { var criteria = new BudgetClientAdjustmentCriteria { CategoryID = categoryID }; return(new BudgetClientAdjustmentList().DataPortal_Fetch(criteria)); }
public static void DeleteBudgetClientAdjustment(System.Int32 budgetClientAdjustmentID) { var criteria = new BudgetClientAdjustmentCriteria { BudgetClientAdjustmentID = budgetClientAdjustmentID }; new BudgetClientAdjustment().DataPortal_Delete(criteria); }
/// <summary> /// Returns a <see cref="BudgetClientAdjustment"/> object of the specified criteria. /// </summary> /// <param name="budgetID">No additional detail available.</param> /// <returns>A <see cref="BudgetClientAdjustment"/> object of the specified criteria.</returns> public static BudgetClientAdjustment GetByBudgetID(System.Int32 budgetID) { var criteria = new BudgetClientAdjustmentCriteria { BudgetID = budgetID }; return(new BudgetClientAdjustment().DataPortal_Fetch(criteria)); }
/// <summary> /// CodeSmith generated stub method that is called after the child <see cref="BudgetClientAdjustment"/> object with the specified criteria has been deleted. /// </summary> //partial void OnDeleted(); //partial void OnChildLoading(Csla.Core.IPropertyInfo childProperty, ref bool cancel); #endregion #region Exists Command /// <summary> /// Determines if a record exists in the BudgetClientAdjustment table in the database for the specified criteria. /// </summary> /// <param name="criteria">The criteria parameter is an <see cref="BudgetClientAdjustment"/> object.</param> /// <returns>A boolean value of true is returned if a record is found.</returns> public static BudgetClientAdjustment Exists(BudgetClientAdjustmentCriteria criteria) { try { return(new BudgetClientAdjustment().DataPortal_Fetch(criteria)); } catch (Exception ex) { } return(null); }
private BudgetClientAdjustmentList DataPortal_Fetch(BudgetClientAdjustmentCriteria criteria) { bool cancel = false; OnFetching(criteria, ref cancel); if (cancel) { return(null); } //RaiseListChangedEvents = false; // Fetch Child objects. using (var connection = new SqlConnection(ADOHelper.ConnectionString)) { connection.Open(); using (var command = new SqlCommand("[dbo].[spCFM_BudgetClientAdjustment_Select]", connection)) { command.CommandType = CommandType.StoredProcedure; command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag)); command.Parameters.AddWithValue("@p_UpdatedByHasValue", criteria.UpdatedByHasValue); command.Parameters.AddWithValue("@p_UpdatedOnHasValue", criteria.UpdatedOnHasValue); using (var reader = command.ExecuteReader()) { if (reader.Read()) { var rowParser = reader.GetRowParser <CFMData.BudgetClientAdjustment>(); do { this.Add(CFMData.BudgetClientAdjustment.GetBudgetClientAdjustment(rowParser, reader)); }while(reader.Read()); } OnFetched(); return(this); } } } //RaiseListChangedEvents = true; }
/// <summary> /// CodeSmith generated stub method that is called when fetching the child <see cref="BudgetClientAdjustment"/> object. /// </summary> /// <param name="criteria"><see cref="BudgetClientAdjustmentCriteria"/> object containing the criteria of the object to fetch.</param> /// <param name="cancel">Value returned from the method indicating whether the object fetching should proceed.</param> partial void OnFetching(BudgetClientAdjustmentCriteria criteria, ref bool cancel);
public static BudgetClientAdjustmentList GetByCriteria(BudgetClientAdjustmentCriteria criteria) { return(new BudgetClientAdjustmentList().DataPortal_Fetch(criteria)); // return DataPortal.Fetch<BudgetClientAdjustmentList>(criteria); }
/// <summary> /// CodeSmith generated stub method that is called when deleting the child <see cref="BudgetClientAdjustment"/> object. /// </summary> /// <param name="criteria"><see cref="BudgetClientAdjustmentCriteria"/> object containing the criteria of the object to delete.</param> /// <param name="cancel">Value returned from the method indicating whether the object deletion should proceed.</param> //partial void OnDeleting(BudgetClientAdjustmentCriteria criteria, ref bool cancel); /// <summary> /// CodeSmith generated stub method that is called when deleting the child <see cref="BudgetClientAdjustment"/> object. /// </summary> /// <param name="criteria"><see cref="BudgetClientAdjustmentCriteria"/> object containing the criteria of the object to delete.</param> /// <param name="connection"></param> /// <param name="cancel">Value returned from the method indicating whether the object deletion should proceed.</param> partial void OnDeleting(BudgetClientAdjustmentCriteria criteria, SqlConnection connection, ref bool cancel);