public ContractType GetByID(int _contractTypeID) { ContractTypeDAC _contractTypeComponent = new ContractTypeDAC(); IDataReader reader = _contractTypeComponent.GetByIDContractType(_contractTypeID); ContractType _contractType = null; while(reader.Read()) { _contractType = new ContractType(); if(reader["ContractTypeID"] != DBNull.Value) _contractType.ContractTypeID = Convert.ToInt32(reader["ContractTypeID"]); if(reader["Name"] != DBNull.Value) _contractType.Name = Convert.ToString(reader["Name"]); _contractType.NewRecord = false; } reader.Close(); return _contractType; }
public List<ContractType> GetAll() { ContractTypeDAC _contractTypeComponent = new ContractTypeDAC(); IDataReader reader = _contractTypeComponent.GetAllContractType().CreateDataReader(); List<ContractType> _contractTypeList = new List<ContractType>(); while(reader.Read()) { if(_contractTypeList == null) _contractTypeList = new List<ContractType>(); ContractType _contractType = new ContractType(); if(reader["ContractTypeID"] != DBNull.Value) _contractType.ContractTypeID = Convert.ToInt32(reader["ContractTypeID"]); if(reader["Name"] != DBNull.Value) _contractType.Name = Convert.ToString(reader["Name"]); _contractType.NewRecord = false; _contractTypeList.Add(_contractType); } reader.Close(); return _contractTypeList; }
public bool Update(ContractType contracttype ,int old_contractTypeID) { ContractTypeDAC contracttypeComponent = new ContractTypeDAC(); return contracttypeComponent.UpdateContractType( contracttype.ContractTypeID, contracttype.Name, old_contractTypeID); }
public bool Insert(ContractType contracttype) { ContractTypeDAC contracttypeComponent = new ContractTypeDAC(); return contracttypeComponent.InsertNewContractType( contracttype.ContractTypeID, contracttype.Name); }