Disclaimer/Info#region Disclaimer/Info /**//////////////////////////////////////////////////////////////////////////////////////////////////// // .Text WebLog // // .Text is an open source weblog system started by Scott Watermasysk. // Blog: http://ScottWater.com/blog // RSS: http://scottwater.com/blog/rss.aspx // Email: Dottext@ScottWater.com // // For updated news and information please visit http://scottwater.com/dottext and subscribe to // the Rss feed @ http://scottwater.com/dottext/rss.aspx // // On its release (on or about August 1, 2003) this application is licensed under the BSD. However, I reserve the // right to change or modify this at any time. The most recent and up to date license can always be fount at: //http://ScottWater.com/License.txt // // Please direct all code related questions to: // GotDotNet Workspace: http://www.gotdotnet.com/Community/Workspaces/workspace.aspx?id=e99fccb3-1a8c-42b5-90ee-348f6b77c407 // Yahoo Group http://groups.yahoo.com/group/DotText/ // /**//////////////////////////////////////////////////////////////////////////////////////////////////// #endregion using System; using System.Configuration; using System.Collections; using System.ComponentModel; using System.Data; using System.Data.SqlClient; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using Dottext.Framework.Data; using Dottext.Framework.Components; using Dottext.Framework; using Dottext.Framework.Util; using Dottext.Framework.Configuration; namespace Dottext.Web { /**////<summary> /// Summary description for _default. ///</summary> publicclass _default : System.Web.UI.Page { protected System.Web.UI.WebControls.Repeater Bloggers; protected System.Web.UI.WebControls.Literal BlogCount; protected System.Web.UI.WebControls.Literal PostCount; protected System.Web.UI.WebControls.Literal StoryCount; protected System.Web.UI.WebControls.Literal CommentCount; protected System.Web.UI.WebControls.Literal PingtrackCount; protected System.Web.UI.WebControls.Repeater RecentPosts; protected System.Web.UI.WebControls.HyperLink HyperLink1; protected System.Web.UI.WebControls.HyperLink OpmlLink; protected System.Web.UI.WebControls.HyperLink RssLink; protected System.Web.UI.WebControls.HyperLink TitleLink; protected System.Web.UI.WebControls.Literal Style; protected System.Web.UI.WebControls.HyperLink Hyperlink6; protected System.Web.UI.WebControls.HyperLink Hyperlink7; protected System.Web.UI.WebControls.HyperLink Hyperlink4; protected System.Web.UI.WebControls.HyperLink Hyperlink5; protected Literal TitleTag; privatevoid Page_Load(object sender, System.EventArgs e) { TitleTag.Text = TitleLink.Text = ConfigurationSettings.AppSettings["AggregateTitle"] asstring; TitleLink.NavigateUrl = ConfigurationSettings.AppSettings["AggregateUrl"] asstring; //No postbacks on this page. It is output cached. BindData(); SetStyle(); } protectedstring GetEntryUrl(string host, string app, string entryName, DateTime dt) { returnstring.Format("{0}archive/{1}/{2}.aspx",GetFullUrl(host,app),dt.ToString("yyyy/MM/dd"),entryName); } privatevoid SetStyle() { conststring style ="<LINK href="{0}{1}" type="text/css" rel="stylesheet">"; string apppath = Request.ApplicationPath.EndsWith("/") ? Request.ApplicationPath : Request.ApplicationPath +"/"; Style.Text =string.Format(style,apppath,"Style.css") +""+string.Format(style,apppath,"blue.css"); } privatestring appPath =null; conststring fullUrl ="http://{0}{1}{2}/"; protectedstring GetFullUrl(string host, string app) { if(appPath ==null) { appPath = Request.ApplicationPath; if(!appPath.ToLower().EndsWith("/")) { appPath +="/"; } } returnstring.Format(fullUrl,host,appPath,app); } privatevoid BindData() { int GroupID =1; if(Request.QueryString["GroupID"] !=null) { try { GroupID = Int32.Parse(Request.QueryString["GroupID"]); } catch{} } string sql ="DNW_HomePageData"; string conn = Dottext.Framework.Providers.DbProvider.Instance().ConnectionString; SqlParameter[] p = { SqlHelper.MakeInParam("@Host",SqlDbType.NVarChar,100,ConfigurationSettings.AppSettings["AggregateHost"] asstring), SqlHelper.MakeInParam("@GroupID",SqlDbType.Int,4,GroupID) }; DataSet ds = SqlHelper.ExecuteDataset(conn,CommandType.StoredProcedure,sql,p); Bloggers.DataSource = ds.Tables[0]; RecentPosts.DataSource = ds.Tables[1]; DataTable dtCounts = ds.Tables[2]; if(dtCounts !=null) { DataRow dr = dtCounts.Rows[0]; BlogCount.Text = dr["BlogCount"].ToString(); PostCount.Text = dr["PostCount"].ToString(); StoryCount.Text = dr["StoryCount"].ToString(); CommentCount.Text = dr["CommentCount"].ToString(); PingtrackCount.Text = dr["PingtrackCount"].ToString(); } Bloggers.DataBind(); RecentPosts.DataBind(); ds.Clear(); ds.Dispose(); } protectedstring FormatDate(string date) { DateTime dt = DateTime.Parse(date); return dt.ToString("MMddyyyy"); } Web Form Designer generated code#region Web Form Designer generated code overrideprotectedvoid OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /**////<summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. ///</summary> privatevoid InitializeComponent() { this.Load +=new System.EventHandler(this.Page_Load); } #endregion } }