/// <summary> /// This method fires when the GROUP dropdown changes. /// If the index is greater than zero, the specified Group will be looked up /// and its values will be used to populate the text fields on the form. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ddlGroup_SelectedIndexChanged(object sender, System.EventArgs e) { if(ddlGroup.SelectedIndex == 0) // prepare for a new record { ClearFormFields(); SetReadOnly(false); } else //retrieve an existing record { LssCredentialSet cr = new LssCredentialSet(); cr = credentialSets[ddlGroup.SelectedIndex-1]; txtGroupName.Text = cr.groupName; txtServiceBrokerID.Text = cr.serviceBrokerGuid; txtServiceBrokerName.Text = cr.serviceBrokerName; ddlUSS.ClearSelection(); ddlUSS.Items.FindByValue(cr.ussGuid).Selected=true; // Make the serverice broker id field ReadOnly SetReadOnly(true); } }
/// <summary> /// Returns an array of the immutable Credential objects that correspond to the supplied credentialSet IDs. /// </summary> /// <param name="credentialSetIDs"></param> /// <returns></returns>An array of immutable objects describing the specified Credential Set information; if the nth credentialSetID does not correspond to a valid experiment scheduling property, the nth entry in the return array will be null. public static LssCredentialSet[] GetCredentialSets(int[] credentialSetIDs) { List<LssCredentialSet> credentialSets = new List<LssCredentialSet>(); // create sql connection DbConnection connection = FactoryDB.GetConnection(); // create sql command // command executes the "RetrieveCredentialSetByID" stored procedure DbCommand cmd = FactoryDB.CreateCommand("CredentialSet_RetrieveByID", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(FactoryDB.CreateParameter(cmd,"@credentialSetID", null, DbType.Int32)); //execute the command try { connection.Open(); for(int i=0;i<credentialSetIDs.Length;i++) { // populate the parameters cmd.Parameters["@credentialSetID"].Value = credentialSetIDs[i]; DbDataReader dataReader = null; dataReader=cmd.ExecuteReader(); while(dataReader.Read()) { LssCredentialSet credentialSet = new LssCredentialSet(); credentialSet.credentialSetId=credentialSetIDs[i]; if(dataReader[0] != System.DBNull.Value ) credentialSet.serviceBrokerGuid=dataReader.GetString(0); if(dataReader[1] != System.DBNull.Value ) credentialSet.serviceBrokerName=dataReader.GetString(1); if(dataReader[2] != System.DBNull.Value ) credentialSet.groupName=dataReader.GetString(2); if(dataReader[3] != System.DBNull.Value ) credentialSet.ussGuid=dataReader.GetString(3); credentialSets.Add(credentialSet); } dataReader.Close(); } } catch (Exception ex) { throw new Exception("Exception thrown in get credentialSets",ex); } finally { connection.Close(); } return credentialSets.ToArray(); }
/// <summary> /// Returns an array of the immutable Credential objects that correspond to the supplied credentialSet IDs. /// </summary> /// <param name="credentialSetIDs"></param> /// <returns></returns>An array of immutable objects describing the specified Credential Set information; if the nth credentialSetID does not correspond to a valid experiment scheduling property, the nth entry in the return array will be null. public LssCredentialSet[] GetCredentialSetsByLS(string lsGuid) { List<LssCredentialSet> credentialSets = new List<LssCredentialSet>(); // create sql connection DbConnection connection = FactoryDB.GetConnection(); // create sql command // command executes the "RetrieveCredentialSetByLS" stored procedure DbCommand cmd = FactoryDB.CreateCommand("CredentialSets_RetrieveByLS", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(FactoryDB.CreateParameter("@lsGuid", lsGuid, DbType.String,50)); //execute the command try { connection.Open(); // populate the parameters DbDataReader dataReader = null; dataReader=cmd.ExecuteReader(); while(dataReader.Read()) { LssCredentialSet credentialSet = new LssCredentialSet(); credentialSet.credentialSetId = dataReader.GetInt32(0); if(dataReader[1] != System.DBNull.Value ) credentialSet.serviceBrokerGuid=dataReader.GetString(1); if(dataReader[2] != System.DBNull.Value ) credentialSet.serviceBrokerName=dataReader.GetString(2); if(dataReader[3] != System.DBNull.Value ) credentialSet.groupName=dataReader.GetString(3); credentialSets.Add(credentialSet); } dataReader.Close(); } catch (Exception ex) { throw new Exception("Exception thrown in get credentialSets",ex); } finally { connection.Close(); } return credentialSets.ToArray(); }