// devnote: is this needed. Better that all DB init, create, reset ops be performed outside the product public static bool buildDB(DbConnection sql_con) { sql_con.Open(); DbCommand sql_cmd = sql_con.CreateCommand(); //Build tables.... using (DbTransaction mytransaction = sql_con.BeginTransaction()) { try { sql_cmd.ExecuteNonQuery(); mytransaction.Commit(); return(true); } catch (Exception caught) { mytransaction.Rollback(); Console.WriteLine(sql_cmd.CommandText); try { DBMain.AltLog(LogLevels.Error, 70110, caught.Message + sql_cmd.CommandText); sql_con.Close(); return(false); } catch { return(false); } } } }
public DataTable DBProbe(string sSQL) { DataTable DT = new DataTable(); try { SQLSpecific.OpenConn(sql_con); sql_cmd = sql_con.CreateCommand(); sql_cmd.CommandText = sSQL; sql_da.SelectCommand = sql_cmd; int i = sql_da.Fill(DT); string s = "Database:" + sql_con.Database + ", DataSource:" + sql_con.DataSource.ToString() + ", ServerVersion:" + sql_con.ServerVersion; DBDescStr = sql_da.GetType().FullName + "; " + s + " (" + sql_con.ConnectionString + ")"; } catch (Exception caught) { DT = null; DBErrorStr = caught.Message; DBMain.AltLog(LogLevels.Warning, 70193, "DBProbe '" + caught.Message + "'"); } if (sql_con != null) { sql_con.Close(); } return(DT); }
bool SetConnection() { if (connAttempts > 25) { if ((connAttempts % 250) != 0) { return(false); } } // retry 25 times, then every 250 attempts try { if (DBMain.ProviderInvariantName.Equals("")) { return(false); } sql_con = DBMain.CreateConnection(useConnStr: true); sql_con.ConnectionString = DBMain.ConnStr; return(true); } catch (Exception caught) { connAttempts++; Console.WriteLine(caught.Message); } return(false); }
//Return a DataTable based on SQL query public DataTable DT(string sSQL) { DataSet DS = new DataSet(); DataTable DT = new DataTable(); try { if (sql_cmd == null) { sql_cmd = sql_con.CreateCommand(); } sql_cmd.CommandText = sSQL; sql_da.SelectCommand = sql_cmd; DS.Reset(); sql_da.Fill(DS); // hangs here during transfer operations DT = DS.Tables[0]; } catch (Exception caught) { try { DBMain.AltLog(LogLevels.Warning, 70103, "DT '" + caught.Message + "' " + sSQL); } catch { } } return(DT); }
//Return a DataTable based on SQL query public DataTable DT(string sSQL) { DataTable DT = new DataTable(); try { SQLSpecific.OpenConn(sql_con); sql_cmd = sql_con.CreateCommand(); sql_cmd.CommandText = sSQL; sql_da.SelectCommand = sql_cmd; //DS.Reset(); int i = sql_da.Fill(DT); // hangs here during transfer operations //DT = DS.Tables[0]; } catch (Exception caught) { try { DBMain.AltLog(LogLevels.Warning, 70103, "DT '" + caught.Message + "' " + sSQL); } catch { } } //Return DataTable if (sql_con != null) { sql_con.Close(); } return(DT); }
/////////////////////// public bool UpdateCalib(string DetectorName, string ItemType, string calib_table, ElementList sParams) { //NEXT: this duo-lookup part takes too long, so get the values once in a wrapper call, then cache them, then reuse them long l, m; GetKeys(DetectorName, ItemType, out l, out m); DataRow dr = HasRow(l, m); // sets the connection if (l == -1 || m == -1) { DBMain.AltLog(LogLevels.Warning, 70137, "Missing Det/Mat keys ({0},{1}) selecting method calibration params", l, m); return(false); } string wh = " where item_type_id= " + m.ToString() + " AND detector_id=" + l.ToString(); string exsql = "select item_type_id from " + calib_table + wh; // 1 column is sufficient to show existence DataTable dt = db.DT(exsql); if (dt.Rows.Count < 1) { string sSQL = "insert into " + calib_table + " "; sParams.Add(new Element("item_type_id", m)); sParams.Add(new Element("detector_id", l)); sSQL += sParams.ColumnsValues; return(db.Execute(sSQL)); } else { string sSQL1 = "UPDATE " + calib_table + " SET "; string sSQL = sSQL1 + sParams.ColumnEqValueList + wh; return(db.Execute(sSQL)); } }
public string Scalar(string sSQL) { string sData = ""; try { sql_con.Open(); sql_cmd = sql_con.CreateCommand(); sql_cmd.CommandText = sSQL; var o = sql_cmd.ExecuteScalar(); if (o != null) { sData = o.ToString(); } } catch (System.Data.Common.DbException dbx) { DBMain.DBExceptionHandler(dbx, sSQL); } catch (Exception caught) { try { DBMain.AltLog(LogLevels.Warning, 70104, "Scalar '" + caught.Message + "' " + sSQL); sql_con.Close(); return(null); } catch { } } sql_con.Close(); return(sData); }
public int ScalarIntx(string sSQL) { int iData = -1; try { sql_con.Open(); sql_cmd = sql_con.CreateCommand(); sql_cmd.CommandText = sSQL; var wht = sql_cmd.ExecuteScalar(); if (wht == null) { iData = 0; } else { iData = Convert.ToInt32(wht.ToString()); } } catch (Exception caught) { try { DBMain.AltLog(LogLevels.Warning, 70105, "ScalarIntx '" + caught.Message + "' " + sSQL); sql_con.Close(); return(-1); } catch { } } sql_con.Close(); return(iData); }
/////////////////////// public bool Execute(string sSQL) { bool needDb = false; try { if (sql_cmd == null) { sql_cmd = sql_con.CreateCommand(); } sql_cmd.CommandText = sSQL; try { sql_cmd.ExecuteNonQuery(); } catch (System.Data.Common.DbException dbx) { needDb = DBMain.DBExceptionHandler(dbx, sSQL); } } catch (Exception caught) { try { DBMain.AltLog(LogLevels.Warning, 70101, "Execute '" + caught.Message + "' " + sSQL); return(false); } catch { } } return(true); }
public bool Update(string DetectorName, string CounterType, ElementList sParams) { DataRow dr = null; string table = "CountingParams"; if (CounterType.Equals("Multiplicity") || CounterType.Equals("Coincidence")) { table = "LMMultiplicity"; } Detectors dets = new Detectors(db); long l = dets.PrimaryKey(DetectorName); if (l == -1) { DBMain.AltLog(LogLevels.Warning, 70137, "Missing Det key ({0}) selecting CountingParams", l); return(false); } if (table.Equals("LMMultiplicity")) { dr = HasRow(DetectorName, CounterType, table, sParams[faidx].Value); // the FA parameter } else { dr = HasRow(DetectorName, CounterType, table); } if (dr == null) { sParams.Add(new Element("detector_id", l)); string sSQL = "Insert into " + table; sSQL += sParams.ColumnsValues; return(db.Execute(sSQL)); } else { //NEXT: not tested(?) string sSQL = "UPDATE " + table + " SET "; sSQL += (sParams.ColumnEqValueList + " where counter_type=" + SQLSpecific.QVal(CounterType) + " AND detector_id=" + l.ToString()); if (table.Equals("LMMultiplicity")) { sSQL += " AND " + sParams[faidx].Name + "=" + sParams[faidx].Value; } return(db.Execute(sSQL)); } }
/// <summary> /// Handle DB specific exceptions. /// Write errors to console only. /// </summary> /// <param name="dbx">the exception</param> /// <param name="sql">the SQL statement text that threw the error</param> /// <returns>return true if exception is from the preferred provider and no database was found, so that caller may try to create a new database</returns> public static bool DBExceptionHandler(DbException dbx, string sql) { bool neednew = false; //if (dbx is System.Data.SqlServerCe.SqlCeException) // SQL Server CE -- specific test against various SQL errors v. the no database found error //{ // System.Data.SqlServerCe.SqlCeException x = (System.Data.SqlServerCe.SqlCeException)dbx; // //x.NativeError == // DBMain.AltLog(LogLevels.Warning, 70147, DBExceptionString(dbx, sql)); //} //else if (dbx is System.Data.SQLite.SQLiteException) // SQLite3 -- specific test against various SQL errors v. the no database found error { System.Data.SQLite.SQLiteException x = (System.Data.SQLite.SQLiteException)dbx; if (x.ResultCode == SQLiteErrorCode.Error) // SQL error or missing database { neednew = !(dbx.Message.EndsWith("syntax error") || // not an SQL syntax error dbx.Message.Contains("no such table") || //or malformed schema, dbx.Message.Contains("has no column named")); // nor mismatched column, but likely a missing DB if (!neednew) { DBMain.AltLog(LogLevels.Warning, 70136, DBExceptionString(dbx, sql), true); } } else { DBMain.AltLog(LogLevels.Warning, 70137, DBExceptionString(dbx, sql)); } } else if (dbx is System.Data.OleDb.OleDbException) // Access { DBMain.AltLog(LogLevels.Warning, 70140, DBExceptionString(dbx, sql)); // todo: expand when the "no DB present" code is known } else if (dbx is System.Data.Common.DbException) // anything else { DBMain.AltLog(LogLevels.Warning, 70139, DBExceptionString(dbx, sql)); // todo: expand when the "no DB present" code is known } else { Console.WriteLine(DBExceptionString(dbx, sql)); } return(neednew); }
public long DeleteAll(string DetectorName) { Detectors dets = new Detectors(db); long l = dets.PrimaryKey(DetectorName); if (l == -1) { DBMain.AltLog(LogLevels.Warning, 70137, "Missing Det key ({0}) selecting CountingParams", l); return(-1); } string table1 = "CountingParams"; string table2 = "LMMultiplicity"; ArrayList sqlList = new ArrayList(); sqlList.Add("DELETE FROM " + table1 + " where detector_id=" + l.ToString()); sqlList.Add("DELETE FROM " + table2 + " where detector_id=" + l.ToString()); return(db.Execute(sqlList)); }
// fix this, need a blanket clear public bool DeleteAll(string DetectorName, string CounterType, ElementList sParams) { DataRow dr = null; string table = "CountingParams"; if (CounterType.Equals("Multiplicity") || CounterType.Equals("Coincidence")) { table = "LMMultiplicity"; } Detectors dets = new Detectors(db); long l = dets.PrimaryKey(DetectorName); if (l == -1) { DBMain.AltLog(LogLevels.Warning, 70137, "Missing Det key ({0}) selecting CountingParams", l); return(false); } if (table.Equals("LMMultiplicity")) { dr = HasRow(DetectorName, CounterType, table, sParams[faidx].Value); // the FA parameter } else { dr = HasRow(DetectorName, CounterType, table); } if (dr != null) { //NEXT: not tested(?) string sSQL = "DELETE FROM " + table + " where counter_type=" + SQLSpecific.QVal(CounterType) + " AND detector_id=" + l.ToString(); if (table.Equals("LMMultiplicity")) { sSQL += " AND " + sParams[faidx].Name + "=" + sParams[faidx].Value; } return(db.Execute(sSQL)); } else { return(true); } }
public void SetConnection() { if (sql_con == null) { try { if (DBMain.ProviderInvariantName.Equals("")) { return; } sql_con = DBMain.CreateConnection(useConnStr: true); sql_da = DBMain.CreateDataAdapter(); } catch (Exception caught) { DBMain.AltLog(LogLevels.Error, 70100, "Unable to connect with database " + caught.Message); } } }
public bool Insert(string DetectorName, string CounterType, ElementList sParams) { DataRow dr = null; string table = "CountingParams"; if (CounterType.Equals("Multiplicity") || CounterType.Equals("Coincidence")) { table = "LMMultiplicity"; } Detectors dets = new Detectors(db); long l = dets.PrimaryKey(DetectorName); if (l == -1) { DBMain.AltLog(LogLevels.Warning, 70137, "Missing Det key ({0}) selecting CountingParams", l); return(false); } if (table.Equals("LMMultiplicity")) { dr = HasRow(l, CounterType, table, sParams, sParams[faidx].Value); // the FA parameter } else { dr = HasRow(l, CounterType, table, sParams); } if (dr == null) { sParams.Add(new Element("detector_id", l)); string sSQL = "Insert into " + table; sSQL += sParams.ColumnsValues; return(db.Execute(sSQL)); } else { // identical row found, skip it return(false); } }
// assumes DB is there, but might need to build it before we get here public bool Execute(string sSQL) { bool needDb = false; try { sql_con.Open(); sql_cmd = sql_con.CreateCommand(); sql_cmd.CommandText = sSQL; try { int i = sql_cmd.ExecuteNonQuery(); } catch (System.Data.Common.DbException dbx) { needDb = DBMain.DBExceptionHandler(dbx, sSQL); } } catch (Exception caught) { try { DBMain.AltLog(LogLevels.Warning, 70101, "Execute '" + caught.Message + "' " + sSQL); sql_con.Close(); return(false); } catch { } } if (sql_con != null) { sql_con.Close(); } if (needDb) { DBMain.Creation(sql_cmd); // create an new empty DB, pass the failed query string, retry it once after initial DB creation } return(true); }
public DataTable GetAUniqueThang(Pieces p, String did = null) { DataTable dt = new DataTable(); try { switch (p) { default: break; case Pieces.AppContext: AppContext app = new AppContext(); dt = app.GetAll(); break; } } catch (Exception caught) { DBMain.AltLog(LogLevels.Warning, 70192, "Get Unique '" + caught.Message + "' "); } return(dt); }
public bool Update(string DetectorName, string ItemType, ElementList sParams) { bool res = false; db.SetConnection(); //NEXT: this duo-lookup part takes too long, so get the values once in a wrapper call, then cache them, then reuse them DataRow dr = HasRow(DetectorName, ItemType); // sets the connection Detectors dets = new Detectors(db); long l = dets.PrimaryKey(DetectorName); Descriptors mats = new Descriptors("material_types", db); long m = mats.PrimaryKey(ItemType); if (l == -1 || m == -1) { DBMain.AltLog(LogLevels.Warning, 70130, "Missing Det/Mat keys ({0},{1}) selecting AnalysisMethods", l, m); return(false); } if (dr == null) // a new entry! { string sSQL = "insert into analysis_method_rec "; sParams.Add(new Element("item_type_id", m)); sParams.Add(new Element("analysis_method_detector_id", l)); sSQL = sSQL + sParams.ColumnsValues; res = db.Execute(sSQL); } else { string wh = " where item_type_id= " + m.ToString() + " AND analysis_method_detector_id=" + l.ToString(); string sSQL1 = "UPDATE analysis_method_rec SET "; string sSQL = sSQL1 + sParams.ColumnEqValueList + wh; res = db.Execute(sSQL); } return(res); }
public DataRow Get(string DetectorName, string ItemType, string calib_table) { long l, m; GetKeys(DetectorName, ItemType, out l, out m); DataRow dr = HasRow(l, m); // sets the connection if (l == -1 || m == -1) { DBMain.AltLog(LogLevels.Warning, 70137, "Missing Det/Mat keys ({0},{1}) selecting method calibration params", l, m); return(null); } string wh = " where item_type_id= " + m.ToString() + " AND detector_id=" + l.ToString(); string sql = "select * from " + calib_table + wh; DataTable dt = db.DT(sql); if (dt != null && dt.Rows.Count > 0) { return(dt.Rows[0]); } else { return(null); } }
public int Execute(ArrayList sqlList) { //Execute Sequence of Sql Statements //Check Sql Type to determine if we have return value to replace in next statement string sRtn = ""; Int32 result = -1; // what to return here? try { if (sql_cmd == null) { sql_cmd = sql_con.CreateCommand(); } bool needDb = false; for (int i = 0; i < sqlList.Count; i++) { if (!sqlList[i].ToString().Equals("")) { sql_cmd.CommandText = sqlList[i].ToString(); try { if (sqlList[i].ToString().ToUpper().StartsWith("SELECT")) { //Expect back a string sRtn = sql_cmd.ExecuteScalar().ToString(); if (sRtn.Equals("")) { return(-1); } } else { if (sql_cmd.CommandText.Contains("<Rtn>")) { //substitute in sRtn Value sql_cmd.CommandText = sql_cmd.CommandText.Replace("<Rtn>", sRtn); } //Expect back # rows modified if (sql_cmd.ExecuteNonQuery() < 0) { return(-1); } } } catch (System.Data.Common.DbException dbx) { needDb = DBMain.DBExceptionHandler(dbx, sql_cmd.CommandText); } } } Int32.TryParse(sRtn, out result); return(result); } catch (Exception caught) { if (sql_cmd != null) { DBMain.AltLog(LogLevels.Warning, 70107, "Execute list '" + caught.Message + "' " + sql_cmd); } return(-1); } }
public long ExecuteTransactionID(ArrayList sqlList) { //Execute Sequence of Sql Statements //Check Sql Type to determine if we have return value to replace in next statement DbTransaction Trans = null; string sRtn = ""; Int32 result = -1; // what to return here? try { sql_con.Open(); Trans = sql_con.BeginTransaction(); sql_cmd = sql_con.CreateCommand(); sql_cmd.Transaction = Trans; bool needDb = false; bool scalar = false; for (int i = 0; i < sqlList.Count; i++) { if (!sqlList[i].ToString().Equals("")) { sql_cmd.CommandText = sqlList[i].ToString(); //DBMain.AltLog(LogLevels.Info, 70115, "sql => " + sql_cmd.CommandText); try { if (sqlList[i].ToString().ToUpper().StartsWith("SELECT")) { //Expect back a string scalar = true; sRtn = sql_cmd.ExecuteScalar().ToString(); if (sRtn.Equals("")) { Trans.Rollback(); sql_con.Close(); return(-1); } } else { scalar = false; if (sql_cmd.CommandText.Contains("<Rtn>")) { //substitute in sRtn Value sql_cmd.CommandText = sql_cmd.CommandText.Replace("<Rtn>", sRtn); } //Expect back # rows modified if (sql_cmd.ExecuteNonQuery() < 0) { Trans.Rollback(); sql_con.Close(); return(-1); } } } catch (System.Data.Common.DbException dbx) { Trans.Rollback(); needDb = DBMain.DBExceptionHandler(dbx, sql_cmd.CommandText); sql_con.Close(); return(-1); } if (needDb) { DBMain.Creation(sql_cmd, scalar); // create a new empty DB, pass the failed query string, retry it once after initial DB creation } } } Trans.Commit(); sql_con.Close(); Int32.TryParse(sRtn, out result); return(result); } catch (Exception caught) { if (sql_cmd != null) { DBMain.AltLog(LogLevels.Warning, 70107, "ExecuteTransactionID '" + caught.Message + "' " + sql_cmd); } if (Trans != null) { Trans.Rollback(); } if (sql_con != null) { sql_con.Close(); } return(-1); } }
//private const ushort creationTriesMax = 5; //private static bool onetimeretry = true; //private static ulong creationTries = 0; //private static object arbitrary = new object(); //private static ManualResetEventSlim mres = new ManualResetEventSlim(true); /// <summary> /// Create a new empty database (SQLite3 only for now). Attempt to create five times before giving up. /// </summary> /// <param name="sqlretry">The failed query string , retry it once here after initial DB creation</param> public static void Creation(DbCommand sqlretry, bool scalar = false) { DBMain.AltLog(LogLevels.Warning, 70120, "New DB attempt placeholder, likely called incorrectly"); return; /// JFL Oct. 28, 2013. The following code was meant to auto-create a database if one was not found, but I am abandoning this idea for now. //mres.Wait(10000); //lock (arbitrary) //{ // mres.Reset(); // creationTries++; // if (creationTries > creationTriesMax) // return; // if (DBMain.ProviderInvariantName.Equals("")) return; // // try to populate an empty database here // DBMain.AltLog(LogLevels.Warning, 70119, "Creating new DB via " + ConnStr); // Assembly exa = System.Reflection.Assembly.GetExecutingAssembly(); // ResourceManager rm = new ResourceManager("LMDB.Schema", exa); // DbTransaction Trans = null; // DbConnection sql_con = CreateConnection(); // sql_con.ConnectionString = ConnStr; // try // { // string f2 = rm.GetString("DBCreationScript"); // what if it isnt there? // sql_con.Open(); // Trans = sql_con.BeginTransaction(); // DbCommand sql_cmd = sql_con.CreateCommand(); // sql_cmd.CommandText = f2; // if (sql_cmd.ExecuteNonQuery() < 0) // { // Trans.Rollback(); // sql_con.Close(); // } // else // { // Trans.Commit(); // creationTries = creationTriesMax + 1; // sql_con.Close(); // DBMain.AltLog(LogLevels.Warning, 70120, "New DB constructed"); // if (onetimeretry) // { // DBMain.AltLog(LogLevels.Warning, 70121, "Retrying " + sqlretry.CommandText); // onetimeretry = false; // if (scalar) // sqlretry.ExecuteScalar(); // else // sqlretry.ExecuteNonQuery(); // } // } // } // catch (Exception caught) // { // DBMain.AltLog(LogLevels.Warning, 70108, LMLoggers.LognLM.FlattenChars("Creation '" + caught.Message + "' ")); // if (Trans != null) Trans.Rollback(); // sql_con.Close(); // } //} }
public bool SwitchDB(string dbFile) { return(DBMain.SwitchDB(dbFile)); }
public bool ExecuteTransaction(ArrayList sqlList) { //Execute Sequence of Sql Statements //Check Sql Type to determine if we have return value to replace in next statement DbTransaction Trans = null; string sRtn = ""; try { Trans = sql_con.BeginTransaction(); if (sql_cmd == null) { sql_cmd = sql_con.CreateCommand(); } sql_cmd.Transaction = Trans; bool needDb = false; for (int i = 0; i < sqlList.Count; i++) { sql_cmd.CommandText = sqlList[i].ToString(); try { if (sqlList[i].ToString().ToUpper().StartsWith("SELECT")) { //Expect back a string sRtn = sql_cmd.ExecuteScalar().ToString(); if (sRtn.Equals("")) { Trans.Rollback(); return(false); } } else { if (sql_cmd.CommandText.Contains("<Rtn>")) { //substitute in sRtn Value sql_cmd.CommandText = sql_cmd.CommandText.Replace("<Rtn>", sRtn); } //Expect back # rows modified if (sql_cmd.ExecuteNonQuery() < 0) { Trans.Rollback(); return(false); } } } catch (System.Data.Common.DbException dbx) { needDb = DBMain.DBExceptionHandler(dbx, sql_cmd.CommandText); } } Trans.Commit(); return(true); } catch (Exception caught) { if (sql_cmd != null) { DBMain.AltLog(LogLevels.Warning, 70107, "ExecuteTransaction '" + caught.Message + "' " + sql_cmd); } if (Trans != null) { Trans.Rollback(); } return(false); } }
// can use IList interface on this public DataTable GetACollection(Pieces p, String did = null) { DataTable dt = new DataTable(); try { switch (p) { default: break; case Pieces.HVParams: HVParams hv = new HVParams(); dt = hv.Get(did); break; case Pieces.HVResults: HVPlateauResults hvr = new HVPlateauResults(); dt = hvr.AllHVPlateauResults(did); break; case Pieces.Measurements: Measurements ms = new Measurements(); dt = ms.AllMeasurements(did); break; case Pieces.CountingAnalyzers: CountingAnalysisParameters cap = new CountingAnalysisParameters(); dt = cap.AnalyzerParamsForDetector(did); break; case Pieces.AnalysisMethodSpecifiers: using (AnalysisMethodSpecifiers am = new AnalysisMethodSpecifiers()) { dt = am.MethodsForDetector(did); } break; case Pieces.Detectors: Detectors clsD = new Detectors(); dt = clsD.getDetectors(true); break; case Pieces.LMParams: LMNetCommParams blue = new LMNetCommParams(); dt = blue.Get(did); break; case Pieces.LMMultParams: LMMultiplicityParams purple = new LMMultiplicityParams(); dt = purple.Get(did); break; case Pieces.DetectorTypes: Descriptors clsDT = new Descriptors("detector_types"); dt = clsDT.getDescs(); break; case Pieces.Materials: Descriptors clsMtl = new Descriptors("material_types"); dt = clsMtl.getDescs(); break; case Pieces.TestParams: TestParams tp = new TestParams(); dt = tp.Get(); break; case Pieces.NormParams: NormParams np = new NormParams(); dt = np.Get(did); break; case Pieces.AASSetupParams: AASSetupParams aass = new AASSetupParams(); dt = aass.Get(did); break; case Pieces.BackgroundParams: BackgroundParams clsB = new BackgroundParams(); TruncatedBackgroundParams clsTB = new TruncatedBackgroundParams(); dt = clsB.Get(did); DataTable dt2 = clsTB.Get(did); dt.Merge(dt2); break; // next: caution, should use select/join case Pieces.Facilities: Descriptors clsF = new Descriptors("facility_names"); dt = clsF.getDescs(); break; case Pieces.MBAs: Descriptors MBA = new Descriptors(p.ToString()); dt = MBA.getDescs(); break; case Pieces.Items: Items clsI = new Items(); dt = clsI.getItems(); break; case Pieces.CollarItems: CollarItems clsCI = new CollarItems(); dt = clsCI.getItems(); break; case Pieces.Isotopics: Isotopics clsIs = new Isotopics(); dt = clsIs.getIsotopics(); break; case Pieces.Strata: Strata s = new Strata(); dt = s.Get(); break; case Pieces.StrataWithAssoc: Strata ss = new Strata(); dt = ss.GetAssociations(did); break; case Pieces.AcquireParams: AcquireParams aq = new AcquireParams(); dt = aq.Get(did); break; case Pieces.IOCodes: Descriptors ioc = new Descriptors("io_code"); dt = ioc.getDescs(); break; case Pieces.InvChangeCodes: Descriptors icc = new Descriptors("inventory_change_code"); dt = icc.getDescs(); break; case Pieces.UnattendedParams: UnattendParams u = new UnattendParams(); dt = u.Get(did); break; case Pieces.CmPuRatioParams: cm_pu_ratio_rec cpu = new cm_pu_ratio_rec(); dt = cpu.Get(); break; case Pieces.Results: Results rr = new Results(); dt = rr.AllResults(did); break; } } catch (Exception caught) { DBMain.AltLog(LogLevels.Warning, 70191, "Get Collection '" + caught.Message + "' "); } return(dt); }