//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;
using System.Web.UI.WebControls;
using CommunityServer.Components;
using CommunityServer.ControlPanel.Controls;
using CommunityServer.ControlPanel.UI;
using CommunityServer.Controls;

namespace CommunityServer.ControlPanel.Tools
{
	/// <summary>
	/// Summary description for UrlRedirectDetails.
	/// </summary>
	public class UrlRedirectDetails : BaseToolsPage
	{
		protected Label UrlID;
		protected Label Url;
		protected Label Description;
		protected Label Impressions;
		protected TextBox TinyUrl;

		private UrlRedirect urlRedirect = null;

		override protected void OnInit(EventArgs e)
		{
			this.Load += new EventHandler(this.Page_Load);
			base.OnInit(e);
		}

		private void Page_Load(object sender, EventArgs e)
		{
			CSContext context = CSContext.Current;
			int urlID = context.GetIntFromQueryString("UrlID", 0);

			Head.AddTitle("Url Redirect", this.Context);

			urlRedirect = CommonDataProvider.Instance().GetUrlRedirect(urlID);
			Bind();
		}

		private void Bind()
		{
			UrlID.Text = urlRedirect.ID.ToString();
			Url.Text = urlRedirect.Url;
			Description.Text = urlRedirect.Description;
			Impressions.Text = urlRedirect.Impressions.ToString();
			TinyUrl.Text = urlRedirect.TinyUrl;
		}
	}
}
