using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class include_Webnote : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            Shownote();
        }
    }
    private void Shownote()
    {
        SqlDataReader dr = Getnote();
        if (dr.Read())
        {
            string mystr = dr["Content"].ToString();
            mystr=mystr.Replace(" ", "&nbsp;&nbsp;");
            mystr = mystr.Replace("\r\n", "</br>");
            lblNote.Text = "<marquee behavior='loop' scrollDelay='100' scrollAmount='3'direction='up' onmouseout=this.start() onmouseover=this.stop() style='font-size: 9pt; line-height:12pt;color:black'>" + mystr + "</marquee>";
         
        }
    }
    public SqlDataReader Getnote()
    {
        SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["MYCONNECTIONSTRING"].ConnectionString);
        string cmdText = "SELECT * FROM Webnote ORDER BY Showorder DESC";
        SqlCommand myCommand = new SqlCommand(cmdText, myConnection);
        SqlDataReader dr = null;
        try
        {
            myConnection.Open();
            dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
        }
        catch (SqlException ex)
        {
            throw new Exception(ex.Message, ex);
        }
        return dr;
    }
}
