コード例 #1
0
ファイル: Contact.cs プロジェクト: KenAdeniji/WordOfGod
  }//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()
コード例 #2
0
  }//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()   	
コード例 #3
0
  }//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()
コード例 #4
0
  }//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 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()
コード例 #6
0
ファイル: Contact.cs プロジェクト: KenAdeniji/WordOfGod
  }//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()
コード例 #7
0
  }//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>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()
コード例 #9
0
        //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()
コード例 #10
0
  ///<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()
コード例 #11
0
  /// <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()
コード例 #12
0
  }//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
   );
  }	
コード例 #13
0
        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();
        }
コード例 #14
0
  }//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()
コード例 #15
0
	public void ScriptureMark()
	{
		int                                          scriptureReferenceVerseCount                       = -1;
		string                                       exceptionMessage                                   = null;
		string[][]                                   scriptureReferenceArray                            = null;

		StringBuilder                                scriptureReferenceText                             = null;  
		StringBuilder                                uriCrosswalkHtml                                   = null;
		StringBuilder                                uriCrosswalkXml                                    = null;   
		StringBuilder[]                              scriptureReferenceBookChapterVersePrePostCondition = null;
		StringBuilder[]                              scriptureReferenceBookChapterVersePrePostSelect    = null;
		StringBuilder                                scriptureReferenceBookChapterVersePrePostQuery     = null;

		IDataReader                                  iDataReader                                        = null;
		ScriptureReferenceBookChapterVersePrePost[]  scriptureReferenceBookChapterVersePrePost          = null;

		StringBuilder				     scriptureReferenceBookChapterVersePrePostMinMax	= null;									
		ScriptureReference.ConfigurationXml
		(
			filenameConfigurationXml,
			ref exceptionMessage,
			ref databaseConnectionString
		);
		
		ScriptureReference.ScriptureReferenceParser
		(  
			new string[] { ScriptureReferenceSearch },
			databaseConnectionString,
			ref exceptionMessage,
			ref scriptureReferenceBookChapterVersePrePost,
			ref scriptureReferenceArray,
			ref uriCrosswalkHtml,
			ref uriCrosswalkXml
		);
		
		ScriptureReference.ScriptureReferenceQuery
		(
				databaseConnectionString,
			ref exceptionMessage,
			ref scriptureReferenceBookChapterVersePrePost,
			ref iDataReader,
			ref scriptureReferenceVerseCount,
			ref scriptureReferenceText,
			ref scriptureReferenceBookChapterVersePrePostCondition,
			ref scriptureReferenceBookChapterVersePrePostSelect,
			ref scriptureReferenceBookChapterVersePrePostQuery
		);

		if ( iDataReader != null )
		{
			iDataReader.Close();
		}

		DataSet dataSet = new DataSet();
		
		scriptureReferenceBookChapterVersePrePostMinMax = new StringBuilder();
		for (int index = 0; index < scriptureReferenceBookChapterVersePrePostCondition.Length; ++index)
		{
			scriptureReferenceBookChapterVersePrePostMinMax.AppendFormat
			(
				ScriptureReferenceBookChapterVersePrePost.SQLSelectChapterVerseIdSequenceMinimumMaximum,
				scriptureReferenceBookChapterVersePrePostCondition[index]
			); 				
		}

		UtilityDatabase.DatabaseQuery
		(
			databaseConnectionString,
			ref exceptionMessage,
			ref dataSet,
			scriptureReferenceBookChapterVersePrePostMinMax.ToString(),
			CommandType.Text
		);
		
		StringBuilder chapterVerseIdSequenceMinimumMaximum = new StringBuilder();
		
		int verseIdSequenceMinimum , verseIdSequenceMaximum;
		int chapterIdSequenceMinimum, chapterIdSequenceMaximum;

		foreach ( DataTable dataTable in dataSet.Tables )
		{
			foreach ( DataRow dataRow in dataTable.Rows )
			{
				verseIdSequenceMinimum = Convert.ToInt32(dataRow["verseIdSequenceMinimum"]);
				verseIdSequenceMaximum = Convert.ToInt32(dataRow["verseIdSequenceMaximum"]);
				chapterIdSequenceMinimum = Convert.ToInt32(dataRow["chapterIdSequenceMinimum"]);
				chapterIdSequenceMaximum = Convert.ToInt32(dataRow["chapterIdSequenceMaximum"]);

				chapterVerseIdSequenceMinimumMaximum.AppendFormat
				(
					ScriptureReferenceBookChapterVersePrePost.ChapterVerseIdSequenceMinimumMaximumFormat,
					chapterIdSequenceMinimum,
					100 * chapterIdSequenceMinimum / ScriptureReferenceBookChapterVersePrePost.ChapterIdSequenceMaximum,
					verseIdSequenceMinimum,
					100 * verseIdSequenceMinimum / ScriptureReferenceBookChapterVersePrePost.VerseIdSequenceMaximum
				);

				if (verseIdSequenceMinimum != verseIdSequenceMaximum)
				{
					chapterVerseIdSequenceMinimumMaximum.Append("  ");
					chapterVerseIdSequenceMinimumMaximum.AppendFormat
					(
						ScriptureReferenceBookChapterVersePrePost.ChapterVerseIdSequenceMinimumMaximumFormat,
						chapterIdSequenceMaximum,
						100 * chapterIdSequenceMaximum / ScriptureReferenceBookChapterVersePrePost.ChapterIdSequenceMaximum,
						verseIdSequenceMaximum,
						100 * verseIdSequenceMaximum / ScriptureReferenceBookChapterVersePrePost.VerseIdSequenceMaximum
					);
				}

				chapterVerseIdSequenceMinimumMaximum.Append("<br />");
			}
		}			
		
		//Response.Write(chapterVerseIdSequenceMinimumMaximum.ToString());

		ScriptureReferenceResultSet = chapterVerseIdSequenceMinimumMaximum.ToString();					
	}
