public List <WardFor> GetAll() { WardForDAC _wardForComponent = new WardForDAC(); IDataReader reader = _wardForComponent.GetAllWardFor().CreateDataReader(); List <WardFor> _wardForList = new List <WardFor>(); while (reader.Read()) { if (_wardForList == null) { _wardForList = new List <WardFor>(); } WardFor _wardFor = new WardFor(); if (reader["WardForId"] != DBNull.Value) { _wardFor.WardForId = Convert.ToInt32(reader["WardForId"]); } if (reader["WardForName"] != DBNull.Value) { _wardFor.WardForName = Convert.ToString(reader["WardForName"]); } _wardFor.NewRecord = false; _wardForList.Add(_wardFor); } reader.Close(); return(_wardForList); }
public bool Insert(WardFor wardfor) { int autonumber = 0; WardForDAC wardforComponent = new WardForDAC(); bool endedSuccessfuly = wardforComponent.InsertNewWardFor(ref autonumber, wardfor.WardForName); if (endedSuccessfuly) { wardfor.WardForId = autonumber; } return(endedSuccessfuly); }
public WardFor GetByID(int _wardForId) { WardForDAC _wardForComponent = new WardForDAC(); IDataReader reader = _wardForComponent.GetByIDWardFor(_wardForId); WardFor _wardFor = null; while (reader.Read()) { _wardFor = new WardFor(); if (reader["WardForId"] != DBNull.Value) { _wardFor.WardForId = Convert.ToInt32(reader["WardForId"]); } if (reader["WardForName"] != DBNull.Value) { _wardFor.WardForName = Convert.ToString(reader["WardForName"]); } _wardFor.NewRecord = false; } reader.Close(); return(_wardFor); }
public bool Update(WardFor wardfor, int old_wardForId) { WardForDAC wardforComponent = new WardForDAC(); return(wardforComponent.UpdateWardFor(wardfor.WardForName, old_wardForId)); }