Display tip on home page by day number in asp.net
<p><strong>Scenario:</strong>.I have 30 tips in xml file, now I want to display it on home page by day number.</p>

<p>For example, today is the 12th then tip number 12 will be displayed on the home page and after that 13 and so on. After 30 tips it will start from tip 1.</p>

<p>I have tried following code</p>

<pre><code>public class TipReader
{
    private const string TIP_XML_PATH = @"C:\temp\tips.xml";
    public static int GetTipNumber()
    {
        int tipNo = 1;
        if (DateTime.Now.Day &gt;0)
        {
            if (DateTime.Now.Day == 31)
            {
                tipNo = 1;
            }
            else if (DateTime.Now.Day == 28)
            {
                tipNo = DateTime.Now.Day + 1;
            }
            else
            {
                tipNo = DateTime.Now.Day;
            }
        }
        return tipNo;
    }
    public IEnumerable&lt;Tip&gt; GetTipByID(string ID)
    {
        var result = from tip in XDocument.Load(TIP_XML_PATH).Descendants("Tip")
                     where (string)tip.Element("ID")==ID
                     select new Tip
                     {
                         ImageUrl = (string)tip.Element("ImageUrl"),
                         Title = (string)tip.Element("Title").Value,
                         Desciption = (string)tip.Element("Description"),
                     };
        return result;
    }
}
</code></pre>

<p>Now, I am facing issue on GetTipNumber. How would I handle date greater than 30 and less than 30.
<strong>If you have better solution for this please suggest me.</strong>
Thanks in advance</p>