コード例 #16
0
  }//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()
コード例 #17
0
        }//Main()

        public static void TableProcessURI
        (
            ref OleDbConnection oleDbConnection,
            String selectQuery,
            String filenameHtml,
            String filenameText,
            String filenameXsd,
            String filenameXml,
            String filenameXml2,
            String filenameStylesheet
        )
        {
            DataColumn dataColumnDated   = null;
            DataColumn dataColumnKeyword = null;
            DataColumn dataColumnTitle   = null;
            DataColumn dataColumnURI     = null;
            DataSet    dataSet           = null;
            DataTable  dataTable         = null;

            String exceptionMessage = null;
            String keyword          = null;
            String title            = null;
            String uri = null;
            String xmlProcessingInstructionText = null;

            OleDbCommand oleDbCommand   = null;
            IDataAdapter oleDataAdapter = null;
            IDataReader  dataReader     = null;
            //System.IO.FileStream    fileStream                    =  null;
            TextWriter       objTextWriterHtml = null;
            TextWriter       objTextWriterText = null;
            UniqueConstraint uniqueConstraint  = null;
            Uri         objUri = null;
            XmlNode     xmlNodeDocumentType = null;
            XmlNode     xmlNodeRoot         = null;
            XmlDocument xmlDocument         = null;
            XmlProcessingInstruction xmlProcessingInstruction = null;
            XmlTextWriter            xmlTextWriter            = null;

            try
            {
                UtilityDatabase.DatabaseQuery
                (
                    DatabaseConnectionString,
                    ref exceptionMessage,
                    ref dataSet,
                    selectQuery,
                    CommandType.Text
                );

                dataSet.DataSetName         = "addresses";
                dataSet.Tables[0].TableName = "address";

                UtilityXml.WriteXml
                (
                    dataSet,
                    ref exceptionMessage,
                    ref filenameXml,
                    ref filenameStylesheet
                );
            }//try
            catch (XmlException exception)
            {
                System.Console.WriteLine("Uri: {0} | Exception: {1}", title, exception.Message);
            }//catch
            catch (Exception exception)
            {
                System.Console.WriteLine("Uri: {0} | Exception: {1}", title, exception.Message);
            }//catch
            finally
            {
            } //finally
        }     //TableProcessURI
コード例 #18
0
  ///<summary>CreatePieChart</summary>
  public static void CreatePieChart
  (
   ref String                           databaseConnectionString,
       String                           sqlSelectStatement,
       String                           title,
       int                              pieChartWidth,
   ref DataSet                          dataSet,
   ref String                           exceptionMessage
  )
  {


	int                  iLoop;
    
	float                total = 0.0F;
	float                tmp;

    // we need to create fonts for our legend and title
	Font fontLegend = new Font("Verdana", 10);
	Font fontTitle  = new Font("Verdana", 15, FontStyle.Bold);
	    
    HttpContext          httpContext          = HttpContext.Current;

    UtilityDatabase.DatabaseQuery
    (
           databaseConnectionString,
      ref  exceptionMessage,
      ref  dataSet,
           sqlSelectStatement,
           CommandType.Text
    );

	// find the total of the numeric data
	for (iLoop=0; iLoop < dataSet.Tables[0].Rows.Count; iLoop++)
	{
	 tmp = Convert.ToSingle(dataSet.Tables[0].Rows[iLoop][ColumnNumberData]);
	 total += tmp;
	}
	
	// We need to create a legend and title, how big do these need to be?
	// Also, we need to resize the height for the pie chart, respective to the
	// height of the legend and title
	int legendHeight = fontLegend.Height * (dataSet.Tables[0].Rows.Count+1) + BufferSpace;
	int titleHeight = fontTitle.Height + BufferSpace;
	int height = pieChartWidth + legendHeight + titleHeight + BufferSpace;
	int pieHeight = pieChartWidth;	// maintain a one-to-one ratio

	// Create a rectange for drawing our pie
	Rectangle pieRect = new Rectangle(0, titleHeight, pieChartWidth, pieHeight);

	// Create our pie chart, start by creating an ArrayList of colors
	ArrayList colors = new ArrayList();
	Random rnd = new Random();
	for (iLoop = 0; iLoop < dataSet.Tables[0].Rows.Count; iLoop++)
		colors.Add(new SolidBrush(Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255))));
	
	float currentDegree = 0.0F;

	// Create a Bitmap instance	
	Bitmap objBitmap = new Bitmap(pieChartWidth, height);
	Graphics objGraphics = Graphics.FromImage(objBitmap);

	SolidBrush blackBrush = new SolidBrush(Color.Black);

	// Put a white backround in
	objGraphics.FillRectangle(new SolidBrush(Color.White), 0, 0, pieChartWidth, height);
	for (iLoop = 0; iLoop < dataSet.Tables[0].Rows.Count; iLoop++)
	{
		objGraphics.FillPie((SolidBrush) colors[iLoop], pieRect, currentDegree,
				Convert.ToSingle(dataSet.Tables[0].Rows[iLoop][ColumnNumberData]) / total * 360);

		// increment the currentDegree
		currentDegree += Convert.ToSingle(dataSet.Tables[0].Rows[iLoop][ColumnNumberData]) / total * 360;
	}

	// Create the title, centered
	StringFormat stringFormat = new StringFormat();
	stringFormat.Alignment = StringAlignment.Center;
	stringFormat.LineAlignment = StringAlignment.Center;

	objGraphics.DrawString(title, fontTitle, blackBrush, 
				 new Rectangle(0, 0, pieChartWidth, titleHeight), stringFormat);


	// Create the legend
	objGraphics.DrawRectangle(new Pen(Color.Black, 2), 0, height - legendHeight, pieChartWidth, legendHeight);
	for (iLoop = 0; iLoop < dataSet.Tables[0].Rows.Count; iLoop++)
	{
		objGraphics.FillRectangle((SolidBrush) colors[iLoop], 5, 
			height - legendHeight + fontLegend.Height * iLoop + 5, 10, 10);
		objGraphics.DrawString(((String) dataSet.Tables[0].Rows[iLoop][ColumnNumberLabel]) + " - " + 
				 Convert.ToString(dataSet.Tables[0].Rows[iLoop][ColumnNumberData]), fontLegend, blackBrush, 
				 20, height - legendHeight + fontLegend.Height * iLoop + 1);
	}

	// display the total
	objGraphics.DrawString("Total: " + Convert.ToString(total), fontLegend, blackBrush, 
			 5, height - fontLegend.Height - 5);

	// Since we are outputting a Jpeg, set the ContentType appropriately
	httpContext.Response.ContentType = "image/jpeg";

	// Save the image to a file
	objBitmap.Save(httpContext.Response.OutputStream, ImageFormat.Jpeg);

	// clean up...
    objGraphics.Dispose();
	objBitmap.Dispose();
  }
