コード例 #1
0
    private Quote SelectQuote()
    {
        Quote  quote    = GetDefaultQuote();
        string fileName = Server.MapPath("App_Data") + "\\Quotes.xml";

        QuoteXml xml = new QuoteXml();

        if (xml.LoadXml(fileName) && xml.QuoteCount > 0)
        {
            switch (selection)
            {
            case SelectionType.Random:
                quote = xml.GetRandomQuote();
                break;

            case SelectionType.Hourly:
                quote = xml.GetHourlyQuote();
                break;

            case SelectionType.Daily:
                quote = xml.GetDailyQuote();
                break;
            }
        }

        return(quote);
    }
コード例 #2
0
    private void AddQuote(Quote quote)
    {
        QuoteXml xml = new QuoteXml();

        xml.LoadXml(fileName);
        xml.AddQuote(quote);
    }
コード例 #3
0
    private void DeleteQuote(int quoteID)
    {
        QuoteXml xml = new QuoteXml();

        xml.LoadXml(fileName);
        xml.DeleteQuote(quoteID);
    }
コード例 #4
0
    private void UpdateQuote(Quote quote)
    {
        QuoteXml xml = new QuoteXml();

        xml.LoadXml(fileName);
        xml.UpdateQuote(quote);
    }