//-------------------------------------------------------------------------------------------------// public int Add(ExperimentInfo experimentInfo) { const string methodName = "Add"; Logfile.WriteCalled(logLevel, STR_ClassName, methodName); Int32 experimentId = -1; try { /* * Prepare the stored procedure call */ SqlCommand sqlCommand = new SqlCommand(STRSQLCMD_Add, this.sqlConnection); sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.Parameters.Add(new SqlParameter(SqlParam(STRCOL_LabServerGuid), experimentInfo.LabServerGuid)); /* * Execute the stored procedure */ this.sqlConnection.Open(); Object obj = sqlCommand.ExecuteScalar(); if (obj != null) { experimentId = (Int32)obj; } } catch (Exception ex) { Logfile.WriteError(ex.Message); throw ex; } finally { this.sqlConnection.Close(); } Logfile.WriteCompleted(logLevel, STR_ClassName, methodName, String.Format(STRLOG_ExperimentId_arg, experimentId)); return experimentId; }
public ClientSubmissionReport Submit(string labServerID, string experimentSpecification, int priorityHint, bool emailNotification) { const String methodName = "Submit"; Logfile.WriteCalled(logLevel, STR_ClassName, methodName); ClientSubmissionReport clientSubmissionReport = null; try { this.Authenticate(sbHeader); /* * Add the LabServer Id mapping to the database and get the experiment Id */ ExperimentInfo experimentInfo = new ExperimentInfo(labServerID); int experimentId = experimentsDB.Add(experimentInfo); /* * Pass to LabServer for processing */ LabServerAPI labServerAPI = this.GetLabServerAPI(labServerID); SubmissionReport submissionReport = labServerAPI.Submit(experimentId, experimentSpecification, STR_UserGroup, priorityHint); /* * Convert to return type */ clientSubmissionReport = new ClientSubmissionReport(); clientSubmissionReport.ExperimentId = submissionReport.ExperimentId; clientSubmissionReport.MinTimeToLive = submissionReport.MinTimeToLive; clientSubmissionReport.ValidationReport = submissionReport.ValidationReport; clientSubmissionReport.WaitEstimate = submissionReport.WaitEstimate; } catch (ProtocolException ex) { throw new SoapException(ex.Message, SoapException.ClientFaultCode); } catch (Exception ex) { Logfile.WriteError(ex.Message); } Logfile.WriteCompleted(logLevel, STR_ClassName, methodName); return clientSubmissionReport; }
//-------------------------------------------------------------------------------------------------// private ArrayList RetrieveBy(String columnName, int intval, String strval) { const string methodName = "RetrieveBy"; Logfile.WriteCalled(logLevel, STR_ClassName, methodName); ArrayList arrayList = new ArrayList(); try { /* * Prepare the stored procedure call */ SqlCommand sqlCommand = new SqlCommand(STRSQLCMD_RetrieveBy, this.sqlConnection); sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.Parameters.Add(new SqlParameter(SqlParam(STRPRM_ColumnName), columnName)); sqlCommand.Parameters.Add(new SqlParameter(SqlParam(STRPRM_IntValue), intval)); sqlCommand.Parameters.Add(new SqlParameter(SqlParam(STRPRM_StrValue), strval)); /* * Execute the stored procedure */ this.sqlConnection.Open(); SqlDataReader sqlDataReader = sqlCommand.ExecuteReader(); while (sqlDataReader.Read() == true) { Object obj = null; ExperimentInfo experimentInfo = new ExperimentInfo(); if ((obj = sqlDataReader[STRCOL_ExperimentId]) != System.DBNull.Value) experimentInfo.ExperimentId = (int)obj; if ((obj = sqlDataReader[STRCOL_LabServerGuid]) != System.DBNull.Value) experimentInfo.LabServerGuid = (String)obj; /* * Add ExperimentInfo to the list */ arrayList.Add(experimentInfo); } sqlDataReader.Close(); } catch (Exception ex) { Logfile.WriteError(ex.Message); throw ex; } finally { this.sqlConnection.Close(); } Logfile.WriteCompleted(logLevel, STR_ClassName, methodName, String.Format(STRLOG_Count_arg, arrayList.Count)); return (arrayList.Count > 0) ? arrayList : null; }