コード例 #19
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); }
        }
コード例 #20
0
        }//main()

        /// <summary>The dictionary text file.</summary>
        /// <param name="directorynameSource">The directory name, source, for example, ..\\ProjectGutenberg.</param>
        /// <param name="fileSearchPattern">The file search pattern, for example. *.txt.</param>
        public static void DictionaryTextFile
        (
            string directorynameSource,
            string fileSearchPattern
        )
        {
            Boolean dictionaryBeginFlag = false;
            Boolean dictionaryEndFlag   = false;

            int dictionaryId = 0;
            int indexDigit   = -1;
            int referenceId  = -1;
            int thesaurusId  = -1;

            double referenceDouble = 0;

            object commandReturn = null;

            string dictionaryWord     = null;
            string exceptionMessage   = null;
            string filenameDictionary = null;
            string referenceWord      = null;

            string[] thesaurusWord            = null;
            string   thesaurusWordCombination = null;
            string   thesaurusWordCurrentTrim = null;

            StringBuilder sbDictionary           = null;
            StringBuilder SQLStatement           = null;
            ArrayList     arrayListDirectoryname = null;
            ArrayList     arrayListFilename      = null;

            System.Collections.IEnumerator enumeratorFilename = null;

            OleDbConnection oleDbConnection = null;

            oleDbConnection = UtilityDatabase.DatabaseConnectionInitialize
                              (
                DatabaseConnectionString,
                ref exceptionMessage
                              );

            UtilityDatabase.DatabaseNonQuery
            (
                oleDbConnection,
                ref exceptionMessage,
                SQLStatementDictionaryTruncate
            );

            UtilityDirectory.Dir
            (
                ref DirectorynameSource,
                ref fileSearchPattern,
                ref arrayListDirectoryname,
                ref arrayListFilename
            );//UtilityDirectory.Dir

            enumeratorFilename = arrayListFilename.GetEnumerator();

            while (enumeratorFilename.MoveNext())
            {
                filenameDictionary = (string)enumeratorFilename.Current;
                System.Console.WriteLine("{0}", filenameDictionary);
                sbDictionary = new StringBuilder();

                try
                {
                    // Create an instance of StreamReader to read from a file.
                    // The using statement also closes the StreamReader.
                    using (StreamReader sr = new StreamReader(filenameDictionary))
                    {
                        String line;
                        // Read and display lines from the file until the end of
                        // the file is reached.
                        while ((line = sr.ReadLine()) != null)
                        {
                            if (line.Trim().Length == 0)
                            {
                                continue;
                            }
                            if (dictionaryBeginFlag == false)
                            {
                                if (String.Compare(line.Trim(), DictionaryBegin) == 0)
                                {
                                    dictionaryBeginFlag = true;
                                }
                                continue;
                            }
                            else if (dictionaryBeginFlag == true && String.Compare(line.Trim(), DictionaryEnd) == 0)
                            {
                                dictionaryEndFlag = true;
                                break;
                            }
                            if (line[0] != ' ')
                            {
                                dictionaryWord = line.Trim();
                                dictionaryWord = dictionaryWord.Replace("'", "''");
                                SQLStatement   = new StringBuilder();
                                SQLStatement.AppendFormat
                                (
                                    SQLStatementDictionaryInsertWord,
                                    dictionaryWord
                                );
        #if (DEBUG)
                                System.Console.WriteLine("SQL Statement: {0}", SQLStatement.ToString());
        #endif
                                commandReturn = UtilityDatabase.DatabaseQuery
                                                (
                                    oleDbConnection,
                                    ref exceptionMessage,
                                    SQLStatement.ToString(),
                                    CommandType.Text
                                                );
                                if (commandReturn == DBNull.Value)
                                {
                                    dictionaryId = -1;
                                }//if ( commandReturn == DBNull.Value )
                                else
                                {
                                    dictionaryId = System.Convert.ToInt32(commandReturn);
                                } //else if ( commandReturn != DBNull.Value )
                            }     //if ( line[0] != ' ' )
                            else
                            {
                                line       = line.Trim();
                                indexDigit = line.IndexOfAny(DigitsAnyOf);
                                if (indexDigit < 0)
                                {
                                    continue;
                                }
                                referenceWord   = line.Substring(indexDigit);
                                referenceDouble = System.Convert.ToDouble(referenceWord);
                                referenceId     = System.Convert.ToInt32(referenceDouble);

                                thesaurusWordCombination = line.Substring(0, indexDigit - 1);
                                thesaurusWordCombination = thesaurusWordCombination.Trim();
                                thesaurusWord            = thesaurusWordCombination.Split(ThesaurusCombinationDelimiterArray);
                                foreach (String thesaurusWordCurrent in thesaurusWord)
                                {
                                    thesaurusWordCurrentTrim = thesaurusWordCurrent.Trim();
                                    SQLStatement             = new StringBuilder();
                                    SQLStatement.AppendFormat
                                    (
                                        SQLStatementDictionaryInsertWord,
                                        thesaurusWordCurrent.Trim()
                                    );
         #if (DEBUG)
                                    System.Console.WriteLine("SQL Statement: {0}", SQLStatement.ToString());
         #endif

                                    commandReturn = UtilityDatabase.DatabaseQuery
                                                    (
                                        oleDbConnection,
                                        ref exceptionMessage,
                                        SQLStatement.ToString(),
                                        CommandType.Text
                                                    );

                                    if (commandReturn == DBNull.Value)
                                    {
                                        thesaurusId = -1;
                                    }//if ( commandReturn == DBNull.Value )
                                    else
                                    {
                                        thesaurusId = System.Convert.ToInt32(commandReturn);
                                    }//else if ( commandReturn != DBNull.Value )

                                    SQLStatement = new StringBuilder();
                                    SQLStatement.AppendFormat
                                    (
                                        SQLStatementDictionaryInsertReference,
                                        dictionaryId,
                                        thesaurusId,
                                        referenceId
                                    );
         #if (DEBUG)
                                    System.Console.WriteLine("SQL Statement: {0}", SQLStatement.ToString());
         #endif
                                    UtilityDatabase.DatabaseNonQuery
                                    (
                                        oleDbConnection,
                                        ref exceptionMessage,
                                        SQLStatement.ToString()
                                    );
                                } //foreach ( String thesaurusWordCurrent in thesaurusWord )
                            }     //else
                        }         //while ((line = sr.ReadLine()) != null)
                    }             //using (StreamReader sr = new StreamReader("filenameDictionary"))
                }                 //try
                catch (Exception e)
                {
                    System.Console.WriteLine(e.Message);
                } //catch (Exception e)
            }     //while ( enumeratorFilename.MoveNext() )

            UtilityDatabase.DatabaseConnectionHouseKeeping
            (
                oleDbConnection,
                ref exceptionMessage
            );
        }//DictionaryTextFile()
