public bool Insert(BusinessEntity businessentity) { int autonumber = 0; BusinessEntityDAC businessentityComponent = new BusinessEntityDAC(); bool endedSuccessfuly = businessentityComponent.InsertNewBusinessEntity( ref autonumber, businessentity.RowGuid, businessentity.ModifiedDate); if(endedSuccessfuly) { businessentity.BusinessEntityId = autonumber; } return endedSuccessfuly; }
public BusinessEntity GetByID(int _businessEntityId) { BusinessEntityDAC _businessEntityComponent = new BusinessEntityDAC(); IDataReader reader = _businessEntityComponent.GetByIDBusinessEntity(_businessEntityId); BusinessEntity _businessEntity = null; while(reader.Read()) { _businessEntity = new BusinessEntity(); if(reader["BusinessEntityId"] != DBNull.Value) _businessEntity.BusinessEntityId = Convert.ToInt32(reader["BusinessEntityId"]); if(reader["RowGuid"] != DBNull.Value) _businessEntity.RowGuid = new Guid(reader["RowGuid"].ToString()); if(reader["ModifiedDate"] != DBNull.Value) _businessEntity.ModifiedDate = Convert.ToDateTime(reader["ModifiedDate"]); _businessEntity.NewRecord = false; } reader.Close(); return _businessEntity; }
public List<BusinessEntity> GetAll() { BusinessEntityDAC _businessEntityComponent = new BusinessEntityDAC(); IDataReader reader = _businessEntityComponent.GetAllBusinessEntity().CreateDataReader(); List<BusinessEntity> _businessEntityList = new List<BusinessEntity>(); while(reader.Read()) { if(_businessEntityList == null) _businessEntityList = new List<BusinessEntity>(); BusinessEntity _businessEntity = new BusinessEntity(); if(reader["BusinessEntityId"] != DBNull.Value) _businessEntity.BusinessEntityId = Convert.ToInt32(reader["BusinessEntityId"]); if(reader["RowGuid"] != DBNull.Value) _businessEntity.RowGuid = new Guid(reader["RowGuid"].ToString()); if(reader["ModifiedDate"] != DBNull.Value) _businessEntity.ModifiedDate = Convert.ToDateTime(reader["ModifiedDate"]); _businessEntity.NewRecord = false; _businessEntityList.Add(_businessEntity); } reader.Close(); return _businessEntityList; }
public bool Update(BusinessEntity businessentity ,int old_businessEntityId) { BusinessEntityDAC businessentityComponent = new BusinessEntityDAC(); return businessentityComponent.UpdateBusinessEntity( businessentity.RowGuid, businessentity.ModifiedDate, old_businessEntityId); }