ViewDetaill.cs

using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using DotNetNuke;
using System.Web.UI;
using System.Reflection;

namespace CEL.Modules.CELLibrary
{
	partial class ViewDetaill : Entities.Modules.PortalModuleBase
	{

		protected void Page_Load(object sender, System.EventArgs e)
		{
			if (IsPostBack == true)
				return;
			LocalizeSetting();
			if (!string.IsNullOrEmpty(Request.QueryString("LibraryID")))
				loadLibraryData(Conversion.Val(Request.QueryString("LibraryID")));
		}
		public void loadLibraryData(int LibraryID)
		{
			CELLibraryController objLibraryCon = new CELLibraryController();

			DataTable dtTable = objLibraryCon.getLibraryByID(LibraryID);
			if (dtTable.Rows.Count > 0) {
				if (!Information.IsDBNull(dtTable.Rows(0)("Author")))
					this.lblAuthor.Text = dtTable.Rows(0)("Author");
				//If Not IsDBNull(dtTable.Rows(0)("")) Then Me.lblCurrentlyBorrowed.Text = dtTable.Rows(0)("CurrentlyBorrowed")
				if (!Information.IsDBNull(dtTable.Rows(0)("ISBN")))
					this.lblISB.Text = dtTable.Rows(0)("ISBN");
				if (!Information.IsDBNull(dtTable.Rows(0)("OwnerID"))) {
					UserController objUserCon = new UserController();
					UserInfo objUserInfo = objUserCon.GetUser(PortalId, Conversion.Val(dtTable.Rows(0)("OwnerID")));
					if ((objUserInfo != null))
						this.lblCurrentlyBorrowed.Text = objUserInfo.Username;
				}

				if (!Information.IsDBNull(dtTable.Rows(0)("PublishDate")))
					this.lblPublishDate.Text = dtTable.Rows(0)("PublishDate");
				if (!Information.IsDBNull(dtTable.Rows(0)("Publisher")))
					this.lblPublisher.Text = dtTable.Rows(0)("Publisher");
				if (!Information.IsDBNull(dtTable.Rows(0)("Title")))
					this.lblTitle.Text = dtTable.Rows(0)("Title");
				if (!Information.IsDBNull(dtTable.Rows(0)("Media")))
					this.lblMedia.Text = dtTable.Rows(0)("Media");
				dtTable = objLibraryCon.GetBorrowedBookByLibraryID(LibraryID);
				if (dtTable.Rows.Count > 0) {
					if (!Information.IsDBNull(dtTable.Rows(0)("BorrowDate")))
						this.lblBorrowDate.Text = dtTable.Rows(0)("BorrowDate");
					if (!Information.IsDBNull(dtTable.Rows(0)("DueReturnDate")))
						this.lblDueDate.Text = dtTable.Rows(0)("DueReturnDate");
				} else {
					this.lblBorrowDate.Visible = false;
					this.lblBorrowDateTitle.Visible = false;
					this.lblDueDate.Visible = false;
					this.lblDueDateTitle.Visible = false;

				}

			}
		}
		public void LocalizeSetting()
		{
			this.lblAuthorTitle.Text = DotNetNuke.Services.Localization.Localization.GetString("lblAuthorTitle", this.LocalResourceFile);
			this.lblCurrentlyBorrowedTitle.Text = DotNetNuke.Services.Localization.Localization.GetString("lblCurrentlyBorrowedTitle", this.LocalResourceFile);
			this.lblISBTitle.Text = DotNetNuke.Services.Localization.Localization.GetString("lblISBTitle", this.LocalResourceFile);
			this.lblBorrowDateTitle.Text = DotNetNuke.Services.Localization.Localization.GetString("lblBorrowDateTitle", this.LocalResourceFile);
			this.lblDueDateTitle.Text = DotNetNuke.Services.Localization.Localization.GetString("lblDueDateTitle", this.LocalResourceFile);
			this.lblPublishDateTitle.Text = DotNetNuke.Services.Localization.Localization.GetString("lblPublishDateTitle", this.LocalResourceFile);
			this.lblPublisherTitle.Text = DotNetNuke.Services.Localization.Localization.GetString("lblPublisherTitle", this.LocalResourceFile);
			this.lnkBack.Text = DotNetNuke.Services.Localization.Localization.GetString("lnkBack", this.LocalResourceFile);
			this.lblMediaTitle.Text = DotNetNuke.Services.Localization.Localization.GetString("lblMediaTitle", this.LocalResourceFile);
			this.lblTitleTitle.Text = DotNetNuke.Services.Localization.Localization.GetString("lblTitleTitle", this.LocalResourceFile);
		}

		protected void lnkBack_Click(object sender, System.EventArgs e)
		{
			Response.Redirect(NavigateURL(TabId), true);
		}
		public ViewDetaill()
		{
			Load += Page_Load;
		}
	}
}
posted @ 2010-07-13 00:21  小生不才  阅读(162)  评论(0编辑  收藏  举报