コード例 #21
0
        }//public static void FileImport()

        /// <summary>Query.</summary>
        public static void Query
        (
            ref String databaseConnectionString,
            ref String exceptionMessage,
            ref InternetDictionaryProjectIDPArgument internetDictionaryProjectIDPArgument,
            ref StringBuilder internetDictionaryProjectIDPSQL,
            ref StringBuilder internetDictionaryProjectIDPQuery,
            ref IDataReader iDataReader
        )
        {
            String internetDictionaryProjectIDPResult       = null;
            Type   typeInternetDictionaryProjectIDPArgument = internetDictionaryProjectIDPArgument.GetType();

            UtilityProperty.TypeInformation
            (
                internetDictionaryProjectIDPArgument,
                ref typeInternetDictionaryProjectIDPArgument,
                ref internetDictionaryProjectIDPQuery,
                ref DictionaryLanguageSQLQuery
            );

            internetDictionaryProjectIDPSQL = new StringBuilder(SQLStatementDictionarySelect);

            internetDictionaryProjectIDPSQL.Append(SQLStatementDictionaryFrom);

            if (internetDictionaryProjectIDPQuery != null)
            {
                internetDictionaryProjectIDPSQL.Append(SQLStatementDictionaryWhere);
                internetDictionaryProjectIDPSQL.Append(internetDictionaryProjectIDPQuery);
            }//if ( internetDictionaryProjectIDPQuery != null )

            internetDictionaryProjectIDPSQL.Append(SQLStatementDictionaryOrder);

            UtilityDebug.Write(internetDictionaryProjectIDPSQL);

            try
            {
                UtilityDatabase.DatabaseQuery
                (
                    databaseConnectionString,
                    ref exceptionMessage,
                    ref iDataReader,
                    internetDictionaryProjectIDPSQL.ToString(),
                    CommandType.Text
                );

    #if (DEBUG)
                while (iDataReader.Read())
                {
                    internetDictionaryProjectIDPResult = String.Format
                                                         (
                        SQLStatementDictionaryFormat,
                        iDataReader.GetValue(0),
                        iDataReader.GetValue(1),
                        iDataReader.GetValue(2),
                        iDataReader.GetValue(3),
                        iDataReader.GetValue(4),
                        iDataReader.GetValue(5),
                        iDataReader.GetValue(6)
                                                         );

                    UtilityDebug.Write(internetDictionaryProjectIDPResult);
                } //while( iDataReader.Read() )
    #endif
            }     //try
            catch (Exception exception)
            {
                System.Console.WriteLine("Exception: {0}", exception.Message);
            } //catch (Exception exception)
        }     //public static void Query()
