/// <summary> /// Retrieves the current Experiment summary form the ServiceBroker's database. /// </summary> /// <param name="experimentID"></param> /// <returns></returns> public static ExperimentSummary SelectExperimentSummary(long experimentID) { //select ei.coupon_ID, u.user_Name, g.group_Name, c.Lab_Client_Name,status, essGuid, // scheduledStart,duration, creationTime, closeTime, annotation DbConnection myConnection = FactoryDB.GetConnection(); DbCommand myCommand = FactoryDB.CreateCommand("RetrieveExperimentSummary", myConnection); myCommand.CommandType = CommandType.StoredProcedure; myCommand.Parameters.Add(FactoryDB.CreateParameter(myCommand, "@experimentID", experimentID, DbType.Int64)); ExperimentSummary exp = null; try { myConnection.Open(); DbDataReader myReader = myCommand.ExecuteReader(); while (myReader.Read()) { exp = new ExperimentSummary(); exp.experimentId = experimentID; exp.userName = myReader.GetString(0); exp.groupName = myReader.GetString(1); exp.labServerGuid = myReader.GetString(2); exp.labServerName = myReader.GetString(3); exp.clientName = myReader.GetString(4); exp.clientVersion = myReader.GetString(5); exp.status = myReader.GetInt32(6); if (!myReader.IsDBNull(7)) exp.essGuid = myReader.GetString(7); else exp.essGuid = null; if (!myReader.IsDBNull(8)) exp.scheduledStart = DateUtil.SpecifyUTC(myReader.GetDateTime(8)); if (!myReader.IsDBNull(9)) exp.duration = myReader.GetInt64(9); if (!myReader.IsDBNull(10)) exp.creationTime = DateUtil.SpecifyUTC(myReader.GetDateTime(10)); if (!myReader.IsDBNull(11)) exp.closeTime = DateUtil.SpecifyUTC(myReader.GetDateTime(11)); if (!myReader.IsDBNull(12)) exp.annotation = myReader.GetString(12); if (!myReader.IsDBNull(13)) exp.recordCount = myReader.GetInt32(13); } myReader.Close(); } catch (Exception ex) { throw; } finally { myConnection.Close(); } return exp; }
void listSummaries(ExperimentSummary[] summaries) { lbxSelectExperiment.Items.Clear(); foreach (ExperimentSummary exp in summaries) { StringBuilder buf = new StringBuilder(); buf.Append(exp.experimentId.ToString("0000") + " "); buf.Append(DateUtil.ToUserTime(exp.creationTime, culture, userTZ) + " "); if (exp.closeTime != null) { buf.Append(DateUtil.ToUserTime(exp.closeTime, culture, userTZ) + " "); } else { buf.Append("Experiment Not Closed "); } // User if (false) { if (exp.userName != null) { buf.Append(exp.userName + " "); } } // Group if (exp.groupName != null) { buf.Append(exp.groupName + " "); } buf.Append(exp.clientName + " "); // Status buf.Append(exp.status.ToString("000") + " "); //Annotation if (exp.annotation != null) { buf.Append(exp.annotation); } System.Web.UI.WebControls.ListItem item = new System.Web.UI.WebControls.ListItem(buf.ToString(), exp.experimentId.ToString()); lbxSelectExperiment.Items.Add(item); } }
public static ExperimentSummary[] SelectExperimentSummaries(long[] experimentIDs) { //select u.user_Name,g.group_Name,pa.Agent_Guid,pa.Agent_Name, //c.Lab_Client_Name,c.version, status, ess_ID, scheduledStart, duration, creationTime, closeTime, annotation, record_count //from Experiments ei,ProcessAgent pa, Groups g, Lab_Clients c, Users u ExperimentSummary[] exp = new ExperimentSummary[experimentIDs.Length]; DbConnection myConnection = FactoryDB.GetConnection(); DbCommand myCommand = FactoryDB.CreateCommand("RetrieveExperimentSummary", myConnection); myCommand.CommandType = CommandType.StoredProcedure; myCommand.Parameters.Add(FactoryDB.CreateParameter(myCommand,"@experimentID", null,DbType.Int64)); try { myConnection.Open(); for (int i = 0; i < experimentIDs.Length; i++) { myCommand.Parameters["@experimentID"].Value = experimentIDs[i]; // get experimentInfo from table Experiments // select u.user_Name,g.group_Name,pa.Agent_Guid,pa.Agent_Name, // c.Lab_Client_Name,c.version, status, ess_ID, scheduledStart, duration, // creationTime, closeTime, annotation, record_count // from Experiments ei,ProcessAgent pa, Groups g, Lab_Clients c, Users u DbDataReader myReader = myCommand.ExecuteReader(); while (myReader.Read()) { exp[i] = new ExperimentSummary(); exp[i].experimentId = experimentIDs[i]; exp[i].userName = myReader.GetString(0); exp[i].groupName = myReader.GetString(1); exp[i].labServerGuid = myReader.GetString(2); exp[i].labServerName = myReader.GetString(3); exp[i].clientName = myReader.GetString(4); exp[i].clientVersion = myReader.GetString(5); exp[i].status = myReader.GetInt32(6); if (!myReader.IsDBNull(7)) exp[i].essGuid = myReader.GetString(7); else exp[i].essGuid = null; if (!myReader.IsDBNull(8)) exp[i].scheduledStart = DateUtil.SpecifyUTC(myReader.GetDateTime(8)); if (!myReader.IsDBNull(9)) exp[i].duration = myReader.GetInt64(9); if (!myReader.IsDBNull(10)) exp[i].creationTime = DateUtil.SpecifyUTC(myReader.GetDateTime(10)); if (!myReader.IsDBNull(11)) exp[i].closeTime = DateUtil.SpecifyUTC(myReader.GetDateTime(11)); if (!myReader.IsDBNull(12)) exp[i].annotation = myReader.GetString(12); if (!myReader.IsDBNull(13)) exp[i].recordCount = myReader.GetInt32(13); } myReader.Close(); } } catch (Exception ex) { throw; } finally { myConnection.Close(); } return exp; }
void displayExperimentSummary(ExperimentSummary expInfo) { txtExperimentID.Text = expInfo.experimentId.ToString(); txtUsername.Text = expInfo.userName; txtGroupName.Text = expInfo.groupName; txtLabServerName.Text = expInfo.labServerName; txtClientName.Text = expInfo.clientName; txtStatus.Text = StorageStatus.GetStatusString(expInfo.status); txtSubmissionTime.Text = DateUtil.ToUserTime(expInfo.creationTime, culture, userTZ); if ((expInfo.closeTime != null) && (expInfo.closeTime != DateTime.MinValue)) { txtCompletionTime.Text = DateUtil.ToUserTime(expInfo.closeTime, culture, userTZ); } else { txtCompletionTime.Text = "Experiment Not Closed!"; } txtRecordCount.Text = expInfo.recordCount.ToString(" 0"); txtAnnotation.Text = expInfo.annotation; trSaveAnnotation.Visible = true; //trDeleteExperiment.Visible = true; trShowExperiment.Visible = (expInfo.recordCount > 0); }