private string GetConnectionString(string odsConnectionStringTemplate, string odsInstanceName, ApiMode apiMode) { var mockConnectionStringBuilderAdapterFactory = new Mock <IConnectionStringBuilderAdapterFactory>(); mockConnectionStringBuilderAdapterFactory.Setup(x => x.Get()).Returns(new SqlConnectionStringBuilderAdapter()); var service = new ConnectionStringService(GetConnectionStringsAccessor(odsConnectionStringTemplate), mockConnectionStringBuilderAdapterFactory.Object); return(service.GetConnectionString(odsInstanceName, apiMode)); }
private bool ProbeSpectrumDatabase() { string spectrumDatabaseString = ConnectionStringService.GetConnectionString("Spectrum"); SQLControl sql = new SQLControl(spectrumDatabaseString); //sql.AddParam("@jobNumber", _jobNumber); //sql.AddParam("@costType", "L"); sql.ExecQuery("SELECT * FROM JC_TRANSACTION_HISTORY_MC WHERE Job_Number = ' 2190302'"); if (sql.HasException()) { return(false); } else { return(true); } }
/// <summary> /// Returns true if the job number is found in the estimating database. Only one estimate record is allowed per job number. /// </summary> /// <param name="jobNumber"></param> /// <returns></returns> public bool IsDuplicateJobNumber(string jobNumber) { using (SQLControl sql = new SQLControl(ConnectionStringService.GetConnectionString("Estimate"))) { sql.AddParam("@jobNumber", jobNumber); sql.ExecQuery("SELECT * FROM EstimateHeader WHERE JobNumber = @jobNumber"); if (sql.HasException()) { throw new Exception("Error in SQLControl class while attempting to detect duplicate job numbers."); } if (sql.DBDT.Rows.Count == 0) { return(false); } else { return(true); } }; }