コード例 #22
0
  }//Main  

  /// <summary>DatabaseSelect</summary>
  public static void DatabaseSelect
  (
   ref string                databaseConnectionString,
   ref UtilityImageArgument  utilityImageArgument,
   ref string                exceptionMessage,
   ref HtmlInputFile         htmlInputFileSource
  )
  {
   
   HttpContext      httpContext                   =  HttpContext.Current;
   
   string           filenameSource                =  null;
   string           sqlSelectStatement            =  null;

   IDataReader      iDataReader                   =  null;
   
   try
   {

    filenameSource       =  htmlInputFileSource.Value;
    
    sqlSelectStatement   = "SELECT ImageCarbonFormMatch, ImageType FROM ImageCarbonForm WHERE URIImage = '" 
                           + filenameSource 
                           + "'";
                           
    UtilityDatabase.DatabaseQuery
    (
         databaseConnectionString,
     ref exceptionMessage,
     ref iDataReader,
     sqlSelectStatement,
     CommandType.Text
    );

    if ( iDataReader.Read() )
    {
     httpContext.Response.ContentType = iDataReader["ImageType"].ToString();
     httpContext.Response.BinaryWrite( (byte[]) iDataReader["ImageCarbonFormMatch"] );
    }//if ( iDataReader.Read() )
    
   }//try
   catch ( Exception exception )
   {
    exceptionMessage = "Exception: " + exception.Message;
   }//catch ( Exception exception )
   finally
   {
   	if ( iDataReader != null )
   	{
     iDataReader.Close();
    }//if ( iDataReader != null )         		
   }//finally   	
   
   if ( exceptionMessage != null )
   {
    if ( httpContext == null )
    {
     System.Console.WriteLine( exceptionMessage );
    }//if ( httpContext == null )
    else
    {
     //httpContext.Response.Write( exceptionMessage );
    }//else 
   }//if ( exceptionMessage != null )

  }//public static void DatabaseSelect()
コード例 #23
0
        }//public static void Query()

        /// <summary>Query.</summary>
        public static void Query
        (
            ref String connectionStringDatabase,
            ref String connectionStringFormatIndexingService,
            ref StringBuilder connectionStringIndexingService,
            ref String exceptionMessage,
            ref UtilityIndexingServiceArgument utilityIndexingServiceArgument,
            ref StringBuilder catalogQuery,
            ref IDataReader iDataReader,
            ref DataSet dataSet
        )
        {
            String      indexingServiceResult = null;
            HttpContext httpContext           = HttpContext.Current;

            utilityIndexingServiceArgument.catalogName    = utilityIndexingServiceArgument.CatalogName;
            utilityIndexingServiceArgument.freeTextSearch = utilityIndexingServiceArgument.FreeTextSearch;

            connectionStringIndexingService = new StringBuilder();
            connectionStringIndexingService.AppendFormat
            (
                connectionStringFormatIndexingService,
                utilityIndexingServiceArgument.catalogName
            );

   #if (DEBUG)
            System.Console.WriteLine
            (
                "Connection String Indexing Service: {0}",
                connectionStringIndexingService
            );
   #endif

            catalogQuery = new StringBuilder();
            catalogQuery.AppendFormat
            (
                CatalogQueryFormat,
                utilityIndexingServiceArgument.freeTextSearch
            );

            try
            {
                UtilityDatabase.DatabaseQuery
                (
                    connectionStringIndexingService.ToString(),
                    ref exceptionMessage,
                    ref iDataReader,
                    catalogQuery.ToString(),
                    CommandType.Text
                );

                UtilityDatabase.DatabaseQuery
                (
                    connectionStringIndexingService.ToString(),
                    ref exceptionMessage,
                    ref dataSet,
                    catalogQuery.ToString(),
                    CommandType.Text
                );

    #if (DEBUG)
                while (iDataReader.Read())
                {
                    indexingServiceResult = String.Format
                                            (
                        IndexingServiceResultFormat,
                        iDataReader.GetString(0),
                        iDataReader.GetString(1),
                        iDataReader.GetString(2)
                                            );
                    if (httpContext == null)
                    {
                        System.Console.WriteLine(indexingServiceResult);
                    }//if ( httpContext == null )
                    else
                    {
                        //httpContext.Response.Write(indexingServiceResult);
                    } //else if ( httpContext == null )
                }     //while( iDataReader.Read() )
    #endif
            }         //try
            catch (Exception exception)
            {
                System.Console.WriteLine("Exception: {0}", exception.Message);
            } //catch (Exception exception)
        }     //public static void Query()
コード例 #24
0
        ///<summary>RenderImage</summary>
        public static void RenderImage
        (
            ref string databaseConnectionString,
            ref string exceptionMessage,
            ref int sequenceOrderId,
            ref string dataSource,
            ref string contentColumn,
            ref string sourceColumn,
            ref string typeColumn,
            ref byte[]  imageContent,
            ref string imageSource,
            ref string imageType
        )
        {
            HttpContext httpContext = HttpContext.Current;
            string      sqlQuery    = null;
            IDataReader iDataReader = null;

            try
            {
                if (httpContext == null)
                {
                    return;
                }
                sqlQuery = string.Format
                           (
                    RenderImageQueryFormat,
                    contentColumn,
                    sourceColumn,
                    typeColumn,
                    dataSource,
                    sequenceOrderId
                           );
                UtilityDatabase.DatabaseQuery
                (
                    databaseConnectionString,
                    ref exceptionMessage,
                    ref iDataReader,
                    sqlQuery,
                    CommandType.Text
                );
                if (exceptionMessage != null)
                {
                    return;
                }
                if (iDataReader.Read())
                {
                    imageContent = ( byte[] )iDataReader[contentColumn];
                    imageSource  = ( string )iDataReader[sourceColumn];
                    imageType    = ( string )iDataReader[typeColumn];
                    UtilityResponse.ResponseOutputStreamWrite
                    (
                        ref imageContent,
                        ref imageSource,
                        ref imageType,
                        ref exceptionMessage
                    );
                } //if ( iDataReader.Read() )
            }     //try
            catch (Exception exception) { UtilityException.ExceptionLog(exception, exception.GetType().Name, ref exceptionMessage); }
            if (iDataReader != null && iDataReader.IsClosed == false)
            {
                iDataReader.Close();
            }
        }
