}//public static void RSSFeed ///<summary>RSSFeed Courtesy http://msdn.microsoft.com/asp.net/using/understanding/XML/default.aspx?pull=/library/en-us/dnaspp/html/aspnet-createrssw-aspnet.asp Microsoft: Creating an Online RSS News Aggregator with ASP.NET with Scott Mitchell</summary> public static void RSSFeed ( ref String databaseConnectionString, ref String exceptionMessage, ref IDataReader iDataReader, ref String SQLSelect, ref int topNumberOfRows ) { StringBuilder sb = null; sb = new StringBuilder(); sb.AppendFormat( SQLSelect, topNumberOfRows ); UtilityDatabase.DatabaseQuery ( databaseConnectionString, ref exceptionMessage, ref iDataReader, sb.ToString(), CommandType.Text ); }//public static void RSSFeed()
/// <summary>ButtonAdd_Click().</summary> public void ButtonAdd_Click ( Object sender, EventArgs e ) { int dataRowCount = -1; String exceptionMessage = null; try { UtilityDatabase.DataSetRowAdd ( ref DataSetDataGrid, ref exceptionMessage, ref dataRowCount ); } catch ( Exception exception ) { exceptionMessage = exception.Message; } if ( exceptionMessage == null ) { DataSourceBind(); //DataGridURI.EditItemIndex = dataRowCount; SetFocus( DataGridURI ); } else { Feedback = exceptionMessage; } }//public void ButtonAdd_Click()
///<summary>The entry point for the application.</summary> ///<param name="argv">Command-line arguments.</param> public static void Main ( string[] argv ) { string databaseConnectionString = DatabaseConnectionString; string exceptionMessage = null; UtilityXml.XmlDocumentNodeInnerText ( FilenameConfigurationXml, ref exceptionMessage, XPathDatabaseConnectionString, ref databaseConnectionString ); UtilityDatabase.DatabaseMaintenance ( DatabaseConnectionString, ref exceptionMessage, FilenameConfigurationXml, XPathTheseAreTheFirstFruitsDatabase, XPathTheseAreTheFirstFruitsTable, XPathSQLTable, new string[] { XPathPatternFilename, PatternFilename }, XPathImportPatternFilename ); }//public static void Main
}//public void DatabaseSelect() /// <summary>DatabaseUpdate</summary> public static void DatabaseUpdate ( ref String databaseConnectionString, ref String exceptionMessage, ref Contact contact ) { StringBuilder sb = null; sb = new StringBuilder(); sb.AppendFormat ( SQLUpdateContactArgument, contact.ContactID, contact.FirstName, contact.LastName, contact.OtherName, contact.Prefix, contact.Suffix, contact.Company, contact.Commentary, contact.ScriptureReference ); UtilityDatabase.DatabaseQuery ( databaseConnectionString, ref exceptionMessage, sb.ToString() ); UtilityDebug.Write(String.Format("SQL Contact: {0}", sb.ToString())); }//public void DatabaseUpdate()
/// <summary>Page Load.</summary> public void Page_Load ( object sender, EventArgs e ) { String exceptionMessage = null; DataSet dataSet = null; Hashtable userLogin = null; UtilityUser.UserLogin ( ref userLogin, ref exceptionMessage ); if ( exceptionMessage != null ) { Response.Write( "Exception: " + exceptionMessage ); return; } UtilityDatabase.DataSetFill ( ref userLogin, ref dataSet ); GridViewUser.DataSource = dataSet; GridViewUser.DataBind(); }//Page_Load
}//ButtonQuery_Click /// <summary>ButtonDatabaseQueryChapterMaximum_Click</summary> public void ButtonDatabaseQueryChapterMaximum_Click ( Object sender, EventArgs e ) { int chapterMaximum = -1; object databaseReturnValue = null; string word = TextBoxWord.Text.Trim(); databaseReturnValue = UtilityDatabase.DatabaseQuery ( databaseConnectionString, ref exceptionMessage, "uspChapterMaximum", CommandType.StoredProcedure ); if ( exceptionMessage != null ) { LabelExceptionMessage.Text = exceptionMessage; return; }//if ( exceptionMessage != null ) chapterMaximum = (Int32) databaseReturnValue; TextBoxAlphabetSequence.Text = System.Convert.ToString( chapterMaximum ); }//ButtonDatabaseQueryChapterMaximum_Click
}//public void ButtonAdd_Click() /// <summary>ButtonNew_Click().</summary> public void ButtonNew_Click ( Object sender, EventArgs e ) { string tableName = null; string exceptionMessage = null; ArrayList columnName = null; try { UtilityDatabase.DataSetTableColumn ( ref DatabaseSQLSelect, ref DataSetDataGrid, ref exceptionMessage, ref tableName, ref columnName ); DataSourceBind(); } catch ( Exception exception ) { exceptionMessage = exception.Message; } }//public void ButtonNew_Click()
}//public static void ContactDetail() /// <summary>ContactDetailSave</summary> public static void ContactDetailSave ( String databaseConnectionString, ref String exceptionMessage, ref Contact contact ) { StringBuilder sb = new StringBuilder(); sb.AppendFormat ( SQLUpdateContactDetail, contact.SequenceOrderId, contact.FirstName, contact.LastName, contact.OtherName, contact.Company, contact.Prefix, contact.Suffix, contact.Commentary, contact.ScriptureReference ); UtilityDatabase.DatabaseQuery ( databaseConnectionString, ref exceptionMessage, sb.ToString(), CommandType.Text ); }//public static void UtilityContact.ContactDetailSave()
}//public static DataSet SelectMethodContactDataSet() /// <summary>SelectMethodContactDataSet()</summary> public static DataSet SelectMethodContactDataSet ( string lastName, string firstName, string otherName, string company ) { string exceptionMessage = ""; string strSQLQuery = ""; string SQLAnd = " Where "; DataSet dataSet = null; strSQLQuery = "SELECT * FROM Contact "; if (lastName != null) { lastName = lastName.Trim(); strSQLQuery = strSQLQuery + SQLAnd + " (lastName like '%" + lastName + "%') "; SQLAnd = " AND "; } if (firstName != null) { firstName = firstName.Trim(); strSQLQuery = strSQLQuery + SQLAnd + " (firstName like '%" + firstName + "%') "; SQLAnd = " AND "; } if (otherName != null) { otherName = otherName.Trim(); strSQLQuery = strSQLQuery + SQLAnd + " (otherName like '%" + otherName + "%') "; SQLAnd = " AND "; } if (company != null) { company = company.Trim(); strSQLQuery = strSQLQuery + SQLAnd + " (company like '%" + company + "%') "; SQLAnd = " AND "; } UtilityDatabase.DatabaseQuery ( DatabaseConnectionString, ref exceptionMessage, ref dataSet, strSQLQuery, CommandType.Text ); return(dataSet); }//public static DataSet SelectMethodContactDataSet()
}//public String scriptureReference /// <summary>DatabaseSelect</summary> public static void DatabaseSelect ( ref String databaseConnectionString, ref String exceptionMessage, ref Contact contact, ref DataSet dataSet ) { StringBuilder sb = null; DataColumn dataColumn = null; DataRow dataRow = null; DataTable dataTable = null; sb = new StringBuilder(); sb.AppendFormat ( SQLSelectContactWhereClause, contact.ContactID ); //UtilityDebug.Write(String.Format("SQL Contact: {0}", sb.ToString())); UtilityDatabase.DatabaseQuery ( databaseConnectionString, ref exceptionMessage, ref dataSet, sb.ToString(), CommandType.Text ); dataTable = dataSet.Tables[0]; dataRow = dataTable.Rows[0]; dataColumn = dataTable.Columns[0]; //UtilityDebug.Write( String.Format("{0}", dataRow[dataColumn]) ); contact = new Contact ( System.Convert.ToInt32( dataRow[ dataTable.Columns[OrdinalPositionContactContactID] ] ), //ContactID System.Convert.ToString( dataRow[ dataTable.Columns[OrdinalPositionContactFirstName] ] ), //FirstName System.Convert.ToString( dataRow[ dataTable.Columns[OrdinalPositionContactLastName] ] ), //LastName System.Convert.ToString( dataRow[ dataTable.Columns[OrdinalPositionContactOtherName] ] ), //OtherName System.Convert.ToString( dataRow[ dataTable.Columns[OrdinalPositionContactPrefix] ] ), //Prefix System.Convert.ToString( dataRow[ dataTable.Columns[OrdinalPositionContactSuffix] ] ), //Suffix System.Convert.ToString( dataRow[ dataTable.Columns[OrdinalPositionContactCompany] ] ), //Company System.Convert.ToString( dataRow[ dataTable.Columns[OrdinalPositionContactCommentary] ] ), //Commentary System.Convert.ToString( dataRow[ dataTable.Columns[OrdinalPositionContactScriptureReference] ] ) //ScriptureReference ); }//public void DatabaseSelect()
//static String DatabaseConnectionString = "Provider=SQLOLEDB;server=guidance;database=WordEngineering;uid=sa;pwd=girg"; /// <summary>SelectMethodContact()</summary> public static IDataReader SelectMethodContact() { string exceptionMessage = null; IDataReader iDataReader = null; UtilityDatabase.DatabaseQuery ( DatabaseConnectionString, ref exceptionMessage, ref iDataReader, "SELECT * FROM Contact", CommandType.Text ); return(iDataReader); } //public static IDataReader SelectMethodContact()
/// <summary>SelectMethodContactDataSet()</summary> public static DataSet SelectMethodContactDataSet() { string exceptionMessage = null; DataSet dataSet = null; UtilityDatabase.DatabaseQuery ( DatabaseConnectionString, ref exceptionMessage, ref dataSet, "SELECT * FROM Contact", CommandType.Text ); return(dataSet); }//public static DataSet SelectMethodContactDataSet()
}//public static void RSSSyndicationFeed() ///<summary>RSSSyndicationFeed Courtesy http://msdn.microsoft.com/asp.net/using/understanding/XML/default.aspx?pull=/library/en-us/dnaspp/html/aspnet-createrssw-aspnet.asp Microsoft: Creating an Online RSS News Aggregator with ASP.NET with Scott Mitchell</summary> public static void RSSSyndicationFeed ( ref String databaseConnectionString, ref String exceptionMessage, ref IDataReader iDataReader ) { UtilityDatabase.DatabaseQuery ( databaseConnectionString, ref exceptionMessage, ref iDataReader, SQLSelectRSSSyndicationFeed, CommandType.Text ); }//public static void RSSSyndicationFeed()
/// <summary>ReadXml</summary> public static void ReadXml ( ref string filenameXml, ref DataSet dataSet, ref string exceptionMessage, ref string[] columnName ) { HttpContext httpContext = HttpContext.Current; try { UtilityXml.ReadXml ( ref dataSet, ref exceptionMessage, ref filenameXml ); if ( exceptionMessage != null ) { return; } if ( dataSet != null ) { UtilityDatabase.DataSetColumn ( ref dataSet, ref columnName, ref exceptionMessage ); if ( exceptionMessage != null ) { return; } } }//try catch ( Exception exception ) { exceptionMessage = "Exception: " + exception.Message; } if ( httpContext == null ) { System.Console.WriteLine( exceptionMessage ); } }//public static void ReadXml()
///<summary>RSSSyndicationFeedId Courtesy http://msdn.microsoft.com/asp.net/using/understanding/XML/default.aspx?pull=/library/en-us/dnaspp/html/aspnet-createrssw-aspnet.asp Microsoft: Creating an Online RSS News Aggregator with ASP.NET with Scott Mitchell</summary> public static void RSSSyndicationFeedId ( ref String databaseConnectionString, ref String exceptionMessage, ref int feedId, ref String feedURI, ref Xml xml ) { object databaseReturnValue = null; StringBuilder sb = null; XmlDocument xmlDocument = null; XsltArgumentList xsltArgumentList = null; sb = new StringBuilder(); xmlDocument = new XmlDocument(); xsltArgumentList = new XsltArgumentList(); sb.AppendFormat( SQLSelectRSSSyndicationFeedId, feedId ); databaseReturnValue = UtilityDatabase.DatabaseQuery ( databaseConnectionString, ref exceptionMessage, sb.ToString(), CommandType.Text ); if ( databaseReturnValue == null || databaseReturnValue == DBNull.Value ) { return; }//if ( databaseReturnValue == null || databaseReturnValue == DBNull.Value ) feedURI = databaseReturnValue.ToString(); xmlDocument.Load( feedURI ); xml.Document = xmlDocument; // Add the FeedID parameter to the XSLT stylesheet xsltArgumentList.AddParam("FeedID", "", feedId); xml.TransformArgumentList = xsltArgumentList; }//public static void RSSSyndicationFeedId()
}//public static void Main() ///<summary>DatabaseQuery().</summary> ///<param name="databaseConnectionString">Database Connection String.</param> ///<param name="exceptionMessage">Exception Message.</param> ///<param name="dataSet">DataSet.</param> ///<param name="commandText">CommandText.</param> ///<param name="commandType">CommandType.</param> public static void DatabaseQuery ( string databaseConnectionString, ref string exceptionMessage, ref DataSet dataSet, string commandText, CommandType commandType ) { UtilityDatabase.DatabaseQuery ( databaseConnectionString, ref exceptionMessage, ref dataSet, commandText, commandType ); }
/// <summary>ContactBrowse</summary> public static void ContactBrowse ( ref String databaseConnectionString, ref String exceptionMessage, ref IDataReader iDataReader, ref String SQLSelect ) { UtilityDatabase.DatabaseQuery ( databaseConnectionString, ref exceptionMessage, ref iDataReader, SQLSelect, CommandType.Text ); }//public static void ContactBrowse()
private void BindGrid() { String exceptionMessage = null; DataSet dataSet = null; UtilityDatabase.DatabaseQuery ( databaseConnectionString, ref exceptionMessage, ref dataSet, "Select * from NorthWind..products", CommandType.Text ); if (exceptionMessage != null) { Feedback = exceptionMessage; } GridViewCatalogNorthWindProducts.DataSource = dataSet; GridViewCatalogNorthWindProducts.DataBind(); }
public static void Main(string[] args) { int argumentCount = args.Length; String exceptionMessage = null; OleDbConnection oleDbConnection = null; //Open the database connection. oleDbConnection = UtilityDatabase.DatabaseConnectionInitialize(DatabaseConnectionString, ref exceptionMessage); TableProcessURI ( ref oleDbConnection, selectQueryUriChrist, filenameUriHtmlChrist, filenameUriTextChrist, filenameUriXsdChrist, filenameUriXmlChrist, filenameUriXmlChrist2, filenameUriXsltChrist ); TableProcessURI ( ref oleDbConnection, selectQueryUriWordEngineering, filenameUriHtmlWordEngineering, filenameUriTextWordEngineering, filenameUriXsdWordEngineering, filenameUriXmlWordEngineering, filenameUriXmlWordEngineering2, filenameUriXsltWordEngineering ); //Close the database connection. UtilityDatabase.DatabaseConnectionHouseKeeping(oleDbConnection, ref exceptionMessage); }//Main()
/// <summary>DataSourceBind().</summary> public void DataSourceBind() { String exceptionMessage = null; String[] primaryKey = null; DataTableCollection dataTableCollection = null; DataColumn[][] dataColumnPrimaryKey = null; // Store the cookies received in the session state for future retrieval by this session. Session["DataSetDataGrid"] = DataSetDataGrid; DataGridURI.DataSource = DataSetDataGrid; DataGridURI.DataBind(); UtilityDatabase.DataSetTablePrimaryKey ( ref DataSetDataGrid, ref exceptionMessage, ref dataTableCollection, ref dataColumnPrimaryKey, ref primaryKey ); DataGridURI.DataKeyField = primaryKey[0]; }
/// <summary>EternalXml</summary> public static void EternalXml ( ref EternalArgument eternalArgument, ref string exceptionMessage ) { DataSet dataSet = null; ArrayList databaseName = null; ArrayList sqlStatementUnion = null; ArrayList objectName = null; ArrayList ownerName = null; ArrayList unionIndex = null; String filenameXml = null; try { UtilityDatabase.DatabaseQuery ( DatabaseConnectionString, ref exceptionMessage, ref dataSet, eternalArgument.sqlQuery, CommandType.Text ); if (exceptionMessage != null) { return; } ; UtilityDatabase.SQLSelectParse ( eternalArgument.sqlQuery, ref unionIndex, ref sqlStatementUnion, ref databaseName, ref ownerName, ref objectName, ref exceptionMessage ); if (exceptionMessage != null) { return; } ; if (dataSet.Tables.Count < 1) { return; }//if ( dataSet.Tables.Count < 1 ) dataSet.DataSetName = (String)databaseName[0]; for (int objectNameCount = 0; objectNameCount < objectName.Count; ++objectNameCount) { dataSet.Tables[objectNameCount].TableName = (String)objectName[objectNameCount]; }//for ( int objectNameCount = 0; objectNameCount < objectName.Count; ++objectNameCount ) ScriptureReference.ScriptureReferenceURI ( DatabaseConnectionString, FilenameConfigurationXml, ref exceptionMessage, ref dataSet ); if (exceptionMessage != null) { return; } ; if (eternalArgument.date) { filenameXml = UtilityFile.DatePostfix(eternalArgument.filenameXml); } else { filenameXml = eternalArgument.filenameXml; } UtilityXml.WriteXml ( dataSet, ref exceptionMessage, ref filenameXml, ref eternalArgument.filenameStylesheet ); if (exceptionMessage != null) { return; } ; } catch (Exception exception) { UtilityException.ExceptionLog(exception, exception.GetType().Name, ref exceptionMessage); } }
}//public static void RSSSyndicationFeedId() ///<summary>RSSSyndicationFeedId Courtesy http://msdn.microsoft.com/asp.net/using/understanding/XML/default.aspx?pull=/library/en-us/dnaspp/html/aspnet-createrssw-aspnet.asp Microsoft: Creating an Online RSS News Aggregator with ASP.NET with Scott Mitchell</summary> public static void RSSSyndicationFeedId ( ref String databaseConnectionString, ref String exceptionMessage, ref int feedId, ref String feedURI, ref int updateInterval, ref int id, ref IDataReader iDataReader, ref Xml xml, ref XmlDocument xmlDocument ) { StringBuilder sb = null; XsltArgumentList xsltArgumentList = null; HttpContext httpContextCurrent = null; sb = new StringBuilder(); xmlDocument = new XmlDocument(); xsltArgumentList = new XsltArgumentList(); httpContextCurrent = HttpContext.Current; sb.AppendFormat( SQLSelectRSSSyndicationFeedId, feedId ); /* #if (DEBUG) if ( httpContextCurrent != null ) { httpContextCurrent.Response.Write( "SQL: " + sb ); }//if ( httpContextCurrent != null ) else { System.Console.WriteLine("SQL: {0}", exceptionMessage = sb.ToString()); }//else ( httpContextCurrent == null ) #endif */ UtilityDatabase.DatabaseQuery ( databaseConnectionString, ref exceptionMessage, ref iDataReader, sb.ToString(), CommandType.Text ); if ( exceptionMessage != null ) { exceptionMessage = sb.ToString() + exceptionMessage; return; } try { // Always call Read before accessing data. if ( iDataReader.Read() ) { feedURI = iDataReader["URI"].ToString(); updateInterval = Int32.Parse(iDataReader["UpdateInterval"].ToString()); /* System.Console.WriteLine ( "FeedURI: {0} | Update Interval: {1}", feedURI, updateInterval ); */ }//if ( iDataReader.Read() ) xmlDocument.Load( feedURI ); //xmlDocument.Save( "UtilityRSS.xml" ); /* xml.Document = xmlDocument; // Add the ID parameter to the XSLT stylesheet xsltArgumentList.AddParam("ID", "", id); xml.TransformArgumentList = xsltArgumentList; */ }//try catch ( Exception exception ) { exceptionMessage = "Exception:" + exception.Message; System.Console.WriteLine("Exception: {0}", exception.Message); } }//public static void RSSSyndicationFeedId()
} //AlphabetSequenceDatabaseQuery() /// <summary>The database query.</summary> /// <param name="databaseConnectionString">The database connection string.</param> /// <param name="exceptionMessage">The exception message.</param> /// <param name="wordQuery">The word.</param> /// <param name="scriptureReferenceAssociates">The scripture reference associates.</param> /// <param name="alphabetSequenceIndex">The alphabet sequence index.</param> /// <param name="scriptureReferenceAlphabetSequence">The scripture reference alphabet sequence.</param> public static void AlphabetSequenceQuery ( ref String databaseConnectionString, ref String exceptionMessage, ref String[] wordQuery, String scriptureReferenceAssociates, ref int[] alphabetSequenceIndex, ref ScriptureReferenceAlphabetSequence[] scriptureReferenceAlphabetSequence ) { int sequenceOrderId = -1; int theWordId = -1; int wordQueryTotal = wordQuery.Length; string chapterForward = null; string chapterBackward = null; //string commentary = null; string scriptureReference = null; string scriptureReferenceChapterBackward = null; string scriptureReferenceChapterForward = null; string scriptureReferenceVerseBackward = null; string scriptureReferenceVerseForward = null; string verseForward = null; string verseBackward = null; OleDbConnection oleDbConnection = null; OleDbCommand oleDbCommand = null; OleDbDataReader oleDbDataReader = null; OleDbParameter oleDbParameterWord = null; OleDbParameter oleDbParameterScriptureReferenceAssociates = null; OleDbParameter oleDbParameterAlphabetSequence = null; OleDbParameter oleDbParameterScriptureReferenceVerseForward = null; OleDbParameter oleDbParameterScriptureReferenceChapterForward = null; OleDbParameter oleDbParameterScriptureReferenceChapterBackward = null; OleDbParameter oleDbParameterScriptureReferenceVerseBackward = null; OleDbParameter oleDbParameterScriptureReference = null; OleDbParameter oleDbParameterSequenceOrderId = null; OleDbParameter oleDbParameterVerseForward = null; OleDbParameter oleDbParameterChapterForward = null; OleDbParameter oleDbParameterChapterBackward = null; OleDbParameter oleDbParameterVerseBackward = null; OleDbParameter oleDbParameterCommentary = null; OleDbParameter oleDbParameterTheWordId = null; AlphabetSequenceIndexCalculate ( ref wordQuery, ref alphabetSequenceIndex ); try { if ( databaseConnectionString == null || databaseConnectionString.IndexOf("Bible") < 0 ) { databaseConnectionString = DatabaseConnectionString; }//if ( databaseConnectionString == null ) oleDbConnection = UtilityDatabase.DatabaseConnectionInitialize ( databaseConnectionString, ref exceptionMessage ); if (oleDbConnection == null || exceptionMessage != null) { return; }//if ( oleDbConnection == null || exceptionMessage != null ) oleDbCommand = new OleDbCommand(SQLSelectAlphabetSequence, oleDbConnection); oleDbCommand.CommandType = CommandType.StoredProcedure; oleDbParameterWord = new OleDbParameter(ParameterWord, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterScriptureReferenceAssociates = new OleDbParameter(ParameterWord, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterAlphabetSequence = new OleDbParameter(ParameterAlphabetSequence, OleDbType.Integer); oleDbParameterScriptureReferenceVerseForward = new OleDbParameter(ParameterScriptureReferenceVerseForward, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterScriptureReferenceChapterForward = new OleDbParameter(ParameterScriptureReferenceChapterForward, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterScriptureReferenceChapterBackward = new OleDbParameter(ParameterScriptureReferenceChapterBackward, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterScriptureReferenceVerseBackward = new OleDbParameter(ParameterScriptureReferenceVerseBackward, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterScriptureReference = new OleDbParameter(ParameterScriptureReference, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterVerseForward = new OleDbParameter(ParameterVerseForward, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterChapterForward = new OleDbParameter(ParameterChapterForward, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterChapterBackward = new OleDbParameter(ParameterChapterBackward, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterVerseBackward = new OleDbParameter(ParameterVerseBackward, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterSequenceOrderId = new OleDbParameter(ParameterSequenceOrderId, OleDbType.Integer); oleDbParameterCommentary = new OleDbParameter(ParameterCommentary, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterTheWordId = new OleDbParameter(ParameterTheWordId, OleDbType.Integer); oleDbParameterSequenceOrderId = new OleDbParameter(ParameterSequenceOrderId, OleDbType.Integer); /* * @word VARCHAR(600) = NULL OUTPUT, * @scriptureReferenceAssociates VARCHAR(600) = NULL OUTPUT, * @alphabetSequence INT = -1 OUTPUT, * @scriptureReferenceVerseForward VARCHAR(600) = NULL OUTPUT, * @scriptureReferenceChapterForward VARCHAR(600) = NULL OUTPUT, * @scriptureReferenceChapterBackward VARCHAR(600) = NULL OUTPUT, * @scriptureReferenceVerseBackward VARCHAR(600) = NULL OUTPUT, * @scriptureReference VARCHAR(600) = NULL OUTPUT, * @verseForward VARCHAR(600) = NULL OUTPUT, * @chapterForward VARCHAR(600) = NULL OUTPUT, * @chapterBackward VARCHAR(600) = NULL OUTPUT, * @verseBackward VARCHAR(600) = NULL OUTPUT, * @sequenceOrderId INT = -1 OUTPUT */ oleDbCommand.Parameters.Add(oleDbParameterWord); oleDbCommand.Parameters.Add(oleDbParameterScriptureReferenceAssociates); oleDbCommand.Parameters.Add(oleDbParameterAlphabetSequence); oleDbCommand.Parameters.Add(oleDbParameterScriptureReferenceVerseForward); oleDbCommand.Parameters.Add(oleDbParameterScriptureReferenceChapterForward); oleDbCommand.Parameters.Add(oleDbParameterScriptureReferenceChapterBackward); oleDbCommand.Parameters.Add(oleDbParameterScriptureReferenceVerseBackward); oleDbCommand.Parameters.Add(oleDbParameterScriptureReference); oleDbCommand.Parameters.Add(oleDbParameterVerseForward); oleDbCommand.Parameters.Add(oleDbParameterChapterForward); oleDbCommand.Parameters.Add(oleDbParameterChapterBackward); oleDbCommand.Parameters.Add(oleDbParameterVerseBackward); /* * oleDbCommand.Parameters.Add(oleDbParameterCommentary); * oleDbCommand.Parameters.Add(oleDbParameterTheWordId); */ oleDbCommand.Parameters.Add(oleDbParameterSequenceOrderId); oleDbParameterWord.Direction = ParameterDirection.InputOutput; oleDbParameterScriptureReferenceAssociates.Direction = ParameterDirection.InputOutput; oleDbParameterAlphabetSequence.Direction = ParameterDirection.InputOutput; oleDbParameterScriptureReferenceVerseForward.Direction = ParameterDirection.Output; oleDbParameterScriptureReferenceChapterForward.Direction = ParameterDirection.Output; oleDbParameterScriptureReferenceChapterBackward.Direction = ParameterDirection.Output; oleDbParameterScriptureReferenceVerseBackward.Direction = ParameterDirection.Output; oleDbParameterScriptureReference.Direction = ParameterDirection.Output; oleDbParameterVerseForward.Direction = ParameterDirection.Output; oleDbParameterChapterForward.Direction = ParameterDirection.Output; oleDbParameterChapterBackward.Direction = ParameterDirection.Output; oleDbParameterVerseBackward.Direction = ParameterDirection.Output; /* * oleDbParameterCommentary.Direction = ParameterDirection.InputOutput; * oleDbParameterTheWordId.Direction = ParameterDirection.InputOutput; */ oleDbParameterSequenceOrderId.Direction = ParameterDirection.InputOutput; for (int wordQueryIndex = 0; wordQueryIndex < wordQuery.Length; ++wordQueryIndex) { oleDbParameterAlphabetSequence.Value = alphabetSequenceIndex[wordQueryIndex]; oleDbParameterScriptureReferenceAssociates.Value = scriptureReferenceAssociates; oleDbParameterSequenceOrderId.Value = -1; oleDbParameterTheWordId.Value = null; oleDbParameterWord.Value = wordQuery[wordQueryIndex]; oleDbCommand.ExecuteScalar(); scriptureReferenceVerseForward = (oleDbParameterScriptureReferenceVerseForward.Value).ToString(); scriptureReferenceChapterForward = (oleDbParameterScriptureReferenceChapterForward.Value).ToString(); scriptureReferenceChapterBackward = (oleDbParameterScriptureReferenceChapterBackward.Value).ToString(); scriptureReferenceVerseBackward = (oleDbParameterScriptureReferenceVerseBackward.Value).ToString(); scriptureReference = (oleDbParameterScriptureReference.Value).ToString(); verseForward = (oleDbParameterVerseForward.Value).ToString(); chapterForward = (oleDbParameterChapterForward.Value).ToString(); chapterBackward = (oleDbParameterChapterBackward.Value).ToString(); verseBackward = (oleDbParameterVerseBackward.Value).ToString(); sequenceOrderId = Int32.Parse(oleDbParameterSequenceOrderId.Value.ToString()); /* * theWordId = Int32.Parse ( oleDbParameterTheWordId.Value.ToString() ); */ scriptureReferenceAlphabetSequence[wordQueryIndex] = new ScriptureReferenceAlphabetSequence ( wordQuery[wordQueryIndex], scriptureReferenceAssociates, alphabetSequenceIndex[wordQueryIndex], scriptureReferenceVerseForward, scriptureReferenceChapterForward, scriptureReferenceChapterBackward, scriptureReferenceVerseBackward, scriptureReference, verseForward, chapterForward, chapterBackward, verseBackward, sequenceOrderId ); #if (DEBUG) System.Console.WriteLine("SequenceOrderId: {0}", sequenceOrderId); System.Console.WriteLine("TheWordId: {0}", theWordId); #endif } //for ( int wordQueryIndex = 0; wordQueryIndex < wordQueryTotal; ++wordQueryIndex ) } //try catch (OleDbException exception) { exceptionMessage = UtilityDatabase.DisplayOleDbErrorCollection(exception); System.Console.WriteLine("OleDbException: {0}", exceptionMessage); System.Console.WriteLine("OleDbException: {0}", oleDbParameterAlphabetSequence.Value); return; }//catch (OleDbException exception) catch (Exception exception) { exceptionMessage = exception.Message; System.Console.WriteLine("Exception: {0}", exception.Message); return; }//catch (Exception exception) finally { if (oleDbDataReader != null) { oleDbDataReader.Close(); } UtilityDatabase.DatabaseConnectionHouseKeeping ( oleDbConnection, ref exceptionMessage ); } //finally return; } //AlphabetSequenceQuery()
}//public static void RSSFeed() ///<summary>RSSFeed</summary> public static void RSSFeed ( ref String databaseConnectionString, ref String exceptionMessage, ref DataSet dataSet, ref String SQLSelect, ref int topNumberOfRows, ref String FilenameRSSFeedXml, ref String FilenameRSSFeedXslt, ref XmlTextWriter xmlTextWriter ) { StringBuilder sb = null; HttpContext HttpContextCurrent = HttpContext.Current; sb = new StringBuilder(); sb.AppendFormat( SQLSelect, topNumberOfRows ); try { UtilityDatabase.DatabaseQuery ( databaseConnectionString, ref exceptionMessage, ref dataSet, sb.ToString(), CommandType.Text ); if ( FilenameRSSFeedXml == null ) { if ( HttpContextCurrent == null ) { return; }//if ( HttpContextCurrent == null ) xmlTextWriter = new XmlTextWriter ( HttpContextCurrent.Response.OutputStream, Encoding.UTF8 ); }//if ( FilenameRSSFeedXml == null ) else { xmlTextWriter = new XmlTextWriter ( FilenameRSSFeedXml, Encoding.UTF8 ); }//else ( FilenameRSSFeedXml == null ) xmlTextWriter.WriteStartDocument(); if ( FilenameRSSFeedXslt != null ) { sb = new StringBuilder(); sb.AppendFormat( XMLProcessingInstructionStyleSheet, FilenameRSSFeedXslt ); xmlTextWriter.WriteProcessingInstruction("xml-stylesheet", sb.ToString() ); } xmlTextWriter.WriteStartElement("rss"); xmlTextWriter.WriteAttributeString("version", "2.0"); xmlTextWriter.WriteStartElement("channel"); foreach ( String[] RSSElementChannelCurrent in RSSElementChannel ) { xmlTextWriter.WriteElementString( RSSElementChannelCurrent[0], RSSElementChannelCurrent[1] ); };//foreach ( String[] RSSElementChannelCurrent in RSSElementChannel ) foreach(DataTable dataTable in dataSet.Tables) { foreach(DataRow dataRow in dataTable.Rows) { xmlTextWriter.WriteStartElement("item"); xmlTextWriter.WriteElementString("title", Convert.ToString( dataRow[0] ) ); xmlTextWriter.WriteElementString("link", URITheWord + dataRow[1] ); xmlTextWriter.WriteElementString("pubDate", Convert.ToDateTime( dataRow[2]).ToString("R") ); xmlTextWriter.WriteEndElement(); //Element item }//foreach(DataRow dataRow in dataTable.Rows) }//foreach(DataTable dataTable in dataSet.Tables) xmlTextWriter.WriteEndElement(); //Element channel xmlTextWriter.WriteEndElement(); //Element rss xmlTextWriter.WriteEndDocument(); xmlTextWriter.Flush(); xmlTextWriter.Close(); }//try catch ( ArgumentException exception ) { exceptionMessage = "ArgumentException: " + exception.Message; System.Console.WriteLine("ArgumentException: {0}", exception.Message); } catch ( UnauthorizedAccessException exception ) { exceptionMessage = "UnauthorizedAccessException: " + exception.Message; System.Console.WriteLine("UnauthorizedAccessException: {0}", exception.Message); } catch ( DirectoryNotFoundException exception ) { exceptionMessage = "DirectoryNotFoundException: " + exception.Message; System.Console.WriteLine("DirectoryNotFoundException: {0}", exception.Message); } catch ( IOException exception ) { exceptionMessage = "IOException: " + exception.Message; System.Console.WriteLine("IOException: {0}", exception.Message); } catch ( SecurityException exception ) { exceptionMessage = "SecurityException: " + exception.Message; System.Console.WriteLine("SecurityException: {0}", exception.Message); } }//public static void RSSFeed()
}//public static void UtilityContact.ContactDetailSave() ///<summary>ContactImageUpdate</summary> public static void ContactImageUpdate ( ref string databaseConnectionString, ref string exceptionMessage, ref int sequenceOrderId, ref DateTime dated, ref int contactId, ref byte[] imageContent, ref FileUpload imageSource, ref string imageType ) { int databaseNumberOfRowsAffected = -1; string imageSourcePath = null; OleDbCommand oleDbCommand = null; OleDbConnection oleDbConnection = null; OleDbParameter oleDbParameter = null; try { if ( imageSource.HasFile == false ) { return; } imageSourcePath = imageSource.PostedFile.FileName; UtilityImage.FileUploadByte ( ref imageSource, ref imageContent, ref exceptionMessage ); if ( exceptionMessage != null ) { return; } oleDbConnection = UtilityDatabase.DatabaseConnectionInitialize ( databaseConnectionString, ref exceptionMessage ); if ( exceptionMessage != null ) { return; } oleDbCommand = new OleDbCommand( "uspContactImageUpdate", oleDbConnection ); if ( oleDbCommand == null ) { return; } oleDbCommand.CommandType = CommandType.StoredProcedure; oleDbParameter = new OleDbParameter( "@sequenceOrderId", OleDbType.Integer ); if ( sequenceOrderId > 0 ) { oleDbParameter.Value = sequenceOrderId; } else { oleDbParameter.Value = DBNull.Value; } oleDbCommand.Parameters.Add( oleDbParameter ); oleDbParameter = new OleDbParameter( "@dated", OleDbType.Date ); if ( dated > DateTime.MinValue ) { oleDbParameter.Value = dated; } else { oleDbParameter.Value = DBNull.Value; } oleDbCommand.Parameters.Add( oleDbParameter ); oleDbParameter = new OleDbParameter( "@contactId", OleDbType.Integer ); if ( contactId > 0 ) { oleDbParameter.Value = contactId; } else { oleDbParameter.Value = DBNull.Value; } oleDbCommand.Parameters.Add( oleDbParameter ); oleDbParameter = new OleDbParameter( "@imageContent", OleDbType.Binary ); oleDbParameter.Value = imageContent; oleDbCommand.Parameters.Add( oleDbParameter ); oleDbParameter = new OleDbParameter( "@ImageSource", OleDbType.VarChar, 255 ); oleDbParameter.Value = imageSourcePath; oleDbCommand.Parameters.Add( oleDbParameter ); oleDbParameter = new OleDbParameter( "@imageType", OleDbType.VarChar, 255 ); oleDbParameter.Value = imageType; oleDbCommand.Parameters.Add( oleDbParameter ); databaseNumberOfRowsAffected = oleDbCommand.ExecuteNonQuery(); }//try catch ( Exception exception ) { UtilityException.ExceptionLog( exception, exception.GetType().Name, ref exceptionMessage ); } }
}//static void Main( string[] argv ) ///<summary>XmlParse()</summary> static void XmlParse ( string databaseConnectionString, ref string exceptionMessage, string[] xmlDocumentFilenames ) { int childrenCount = 0; int childrenTotal = 0; int elementConfigurationCount = 0; int elementConfigurationIndex = 0; int elementConfigurationTotal = ElementConfiguration.Length; int grandChildrenCount = 0; int grandChildrenTotal = 0; int grandChildrenValueLength = 0; int oleDbParameterCollectionCount = 0; int oleDbParameterCollectionIndex = 0; int oleDbParameterCollectionTotal = 0; string[][] children = null; string[][] grandChildren = null; DateTime dateTime = new DateTime(); OleDbConnection oleDbConnection = null; OleDbCommand oleDbCommand = null; OleDbParameterCollection oleDbParameterCollection = null; XPathDocument xPathDocument = null; XPathNavigator xPathNavigatorChildren = null; XPathNavigator xPathNavigatorGrandChildren = null; XPathNavigator xPathNavigatorParent = null; XPathNodeIterator xPathNodeIteratorChildren = null; XPathNodeIterator xPathNodeIteratorGrandChildren = null; XPathNodeIterator xPathNodeIteratorParent = null; //Open the database connection. oleDbConnection = UtilityDatabase.DatabaseConnectionInitialize( databaseConnectionString, ref exceptionMessage ); foreach ( string xmlDocumentFilename in xmlDocumentFilenames ) { if ( !File.Exists( xmlDocumentFilename ) ) { System.Console.WriteLine("File Not Found: {0}", xmlDocumentFilename ); continue; }//if ( !File.Exists( xmlDocumentFilename ) ) #if ( DEBUG ) System.Console.WriteLine("XML Document Filename: {0}", xmlDocumentFilename); #endif try { //Create an XML document instance, and load XML data. xPathDocument = new XPathDocument( xmlDocumentFilename ); xPathNavigatorParent = xPathDocument.CreateNavigator(); xPathNodeIteratorParent = xPathNavigatorParent.SelectChildren( XPathNodeType.Element ); xPathNodeIteratorParent.MoveNext(); xPathNavigatorChildren = xPathNodeIteratorParent.Current; xPathNodeIteratorChildren = xPathNavigatorChildren.SelectChildren( XPathNodeType.Element ); childrenCount = -1; childrenTotal = xPathNodeIteratorChildren.Count; children = new string[childrenTotal][]; while ( xPathNodeIteratorChildren.MoveNext() ) { ++childrenCount; children[childrenCount] = new string[2]; children[childrenCount][NodeRankName] = xPathNodeIteratorChildren.Current.Name.Trim(); children[childrenCount][NodeRankValue] = xPathNodeIteratorChildren.Current.ToString().Trim(); /* #if ( DEBUG ) System.Console.WriteLine ( "Children Name: {0} | Value: {1}", children[childrenCount][NodeRankName], children[childrenCount][NodeRankValue] ); #endif */ for ( elementConfigurationCount = 0, elementConfigurationIndex = -1; elementConfigurationCount < elementConfigurationTotal; ++elementConfigurationCount ) { if ( ElementConfiguration[elementConfigurationCount][ElementRankName] == children[childrenCount][NodeRankName] ) { elementConfigurationIndex = elementConfigurationCount; }//if ( ElementConfiguration[elementConfigurationCount][ElementRankName] == children[childrenCount][NodeRankName] ) }//for ( elementConfigurationCount = 0, elementConfigurationIndex = -1; elementConfigurationCount < elementConfigurationTotal; ++elementConfigurationCount ) //Element not found; therefore, do not process. if ( elementConfigurationIndex == -1 ) { continue; }//if ( elementConfigurationIndex == -1 ) oleDbCommand = new OleDbCommand ( ElementConfiguration[elementConfigurationIndex][ElementRankStoredProcedure], oleDbConnection ); oleDbCommand.CommandType = CommandType.StoredProcedure; OleDbCommandBuilder.DeriveParameters( oleDbCommand ); oleDbParameterCollection = oleDbCommand.Parameters; oleDbParameterCollectionTotal = oleDbParameterCollection.Count; xPathNavigatorGrandChildren = xPathNodeIteratorChildren.Current; xPathNodeIteratorGrandChildren = xPathNavigatorGrandChildren.SelectChildren( XPathNodeType.Element ); grandChildrenCount = -1; grandChildrenTotal = xPathNodeIteratorGrandChildren.Count; grandChildren = new string[grandChildrenTotal][]; while ( xPathNodeIteratorGrandChildren.MoveNext() ) { ++grandChildrenCount; grandChildren[grandChildrenCount] = new string[2]; grandChildren[grandChildrenCount][NodeRankName] = xPathNodeIteratorGrandChildren.Current.Name.Trim(); grandChildren[grandChildrenCount][NodeRankValue] = xPathNodeIteratorGrandChildren.Current.ToString().Trim(); grandChildrenValueLength = grandChildren[grandChildrenCount][NodeRankValue].Length; for ( oleDbParameterCollectionCount = 0, oleDbParameterCollectionIndex = -1; oleDbParameterCollectionCount < oleDbParameterCollectionTotal; ++oleDbParameterCollectionCount ) { if ( string.Compare ( grandChildren[grandChildrenCount][NodeRankName], oleDbParameterCollection[oleDbParameterCollectionCount].ParameterName, true ) == 0 ) { oleDbParameterCollectionIndex = oleDbParameterCollectionCount; switch ( oleDbParameterCollection[oleDbParameterCollectionCount].OleDbType ) { case OleDbType.DBTimeStamp: if ( grandChildrenValueLength == 12 || grandChildrenValueLength == 14 ) { dateTime = UtilityDateTimeParse.DateTimeParse( grandChildren[grandChildrenCount][NodeRankValue] ); }//if ( grandChildrenValueLength == 12 || grandChildrenValueLength == 14 ) else if ( grandChildrenValueLength == 33 ) { dateTime = XmlConvert.ToDateTime( grandChildren[grandChildrenCount][NodeRankValue] ); }//else if ( grandChildren[grandChildrenCount][NodeRankValue].Length == 33 ) oleDbParameterCollection[oleDbParameterCollectionCount].Value = dateTime; break; default: oleDbParameterCollection[oleDbParameterCollectionCount].Value = grandChildren[grandChildrenCount][NodeRankValue]; break; }//switch ( oleDbParameterCollection[oleDbParameterCollectionCount].OleDbType ) break; }//if ( string.Compare ( grandChildren[grandChildrenCount][NodeRankName], oleDbParameterCollection[oleDbParameterCollectionCount].ParameterName, true ) == 0 ) }//foreach ( OleDbParameter oleDbParameter in oleDbParameters ) #if ( DEBUG ) if ( oleDbParameterCollectionIndex > -1 ) //Database Parameter Found. { System.Console.WriteLine ( "OleDbParameter Name: {0} | Type: {1} | Value: {2}", oleDbParameterCollection[oleDbParameterCollectionIndex].ParameterName, oleDbParameterCollection[oleDbParameterCollectionIndex].OleDbType, oleDbParameterCollection[oleDbParameterCollectionIndex].Value ); }//Database Parameter Found. else { System.Console.WriteLine ( "GrandChildren Name: {0} | Value: {1}", grandChildren[grandChildrenCount][NodeRankName], grandChildren[grandChildrenCount][NodeRankValue] ); }//Database Parameter Not Found. #endif }//while ( xPathNodeIteratorGrandChildren.MoveNext() ) for ( oleDbParameterCollectionCount = 0; oleDbParameterCollectionCount < oleDbParameterCollectionTotal; ++oleDbParameterCollectionCount ) { switch ( oleDbParameterCollection[oleDbParameterCollectionCount].OleDbType ) { case OleDbType.Guid: if ( oleDbParameterCollection[oleDbParameterCollectionCount].Value == null ) { oleDbParameterCollection[oleDbParameterCollectionCount].Value = System.Guid.NewGuid(); } break; }//switch ( oleDbParameterCollection[oleDbParameterCollectionCount].OleDbType ) }//for ( oleDbParameterCollectionCount = 0; oleDbParameterCollectionCount < oleDbParameterCollectionTotal; ++oleDbParameterCollectionCount ) oleDbCommand.ExecuteNonQuery(); }//while ( xPathNodeIteratorChildren.MoveNext() ) }//try catch( OleDbException oleDbException ) { exceptionMessage = UtilityEventLog.WriteEntryOleDbErrorCollection( oleDbException ); System.Console.WriteLine("OleDbException: {0}", exceptionMessage); }//catch( OleDbException oleDbException ) catch( IOException ioException ) { System.Console.WriteLine("IOException: {0}", ioException.Message); }//catch( OleDbException oleDbException ) catch( XPathException xPathException ) { System.Console.WriteLine("XPathException: {0}", xPathException.Message ); }//catch( XPathException xPathException ) catch( XmlException xmlException ) { System.Console.WriteLine("XmlException: {0}", xmlException.Message); }//catch(XmlException xmlEx) catch( Exception exception ) { System.Console.WriteLine( "Exception: {0}", exception.Message ); }//catch(Exception ex) }//foreach ( string xmlDocumentFilename in xmlDocumentFilenames ) //Close the database connection. UtilityDatabase.DatabaseConnectionHouseKeeping( oleDbConnection, ref exceptionMessage ); }//static void XmlParse( string[] xmlDocumentFilenames )
}//public static void ContactBrowse() /// <summary>ContactDetail</summary> public static void ContactDetail ( string databaseConnectionString, ref string exceptionMessage, ref DataSet dataSetContact, ref int sequenceOrderId, ref Contact contact, ref DataSet[] dataSetMultiple ) { String firstName = null; String lastName = null; String otherName = null; String company = null; String prefix = null; String suffix = null; String commentary = null; String scriptureReference = null; StringBuilder sb = null; sb = new StringBuilder(); sb.AppendFormat ( SQLSelectContactDetail, sequenceOrderId ); UtilityDatabase.DatabaseQuery ( databaseConnectionString, ref exceptionMessage, ref dataSetContact, sb.ToString(), CommandType.Text ); //UtilityDatabase.PrintValues( dataSet ); try { firstName = System.Convert.ToString ( UtilityDatabase.DataSetTableRowColumn ( dataSetContact, "Table", 0, "FirstName" ) ); lastName = System.Convert.ToString ( UtilityDatabase.DataSetTableRowColumn ( dataSetContact, "Table", 0, "LastName" ) ); otherName = System.Convert.ToString ( UtilityDatabase.DataSetTableRowColumn ( dataSetContact, "Table", 0, "OtherName" ) ); company = System.Convert.ToString ( UtilityDatabase.DataSetTableRowColumn ( dataSetContact, "Table", 0, "Company" ) ); prefix = System.Convert.ToString ( UtilityDatabase.DataSetTableRowColumn ( dataSetContact, "Table", 0, "Prefix" ) ); suffix = System.Convert.ToString ( UtilityDatabase.DataSetTableRowColumn ( dataSetContact, "Table", 0, "Suffix" ) ); commentary = System.Convert.ToString ( UtilityDatabase.DataSetTableRowColumn ( dataSetContact, "Table", 0, "Commentary" ) ); scriptureReference = System.Convert.ToString ( UtilityDatabase.DataSetTableRowColumn ( dataSetContact, "Table", 0, "ScriptureReference" ) ); contact = new Contact ( sequenceOrderId, firstName, lastName, otherName, company, prefix, suffix, commentary, scriptureReference ); }//try catch ( Exception exception ) { exceptionMessage = exception.Message; } for( int dataSetIndex = 0; dataSetIndex < dataSetMultiple.Length; ++dataSetIndex ) { sb = new StringBuilder(); sb.AppendFormat ( SQLSelectContactDetailGridView[dataSetIndex], contact.sequenceOrderId ); UtilityDatabase.DatabaseQuery ( databaseConnectionString, ref exceptionMessage, ref dataSetMultiple[dataSetIndex], sb.ToString(), CommandType.Text ); }//for( int dataSetIndex = 0; dataSetIndex <= dataSet.Length; ++dataSetIndex ) }//public static void ContactDetail()
/// <summary>Page Load.</summary> public void Page_Load ( object sender, EventArgs e ) { string tableName = null; string exceptionMessage = null; ArrayList columnName = null; ServerMapPath = this.MapPath(""); if ( ServerMapPath != null) { FilenameConfigurationXml = ServerMapPath + @"\" + FilenameConfigurationXml; }//if ( ServerMapPath != null) UtilityXml.XmlDocumentNodeInnerText ( FilenameConfigurationXml, ref exceptionMessage, XPathDatabaseConnectionString, ref DatabaseConnectionString ); UtilityXml.XmlDocumentNodeInnerText ( FilenameConfigurationXml, ref exceptionMessage, XPathSQLSelect, ref DatabaseSQLSelect ); UtilityXml.XmlDocumentNodeInnerText ( FilenameConfigurationXml, ref exceptionMessage, XPathXmlStylesheet, ref FilenameXmlStylesheet ); if ( exceptionMessage != null ) { Feedback = exceptionMessage; return; }//if ( exceptionMessage != null ) if ( !Page.IsPostBack ) { UtilityDatabase.DataSetTableColumn ( ref DatabaseSQLSelect, ref DataSetDataGrid, ref exceptionMessage, ref tableName, ref columnName ); DataSourceBind(); }//if ( !Page.IsPostBack ) else { DataSetDataGrid = (DataSet) Session["DataSetDataGrid"]; }//else ( Page.IsPostBack ) }//Page_Load
}//ConfigurationXml /// <summary>Scripture Reference URI.</summary> /// <param name="databaseConnectionString">The database connection string.</param> /// <param name="filenameConfigurationXml">The filename configuration Xml.</param> /// <param name="exceptionMessage">The exception message.</param> /// <param name="dataSet">The dataset.</param> public static void ScriptureReferenceURI ( string databaseConnectionString, string filenameConfigurationXml, ref string exceptionMessage, ref DataSet dataSet ) { bool boolView = false; int columnIndexScriptureReference = -1; string dataColumnName = null; string scriptureReferenceColumnValue = null; string scriptureReferenceColumnName = null; string scriptureReferenceColumnNameURI = null; string scriptureReferenceURI = null; string[][] scriptureReferenceArray = null; string columnNamePrimary = null; string columnValuePrimary = null; string tableName = null; ArrayList scriptureReferenceSet = null; ArrayList scriptureReferenceURISet = null; ScriptureReferenceBookChapterVersePrePost[] scriptureReferenceBookChapterVersePrePost = null; StringBuilder columnSet = null; StringBuilder uriCrosswalkXml = null; StringBuilder uriCrosswalkHtml = null; StringBuilder SQLStatement = null; OleDbConnection oleDbConnection = null; XmlNodeList scriptureReferenceColumnSet = null; scriptureReferenceColumnSet = UtilityXml.SelectNodes ( filenameConfigurationXml, ref exceptionMessage, XPathColumnScriptureReference ); try { oleDbConnection = UtilityDatabase.DatabaseConnectionInitialize ( databaseConnectionString, ref exceptionMessage ); foreach ( DataTable dataTable in dataSet.Tables ) { columnIndexScriptureReference = UtilityDatabase.DataTableColumnIndex ( dataTable, "ScriptureReference" ); if ( columnIndexScriptureReference < 0 ) { continue; } tableName = dataTable.TableName; scriptureReferenceSet = new ArrayList(); scriptureReferenceURISet = new ArrayList(); SQLStatement = new StringBuilder(); if ( tableName.IndexOf("View" ) < 0 ) { boolView = false; SQLStatement.AppendFormat ( InformationSchemaColumnNamePrimaryColumnSQL, tableName ); } else { boolView = true; SQLStatement.AppendFormat ( InformationSchemaColumnNamePrimaryColumnSQL, tableName.Substring(4) ); } #if (DEBUG) System.Console.WriteLine("SQLStatement: {0}", SQLStatement); #endif columnNamePrimary = (string) UtilityDatabase.DatabaseQuery ( databaseConnectionString, ref exceptionMessage, SQLStatement.ToString(), CommandType.Text ); if ( boolView == true ) { columnNamePrimary = String.Concat( tableName.Substring(4), columnNamePrimary ); } #if (DEBUG) System.Console.WriteLine("ColumnNamePrimary: {0}", columnNamePrimary); #endif foreach ( DataColumn dataColumn in dataTable.Columns ) { dataColumnName = dataColumn.ColumnName.Trim(); /* #if (DEBUG) System.Console.WriteLine("Table Name: {0} | ColumnName: {1}", tableName, dataColumnName); #endif */ if ( dataColumnName.IndexOf( ScriptureReferenceURIColumnNamePostfix ) >= 0 ) { continue; } if ( dataColumnName.IndexOf( ScriptureReferenceColumnNamePostfix ) >= 0 ) { scriptureReferenceSet.Add( dataColumnName ); scriptureReferenceColumnName = dataColumnName; scriptureReferenceColumnNameURI = scriptureReferenceColumnName + "URI"; if ( dataTable.Columns.Contains( scriptureReferenceColumnNameURI ) == false ) { /* #if (DEBUG) System.Console.WriteLine("Table Name: {0} | ColumnName: {1}", tableName, scriptureReferenceColumnNameURI); #endif */ scriptureReferenceURISet.Add( scriptureReferenceColumnNameURI ); }//if dataTable.Columns.Contains( scriptureReferenceColumnNameURI ) == false ) }//if ( dataColumnName.IndexOf( ScriptureReferenceColumnNamePostfix ) >= 0 ) }//foreach ( DataColumn dataColumn in dataTable.Columns ) foreach ( object columnName in scriptureReferenceURISet ) { scriptureReferenceColumnNameURI = columnName.ToString().Trim(); dataTable.Columns.Add( scriptureReferenceColumnNameURI ); } foreach ( DataColumn dataColumn in dataTable.Columns ) { dataColumnName = dataColumn.ColumnName.Trim(); /* #if (DEBUG) System.Console.WriteLine("Table Name: {0} | ColumnName: {1}", tableName, dataColumnName); #endif */ }//foreach ( DataColumn dataColumn in dataTable.Columns ) foreach ( DataRow dataRow in dataTable.Rows ) { columnValuePrimary = dataRow[columnNamePrimary].ToString().Trim(); columnSet = new StringBuilder(); /* #if (DEBUG) System.Console.WriteLine("ColumnValuePrimary: {0}", columnValuePrimary); #endif */ foreach ( object columnName in scriptureReferenceSet ) { #if (DEBUG) System.Console.WriteLine("ColumnName: {0}", columnName); #endif scriptureReferenceColumnName = columnName.ToString().Trim(); scriptureReferenceColumnValue = dataRow[scriptureReferenceColumnName].ToString().Trim(); #if (DEBUG) System.Console.WriteLine ( "Scripture Reference Column Name: {0} | Value: {1}", scriptureReferenceColumnName, scriptureReferenceColumnValue ); #endif scriptureReferenceColumnNameURI = scriptureReferenceColumnName + "URI"; if ( scriptureReferenceColumnValue != null && scriptureReferenceColumnValue != string.Empty ) { ScriptureReference.ScriptureReferenceParser ( new string[] { scriptureReferenceColumnValue }, databaseConnectionString, ref exceptionMessage, ref scriptureReferenceBookChapterVersePrePost, ref scriptureReferenceArray, ref uriCrosswalkHtml, ref uriCrosswalkXml );//ScriptureReference.ScriptureReferenceParser() scriptureReferenceURI = uriCrosswalkHtml.ToString(); if ( UtilityDatabase.DataSetTableColumnContains( dataSet, tableName, scriptureReferenceColumnNameURI ) == false ) { UtilityDatabase.DataSetTableColumnAdd( dataSet, tableName, scriptureReferenceColumnNameURI ); dataRow[scriptureReferenceColumnNameURI] = scriptureReferenceURI; continue; }//if ( DataSetTableColumnContains( dataSet, dataTable, scriptureReferenceColumnNameURI ) ) dataRow[scriptureReferenceColumnNameURI] = scriptureReferenceURI; if ( scriptureReferenceURISet.IndexOf( scriptureReferenceColumnNameURI ) >= 0 ) { continue; } if ( columnSet.Length != 0 ) { columnSet.Append(','); } columnSet.AppendFormat ( UtilityDatabase.DatabaseTemplateSQLSet, scriptureReferenceColumnNameURI, scriptureReferenceURI ); /* #if (DEBUG) System.Console.WriteLine("columnSet: {0}", columnSet); #endif */ SQLStatement = new StringBuilder(); SQLStatement.AppendFormat ( UtilityDatabase.DatabaseTemplateSQLUpdateScriptureReferenceURISet, tableName, columnSet, columnNamePrimary, columnValuePrimary ); #if (DEBUG) System.Console.WriteLine("SQL Statement: {0}", SQLStatement.ToString() ); #endif UtilityDatabase.DatabaseNonQuery ( oleDbConnection, ref exceptionMessage, SQLStatement.ToString() ); }//if ( scriptureReferenceColumnValue != null && scriptureReferenceColumnValue != string.Empty ) }//foreach ( object columnName in dataTableColumnName ) }//foreach ( DataRow dataRow in dataTable ) }//foreach ( DataTable dataTable in dataSet ) UtilityDatabase.DatabaseConnectionHouseKeeping ( oleDbConnection, ref exceptionMessage ); }//try catch (OleDbException exception) { //exceptionMessage = exception.Message; exceptionMessage = UtilityEventLog.WriteEntryOleDbErrorCollection( exception ); System.Console.WriteLine("OleDbException: {0}", exceptionMessage); }//catch (OleDbException exception) catch (SecurityException exception) { exceptionMessage = exception.Message; System.Console.WriteLine( "SecurityException: {0}", exception.Message ); }//catch (SecurityException exception) catch (SystemException exception) { exceptionMessage = exception.Message; System.Console.WriteLine( "SystemException: {0}", exception.Message ); }//catch (SystemException exception) catch (Exception exception) { exceptionMessage = exception.Message; System.Console.WriteLine( "Exception: {0}", exception.Message ); }//catch (Exception exception) }//public static void ScriptureReferenceURI()
}//public static void DatabaseQuery() /// <summary>The database query.</summary> /// <param name="databaseConnectionString">The database connection string.</param> /// <param name="exceptionMessage">The exception message.</param> /// <param name="word">The word.</param> /// <param name="scriptureReferenceAssociates">The scripture reference associates.</param> /// <param name="alphabetSequence">The alphabet sequence.</param> /// <param name="scriptureReferenceAlphabetSequence">The scripture reference alphabet sequence.</param> public static void DatabaseQuery ( ref string databaseConnectionString, ref string exceptionMessage, string[] word, string scriptureReferenceAssociates, ref int[] alphabetSequence, ref ScriptureReferenceAlphabetSequence[] scriptureReferenceAlphabetSequence ) { int wordTotal = word.Length; string chapterForward = null; string chapterBackward = null; string scriptureReference = null; string scriptureReferenceChapterBackward = null; string scriptureReferenceChapterForward = null; string scriptureReferenceVerseBackward = null; string scriptureReferenceVerseForward = null; string verseForward = null; string verseBackward = null; OleDbConnection oleDbConnection = null; OleDbCommand oleDbCommand = null; OleDbDataReader oleDbDataReader = null; OleDbParameter oleDbParameterWord = null; OleDbParameter oleDbParameterScriptureReferenceAssociates = null; OleDbParameter oleDbParameterAlphabetSequence = null; OleDbParameter oleDbParameterScriptureReferenceVerseForward = null; OleDbParameter oleDbParameterScriptureReferenceChapterForward = null; OleDbParameter oleDbParameterScriptureReferenceChapterBackward = null; OleDbParameter oleDbParameterScriptureReferenceVerseBackward = null; OleDbParameter oleDbParameterScriptureReference = null; OleDbParameter oleDbParameterVerseForward = null; OleDbParameter oleDbParameterChapterForward = null; OleDbParameter oleDbParameterChapterBackward = null; OleDbParameter oleDbParameterVerseBackward = null; AlphabetSequenceIndexCalculate ( ref word, ref alphabetSequence ); try { if (databaseConnectionString == null) { databaseConnectionString = DatabaseConnectionString; }//if ( databaseConnectionString == null ) oleDbConnection = UtilityDatabase.DatabaseConnectionInitialize ( databaseConnectionString, ref exceptionMessage ); if (oleDbConnection == null || exceptionMessage != null) { return; }//if ( oleDbConnection == null || exceptionMessage != null ) oleDbCommand = new OleDbCommand(SQLSelectAlphabetSequence, oleDbConnection); oleDbCommand.CommandType = CommandType.StoredProcedure; oleDbParameterWord = new OleDbParameter(ParameterWord, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterScriptureReferenceAssociates = new OleDbParameter(ParameterWord, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterAlphabetSequence = new OleDbParameter(ParameterAlphabetSequence, OleDbType.Integer); oleDbParameterScriptureReferenceVerseForward = new OleDbParameter(ParameterScriptureReferenceVerseForward, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterScriptureReferenceChapterForward = new OleDbParameter(ParameterScriptureReferenceChapterForward, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterScriptureReferenceChapterBackward = new OleDbParameter(ParameterScriptureReferenceChapterBackward, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterScriptureReferenceVerseBackward = new OleDbParameter(ParameterScriptureReferenceVerseBackward, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterScriptureReference = new OleDbParameter(ParameterScriptureReference, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterVerseForward = new OleDbParameter(ParameterVerseForward, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterChapterForward = new OleDbParameter(ParameterChapterForward, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterChapterBackward = new OleDbParameter(ParameterChapterBackward, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterVerseBackward = new OleDbParameter(ParameterVerseBackward, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbCommand.Parameters.Add(oleDbParameterWord); oleDbCommand.Parameters.Add(oleDbParameterScriptureReferenceAssociates); oleDbCommand.Parameters.Add(oleDbParameterAlphabetSequence); oleDbCommand.Parameters.Add(oleDbParameterScriptureReferenceVerseForward); oleDbCommand.Parameters.Add(oleDbParameterScriptureReferenceChapterForward); oleDbCommand.Parameters.Add(oleDbParameterScriptureReferenceChapterBackward); oleDbCommand.Parameters.Add(oleDbParameterScriptureReferenceVerseBackward); oleDbCommand.Parameters.Add(oleDbParameterScriptureReference); oleDbCommand.Parameters.Add(oleDbParameterVerseForward); oleDbCommand.Parameters.Add(oleDbParameterChapterForward); oleDbCommand.Parameters.Add(oleDbParameterChapterBackward); oleDbCommand.Parameters.Add(oleDbParameterVerseBackward); oleDbParameterWord.Direction = ParameterDirection.InputOutput; oleDbParameterScriptureReferenceAssociates.Direction = ParameterDirection.InputOutput; oleDbParameterAlphabetSequence.Direction = ParameterDirection.InputOutput; oleDbParameterScriptureReferenceVerseForward.Direction = ParameterDirection.Output; oleDbParameterScriptureReferenceChapterForward.Direction = ParameterDirection.Output; oleDbParameterScriptureReferenceChapterBackward.Direction = ParameterDirection.Output; oleDbParameterScriptureReferenceVerseBackward.Direction = ParameterDirection.Output; oleDbParameterScriptureReference.Direction = ParameterDirection.Output; oleDbParameterVerseForward.Direction = ParameterDirection.Output; oleDbParameterChapterForward.Direction = ParameterDirection.Output; oleDbParameterChapterBackward.Direction = ParameterDirection.Output; oleDbParameterVerseBackward.Direction = ParameterDirection.Output; for (int wordCount = 0; wordCount < wordTotal; ++wordCount) { oleDbParameterWord.Value = word[wordCount]; oleDbParameterScriptureReferenceAssociates.Value = scriptureReferenceAssociates; oleDbParameterAlphabetSequence.Value = alphabetSequence[wordCount]; oleDbCommand.ExecuteScalar(); scriptureReferenceVerseForward = (oleDbParameterScriptureReferenceVerseForward.Value).ToString(); scriptureReferenceChapterForward = (oleDbParameterScriptureReferenceChapterForward.Value).ToString(); scriptureReferenceChapterBackward = (oleDbParameterScriptureReferenceChapterBackward.Value).ToString(); scriptureReferenceVerseBackward = (oleDbParameterScriptureReferenceVerseBackward.Value).ToString(); scriptureReference = (oleDbParameterScriptureReference.Value).ToString(); verseForward = (oleDbParameterVerseForward.Value).ToString(); chapterForward = (oleDbParameterChapterForward.Value).ToString(); chapterBackward = (oleDbParameterChapterBackward.Value).ToString(); verseBackward = (oleDbParameterVerseBackward.Value).ToString(); scriptureReferenceAlphabetSequence[wordCount] = new ScriptureReferenceAlphabetSequence ( word[wordCount], scriptureReferenceAssociates, alphabetSequence[wordCount], scriptureReferenceVerseForward, scriptureReferenceChapterForward, scriptureReferenceChapterBackward, scriptureReferenceVerseBackward, scriptureReference, verseForward, chapterForward, chapterBackward, verseBackward ); return; } //for ( int wordCount = 0; wordCount < word.Length; ++wordCount ) } //try catch (OleDbException exception) { exceptionMessage = UtilityDatabase.DisplayOleDbErrorCollection(exception); System.Console.WriteLine("OleDbException: {0}", exceptionMessage); System.Console.WriteLine("OleDbException: {0}", oleDbParameterAlphabetSequence.Value); return; }//catch (OleDbException exception) catch (Exception exception) { exceptionMessage = exception.Message; System.Console.WriteLine("Exception: {0}", exception.Message); return; }//catch (Exception exception) finally { if (oleDbDataReader != null) { oleDbDataReader.Close(); } UtilityDatabase.DatabaseConnectionHouseKeeping ( oleDbConnection, ref exceptionMessage ); } //finally return; } //AlphabetSequenceDatabaseQuery()