/// <summary> /// Load Object /// </summary> /// <param name="reader"></param> /// <param name="child"></param> private static void LoadObject(MySqlDataReader reader, ChildRoom childRoom) { childRoom.UID = reader.GetInt32(FieldName.UID); childRoom.FKChildUID = reader.GetInt32(FieldName.FKChildUID); childRoom.FKRoomUID = reader.GetInt32(FieldName.FKRoomUID); childRoom.StartDate = reader.GetDateTime(FieldName.StartDate); childRoom.EndDate = reader.GetDateTime(FieldName.EndDate); // ----------------------------------------------------------------------------------------- childRoom.UpdateDateTime = Convert.ToDateTime((reader[CommonDB.FieldName.UpdateDateTime])); childRoom.UserIdUpdatedBy = reader[CommonDB.FieldName.UserIdUpdatedBy] as string; childRoom.CreationDateTime = Convert.ToDateTime((reader[CommonDB.FieldName.CreationDateTime])); childRoom.UserIdCreatedBy = reader[CommonDB.FieldName.UserIdCreatedBy] as string; childRoom.RecordVersion = Convert.ToInt32(reader[CommonDB.FieldName.RecordVersion]); childRoom.IsVoid = reader[CommonDB.FieldName.IsVoid] as string; }
/// <summary> /// List clients /// </summary> /// <param name="userID"></param> public void List(string userID) { childRoomList = new List <ChildRoom>(); using (var connection = new MySqlConnection(ConnectionString.GetConnectionString())) { var commandString = string.Format( " SELECT " + FieldString() + " FROM ChildRoom " + " WHERE IsVoid = 'N' " + " ORDER BY UID ASC " ); using (var command = new MySqlCommand( commandString, connection)) { connection.Open(); try { using (MySqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { var childRoom = new ChildRoom(); LoadObject(reader, childRoom); childRoomList.Add(childRoom); } } } catch (Exception ex) { string error = ex.ToString(); LogFile.WriteToTodaysLogFile(ex.ToString(), userID, "", "ChildRoom.cs"); } } } }