コード例 #25
0
        }//DictionaryTextFile()

        ///<summary>Search: Display the number of results.</summary>
        ///<param name="dictionaryWord">The dictionary word.</param>
        ///<param name="exceptionMessage">The exception message.</param>
        ///<param name="sbResultElement">The result element.</param>
        public static void Search
        (
            string dictionaryWord,
            ref string exceptionMessage,
            ref StringBuilder sbResultElement
        )
        {
            int dictionaryIdFirst        = -1;
            int dictionaryIdFirstCurrent = -1;

            DataSet         dataSet         = null;
            HttpContext     httpContext     = HttpContext.Current;
            OleDbConnection oleDbConnection = null;

            string dictionaryWordFirst  = null;
            string dictionaryWordSecond = null;

            StringBuilder sbSynonym    = null;
            StringBuilder SQLStatement = null;

            sbResultElement = new StringBuilder();

            oleDbConnection = UtilityDatabase.DatabaseConnectionInitialize
                              (
                DatabaseConnectionString,
                ref exceptionMessage
                              );

            SQLStatement = new StringBuilder();
            SQLStatement.AppendFormat
            (
                SQLStatementDictionarySelect,
                dictionaryWord
            );

   #if (DEBUG)
            System.Console.WriteLine("SQL Statement: {0}", SQLStatement.ToString());
   #endif

            UtilityDatabase.DatabaseQuery
            (
                DatabaseConnectionString,
                ref exceptionMessage,
                ref dataSet,
                SQLStatement.ToString(),
                CommandType.Text
            );

            if (httpContext != null && exceptionMessage != null)
            {
                httpContext.Response.Write(exceptionMessage);
            }//if ( httpContext != null )

            foreach (DataTable dataTable in dataSet.Tables)
            {
                /*
                 * dictionaryIdFirstCurrent = (int) UtilityDatabase.DataSetTableRowColumn
                 * (
                 * dataSet,
                 * dataTable.TableName,
                 * 0,
                 * DatabaseColumnSelect[DatabaseColumnRankDictionaryIdFirst]
                 * );
                 */

                sbSynonym = new StringBuilder();

                foreach (DataRow dataRow in dataTable.Rows)
                {
                    dictionaryIdFirst    = (int)dataRow[DatabaseColumnSelect[DatabaseColumnRankDictionaryIdFirst]];
                    dictionaryWordFirst  = (string)dataRow[DatabaseColumnSelect[DatabaseColumnRankDictionaryWordFirst]];
                    dictionaryWordSecond = (string)dataRow[DatabaseColumnSelect[DatabaseColumnRankDictionaryWordSecond]];

                    if (dictionaryIdFirst != dictionaryIdFirstCurrent)
                    {
                        dictionaryIdFirstCurrent = dictionaryIdFirst;

                        sbResultElement.AppendFormat
                        (
                            FormatDictionaryWord,
                            dictionaryWordFirst
                        );

                        sbResultElement.AppendFormat
                        (
                            FormatDictionarySynonym,
                            dictionaryWordSecond
                        );
                    }//if ( dictionaryIdFirst != dictionaryIdFirstCurrent )
                    else
                    {
                        sbResultElement.Append(", " + dictionaryWordSecond);
                    }
                } //foreach(DataRow dataRow in dataTable.Rows)
            }     //foreach(DataTable dataTable in dataSet.Tables)

   #if (DEBUG)
            System.Console.WriteLine("{0}", sbResultElement);
   #endif
        }//Search()
