public List <EligibilityDepartment> GetAll() { EligibilityDepartmentDAC _eligibilityDepartmentComponent = new EligibilityDepartmentDAC(); IDataReader reader = _eligibilityDepartmentComponent.GetAllEligibilityDepartment().CreateDataReader(); List <EligibilityDepartment> _eligibilityDepartmentList = new List <EligibilityDepartment>(); while (reader.Read()) { if (_eligibilityDepartmentList == null) { _eligibilityDepartmentList = new List <EligibilityDepartment>(); } EligibilityDepartment _eligibilityDepartment = new EligibilityDepartment(); if (reader["EligibilityDepartmentId"] != DBNull.Value) { _eligibilityDepartment.EligibilityDepartmentId = Convert.ToInt32(reader["EligibilityDepartmentId"]); } if (reader["DepartmentName"] != DBNull.Value) { _eligibilityDepartment.DepartmentName = Convert.ToString(reader["DepartmentName"]); } _eligibilityDepartment.NewRecord = false; _eligibilityDepartmentList.Add(_eligibilityDepartment); } reader.Close(); return(_eligibilityDepartmentList); }
public bool Insert(EligibilityDepartment eligibilitydepartment) { int autonumber = 0; EligibilityDepartmentDAC eligibilitydepartmentComponent = new EligibilityDepartmentDAC(); bool endedSuccessfuly = eligibilitydepartmentComponent.InsertNewEligibilityDepartment(ref autonumber, eligibilitydepartment.DepartmentName); if (endedSuccessfuly) { eligibilitydepartment.EligibilityDepartmentId = autonumber; } return(endedSuccessfuly); }
public EligibilityDepartment GetByID(int _eligibilityDepartmentId) { EligibilityDepartmentDAC _eligibilityDepartmentComponent = new EligibilityDepartmentDAC(); IDataReader reader = _eligibilityDepartmentComponent.GetByIDEligibilityDepartment(_eligibilityDepartmentId); EligibilityDepartment _eligibilityDepartment = null; while (reader.Read()) { _eligibilityDepartment = new EligibilityDepartment(); if (reader["EligibilityDepartmentId"] != DBNull.Value) { _eligibilityDepartment.EligibilityDepartmentId = Convert.ToInt32(reader["EligibilityDepartmentId"]); } if (reader["DepartmentName"] != DBNull.Value) { _eligibilityDepartment.DepartmentName = Convert.ToString(reader["DepartmentName"]); } _eligibilityDepartment.NewRecord = false; } reader.Close(); return(_eligibilityDepartment); }
public bool Update(EligibilityDepartment eligibilitydepartment, int old_eligibilityDepartmentId) { EligibilityDepartmentDAC eligibilitydepartmentComponent = new EligibilityDepartmentDAC(); return(eligibilitydepartmentComponent.UpdateEligibilityDepartment(eligibilitydepartment.DepartmentName, old_eligibilityDepartmentId)); }