/// <summary> /// Constructor /// </summary> ///<param name="DBConnection">Reference to the shared database connection</param> // Revision History // MM/DD/YY who Version Issue# Description // -------- --- ------- ------ --------------------------------------- // 06/13/07 RDB N/A Created // public MeterProgramCollection(ref ProgramDBConnection DBConnection) { Refresh(ref DBConnection); }//end ProgramCollection
}//end Find /// <summary> /// Refresh the list of programs. /// Exceptions should be caught by the calling application. /// </summary> /// <param name="DBConnection"> /// Reference to the shared database connection /// </param> // Revision History // MM/DD/YY who Version Issue# Description // -------- --- ------- ------ --------------------------------------- // 08/10/08 AF Replaced original with this version that // passes a shared connection to the database // public void Refresh(ref ProgramDBConnection DBConnection) { //Clears the collection InnerList.Clear(); OleDbConnection Connection = DBConnection.Open(); OleDbCommand Command = Connection.CreateCommand(); Command.CommandText = QUERY_STRING; // Query Database OleDbDataReader Reader = Command.ExecuteReader(); while (Reader.Read()) { MeterProgram objProgram; string strMeterType = Reader.GetString(PROG_TYPE_INDEX); switch (strMeterType) { // CQ 193215 - removing references to legacy devices /* * case "X20": * { * objProgram = new FULCRUMProgram(ref DBConnection); * objProgram.MeterType = DeviceType.eDeviceTypes.FULCRUM; * break; * } * case "VEC": * { * objProgram = new VECTRONProgram(ref DBConnection); * objProgram.MeterType = DeviceType.eDeviceTypes.VECTRON; * break; * } * case "SEN": * { * objProgram = new SENTINELProgram(ref DBConnection); * objProgram.MeterType = DeviceType.eDeviceTypes.SENTINEL; * break; * } * case "CVI": * { * objProgram = new CENTRON_POLYProgram(ref DBConnection); * objProgram.MeterType = DeviceType.eDeviceTypes.CENTRON_V_AND_I; * break; * } * case "CMA": * { * objProgram = new CENTRON_MONOProgram(ref DBConnection); * objProgram.MeterType = DeviceType.eDeviceTypes.CENTRON_C12_19; * break; * } * case "MT2": * { * objProgram = new CENTRONProgram(ref DBConnection); * objProgram.MeterType = DeviceType.eDeviceTypes.TWO_HUNDRED_SERIES; * break; * } * case "CEN": * { * objProgram = new CENTRONProgram(ref DBConnection); * objProgram.MeterType = DeviceType.eDeviceTypes.CENTRON; * break; * } * case "Q1000": * { * objProgram = new Q1000Program(ref DBConnection); * objProgram.MeterType = DeviceType.eDeviceTypes.Q1000; * break; * } * */ default: { objProgram = new MeterProgram(ref DBConnection); objProgram.MeterType = DeviceType.eDeviceTypes.UNKNOWN; break; } } objProgram.ID = Reader.GetInt16(PROG_ID_INDEX); objProgram.Name = Reader.GetString(PROG_NAME_INDEX); objProgram.LastModified = Reader.GetDateTime(DATE_MODIFIED_INDEX); InnerList.Add(objProgram); } Reader.Close(); //sort programs ProgramInfoComparer comparer = new ProgramInfoComparer(); InnerList.Sort(comparer); }//end Refresh