コード例 #26
0
ファイル: WordSearch.cs プロジェクト: KenAdeniji/WordOfGod2
  }//DatabaseQuery
  	
  /// <summary>Database Query.</summary>
  /// <param name="databaseConnectionString">The database connection string, for example, "Provider=SQLOLEDB;Data Source=localhost;user id=WordEngineering;password=WordEngineering;Initial Catalog=Bible;"</param>  
  /// <param name="exceptionMessage">The exception message.</param>
  /// <param name="iDataReader">The IDataReader.</param>    
  /// <param name="word">The word to find.</param>
  /// <param name="findVersesContaining">All Words = 0, Any Word = 1, Phrase = 2</param>
  /// <param name="bibleBookIdMinimum">The search should begin from this particular bible book.</param>
  /// <param name="bibleBookIdMaximum">The search should end in this particular bible book.</param>
  /// <param name="scriptureReference">The scripture reference.</param>
  /// <param name="bibleBookClassification">The bible book classification Ids.</param>  
  public static void DatabaseQuery
  (
       string                    databaseConnectionString,
   ref string                    exceptionMessage,
   ref IDataReader           iDataReader,
       string                    word,
       FindVersesContaining      findVersesContaining,
       int                       bibleBookIdMinimum,
       int                       bibleBookIdMaximum,   
       ScriptureReference[]      scriptureReference,
       BibleBookClassification[] bibleBookClassification
  )
  {
   
   int            wordCount                           = 0;
   int            wordTotal                           = 0;
   
   string         wordDelimiter                       = null;
   string[]       wordSplit                           = null;

   ArrayList      arrayListClassificationBibleBookId  = null;
   
   StringBuilder  SQLStatement                        = null;
   StringBuilder  WhereWord                           = null;
   StringBuilder  WhereBookId                         = null;
   StringBuilder  WhereBookClassification             = null;
   
   SQLStatement = new StringBuilder( SQLStatementSelect );
   SQLStatement.Append( DatabaseColumnNameScriptureReference );
   SQLStatement.Append( "," );
   SQLStatement.Append( DatabaseColumnNameVerseText );
   SQLStatement.Append( SQLStatementFrom );
   SQLStatement.Append( " " );
   SQLStatement.Append( DatabaseTableName );
   SQLStatement.Append( " " );   
   SQLStatement.Append( SQLStatementSelectLock );   

   if ( word != null )
   {
    switch(findVersesContaining)
    {         
     case FindVersesContaining.allWords:   
      wordDelimiter = " AND ";
      break;
     
     case FindVersesContaining.anyWords:
      wordDelimiter = " OR ";
      break;
     
     case FindVersesContaining.phrase:
      wordDelimiter = null;
      break;
    }//switch(findVersesContaining) 

    word = word.Trim();
   
    if ( findVersesContaining == FindVersesContaining.allWords || findVersesContaining == FindVersesContaining.anyWords )
    {
     wordSplit = word.Split( StringDelimiterCharacterArray );
     wordTotal = wordSplit.Length;
     WhereWord = new StringBuilder(); 	
     WhereWord.Append( " ( " );     
     for ( wordCount = 0; wordCount < wordTotal; ++wordCount )
     {
      WhereWord.Append( DatabaseColumnNameVerseText );	
      WhereWord.Append( " LIKE '%" );
      WhereWord.Append( wordSplit[wordCount] );    
      WhereWord.Append( "%'" );
      if ( wordCount + 1 < wordTotal )
      {
       WhereWord.Append( wordDelimiter );	
      }//if ( wordCount + 1 < wordTotal )
     }//for ( wordCount = 0; wordCount < wordTotal; ++wordCount )	
     WhereWord.Append( " ) " );     
    }//if ( findVersesContaining == FindVersesContainingAllWords or findVersesContaining == FindVersesContainingAnyWords )
   
    if ( findVersesContaining == FindVersesContaining.phrase )
    {
     WhereWord = new StringBuilder(); 	
     WhereWord.Append( " ( " );
     WhereWord.Append( DatabaseColumnNameVerseText );	
     WhereWord.Append( " LIKE '%" );
     WhereWord.Append( word );    
     WhereWord.Append( "%' ) " );
    }//if ( findVersesContaining == FindVersesContainingPhrase )
   }//if ( word != null ) 
   
   if ( bibleBookIdMinimum > 1 || bibleBookIdMaximum < 66 )
   {
    WhereBookId  = new StringBuilder();
    WhereBookId.Append(" ( bookId BETWEEN ");
    WhereBookId.Append(bibleBookIdMinimum);
    WhereBookId.Append(" AND ");
    WhereBookId.Append(bibleBookIdMaximum);
    WhereBookId.Append(" ) ");
   } 

   if ( bibleBookClassification != null )
   {
    int bibleBookClassificationTotal = 0;
    WhereBookClassification = new StringBuilder();
    arrayListClassificationBibleBookId = BibleBookClassification.BibleBookIds( bibleBookClassification );
    bibleBookClassificationTotal = arrayListClassificationBibleBookId.Count;
    WhereBookClassification.Append(" bookId IN ( ");
    for ( int i = 0; i < bibleBookClassificationTotal; ++i )
    {
     WhereBookClassification.Append( arrayListClassificationBibleBookId[i] );
     if ( i + 1 < bibleBookClassificationTotal )
     {
      WhereBookClassification.Append( "," );
     }//if ( i + 1 < bibleBookClassificationTotal ) 
    }//for ( int i = 0; i < bibleBookClassificationTotal; ++i )    
    WhereBookClassification.Append(" ) ");    
   }//if ( bibleBookClassification != null ) 

   if ( WhereWord != null || WhereBookId != null || WhereBookClassification != null ) 
   {
    bool appendAnd = false;	
    SQLStatement.Append( SQLStatementSelectWhere );
    if ( WhereWord != null )
    {
     SQLStatement.Append( WhereWord );
     appendAnd = true;
    }//if ( WhereWord != null )	
    if ( WhereBookId != null )
    {
     if ( appendAnd )
     {
      SQLStatement.Append( " AND " );
     } 
     SQLStatement.Append( WhereBookId );
     appendAnd = true;
    }//if ( WhereBookId != null )	
    if ( WhereBookClassification != null )
    {
     if ( appendAnd )
     {
      SQLStatement.Append( " AND " );
     } 
     SQLStatement.Append( WhereBookClassification );
     appendAnd = true;
    }//if ( WhereBookClassification != null )	
   }//if ( WhereWord != null or WhereBookId != null or WhereBookClassification != null ) 	
   SQLStatement.Append(SQLStatementSelectOrderBy);
   UtilityDatabase.DatabaseQuery
   ( 
        databaseConnectionString, 
    ref exceptionMessage, 
    ref iDataReader,
        SQLStatement.ToString(), 
        CommandType.Text
   );
   
   System.Console.WriteLine("SQLStatement: {0}", SQLStatement);
   
  }//public static DatabaseQuery()
コード例 #27
0
  }//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()
コード例 #28
0
        public static void Main(string[] argv)
        {
            int    scriptureReferenceVerseCount = -1;
            string exceptionMessage             = null;
            string scriptureReference           = null;

            string[][] scriptureReferenceArray = null;

            StringBuilder scriptureReferenceText = null;
            StringBuilder uriCrosswalkHtml       = null;
            StringBuilder uriCrosswalkXml        = null;

            StringBuilder[] scriptureReferenceBookChapterVersePrePostCondition = null;
            StringBuilder[] scriptureReferenceBookChapterVersePrePostSelect    = null;
            StringBuilder   scriptureReferenceBookChapterVersePrePostQuery     = null;

            IDataReader iDataReader = null;

            ScriptureReferenceBookChapterVersePrePost[] scriptureReferenceBookChapterVersePrePost = null;

            if (argv.Length < 1)
            {
                return;
            }
            else
            {
                scriptureReference = argv[0];
            }

            ScriptureReference.ConfigurationXml
            (
                filenameConfigurationXml,
                ref exceptionMessage,
                ref DatabaseConnectionString
            );

            System.Console.WriteLine(DatabaseConnectionString);

            ScriptureReference.ScriptureReferenceParser
            (
                new string[] { scriptureReference },
                DatabaseConnectionString,
                ref exceptionMessage,
                ref scriptureReferenceBookChapterVersePrePost,
                ref scriptureReferenceArray,
                ref uriCrosswalkHtml,
                ref uriCrosswalkXml
            );

            ScriptureReference.ScriptureReferenceQuery
            (
                DatabaseConnectionString,
                ref exceptionMessage,
                ref scriptureReferenceBookChapterVersePrePost,
                ref iDataReader,
                ref scriptureReferenceVerseCount,
                ref scriptureReferenceText,
                ref scriptureReferenceBookChapterVersePrePostCondition,
                ref scriptureReferenceBookChapterVersePrePostSelect,
                ref scriptureReferenceBookChapterVersePrePostQuery
            );

            if (iDataReader != null)
            {
                iDataReader.Close();
            }

            DataSet dataSet = new DataSet();

            UtilityDatabase.DatabaseQuery
            (
                DatabaseConnectionString,
                ref exceptionMessage,
                ref dataSet,
                scriptureReferenceBookChapterVersePrePostQuery.ToString(),
                CommandType.Text
            );

            StringBuilder sbScriptureReferenceVerseText = new StringBuilder();

            foreach (DataTable dataTable in dataSet.Tables)
            {
                foreach (DataRow dataRow in dataTable.Rows)
                {
                    sbScriptureReferenceVerseText.Append(dataRow["verseText"]);
                }
            }

            System.Console.WriteLine(sbScriptureReferenceVerseText);

            SpVoice spVoice = new SpVoice();

            spVoice.Speak
            (
                sbScriptureReferenceVerseText.ToString(),
                SpeechVoiceSpeakFlags.SVSFlagsAsync
            );
            spVoice.WaitUntilDone(Timeout.Infinite);
        }
コード例 #29
0
  }//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()
コード例 #30
0
        }//DictionaryTextFile()

        ///<summary>Search: Display the number of results.</summary>
        ///<param name="dictionaryWord">The dictionary word.</param>
        ///<param name="exceptionMessage">The exception message.</param>
        ///<param name="sbResultElement">The result element.</param>
        public static void Search
        (
            String dictionaryWord,
            ref String exceptionMessage,
            ref StringBuilder sbResultElement
        )
        {
            DataSet         dataSet         = null;
            HttpContext     httpContext     = HttpContext.Current;
            OleDbConnection oleDbConnection = null;
            StringBuilder   SQLStatement    = null;

            sbResultElement = new StringBuilder();

            oleDbConnection = UtilityDatabase.DatabaseConnectionInitialize
                              (
                DatabaseConnectionString,
                ref exceptionMessage
                              );

            SQLStatement = new StringBuilder();
            SQLStatement.AppendFormat
            (
                SQLStatementDictionarySelect,
                dictionaryWord
            );

   #if (DEBUG)
            System.Console.WriteLine("SQL Statement: {0}", SQLStatement.ToString());
   #endif

            UtilityDatabase.DatabaseQuery
            (
                DatabaseConnectionString,
                ref exceptionMessage,
                ref dataSet,
                SQLStatement.ToString(),
                CommandType.Text
            );

            if (httpContext != null && exceptionMessage != null)
            {
                httpContext.Response.Write(exceptionMessage);
            }//if ( httpContext != null )

            foreach (DataTable dataTable in dataSet.Tables)
            {
                sbResultElement.Append("<TABLE align='center'>");
                foreach (DataRow dataRow in dataTable.Rows)
                {
                    sbResultElement.Append("<TR>");

                    /*
                     * foreach (DataColumn dataColumn in dataTable.Columns)
                     * {
                     * sbResultElement.AppendFormat
                     * (
                     * HTMLTableColumn,
                     * dataRow[dataColumn]
                     * );
                     * }//foreach (DataColumn dataColumn in dataTable.Columns)
                     */
                    sbResultElement.AppendFormat
                    (
                        HTMLTableColumn,
                        dataRow["Commentary"]
                    );
                    sbResultElement.Append("</TR>");
                } //foreach(DataRow dataRow in dataTable.Rows)
                sbResultElement.Append("</TABLE>");
            }     //foreach(DataTable dataTable in dataSet.Tables)

   #if (DEBUG)
            System.Console.WriteLine("{0}", sbResultElement);
   #endif
        }//Search()