private void Page_Load(object sender, System.EventArgs e)
		{
			this._module = base.Module as ShopModule;
			// Add the CSS
			string cssfile = String.Format("{0}Modules/Shop/Images/Standard/shop.css",UrlHelper.GetApplicationPath());
			this.RegisterStylesheet("shopcss",cssfile);

			this._origProduct		= this._module.GetShopProductById(this._module.CurrentShopProductId);
			this._shopShop	= this._module.GetShopById(this._module.CurrentShopId);
			this._module.CurrentShopCategoryId	= this._shopShop.CategoryId;

            this.BindTopFooter();
            base.LocalizeControls();
            this.ltOrigProduct.Text = this._origProduct.Message;
			this.BindJS();
			this.BindEmoticon();

			if(!this.IsPostBack)
			{
				if(this._module.QuoteProduct == 1)
				{
					this.txtMessage.Text = "[quote]" + TextParser.HtmlToShopCode(this._origProduct.Message,this._module) + "[/quote]";
				}
			}
		}
		private void Page_Load(object sender, System.EventArgs e)
		{
			this._module = base.Module as ShopModule;
			this.btnCancel.Attributes.Add("onClick", String.Format("document.location.href='AdminShop.aspx{0}'", base.GetBaseQueryString()));
			if (! this.IsPostBack)
			{
				this.lstCategories.Items.Add(new ListItem("none", "0"));
				IList categories = this._module.GetAllCategories();
				foreach (ShopCategory category in categories)
				{
					this.lstCategories.Items.Add(new ListItem(category.Name, category.Id.ToString()));
				}
			}

			if (Request.QueryString["ShopId"] != null)
			{
				int shopId = Int32.Parse(Request.QueryString["ShopId"]);
				if (shopId > 0)
				{
					this._shop = this._module.GetShopById(shopId);
					if (! this.IsPostBack)
					{
						BindShop();
					}
					this.btnDelete.Visible = true;
					this.btnDelete.Attributes.Add("onClick", "return confirm('Are you sure?');");
				}
			}
		}
		private void Page_Load(object sender, System.EventArgs e)
		{
			this._module = base.Module as ShopModule;

			// Add the CSS
			string cssfile = String.Format("{0}Modules/Shop/Images/Standard/shop.css",UrlHelper.GetApplicationPath());
			this.RegisterStylesheet("shopcss",cssfile);

			this._shopShop	= this._module.GetShopById(this._module.CurrentShopId);
			this._module.CurrentShopCategoryId	= this._shopShop.CategoryId;

            this.BindTopFooter();
            base.LocalizeControls();
            this.BindJS();
			this.BindEmoticon();
		}
		private void Page_Load(object sender, System.EventArgs e)
		{
			this._module = base.Module as ShopModule;
			// Add the CSS
			string cssfile = String.Format("{0}Modules/Shop/Images/Standard/shop.css",UrlHelper.GetApplicationPath());
			this.RegisterStylesheet("shopcss",cssfile);

			this._shopShop	= this._module.GetShopById(this._module.CurrentShopId);
			this._module.CurrentShopCategoryId = this._shopShop.CategoryId;

            if (this.Page.User.Identity.IsAuthenticated)
            {
                Cuyahoga.Core.Domain.User currentUser = Context.User.Identity as Cuyahoga.Core.Domain.User;
                this._module.SetCurrentOrder(currentUser);
            }

			this.BindTopFooter();
			if(this._shopShop.AllowGuestPublish == 1 || this.Page.User.Identity.IsAuthenticated)
			{
                this.HyperLinkEdit.Visible = true;
				this.hplReply.Visible = true;
                this.lbtnBuy.Visible = true;
            }
			else
			{
                this.HyperLinkEdit.Visible = false;
				this.hplReply.Visible = false;
                this.lbtnBuy.Visible = false;
            }


			if(!this.IsPostBack)
			{
                this.LocalizeControls();
                this.BindLinks();
				this.BindShopProduct();
                this.BindShopProductImages();
                this.BindShopProductComments();
            }
		}
		private void Page_Load(object sender, System.EventArgs e)
		{
			this._module = base.Module as ShopModule;

			// Add the CSS
			string cssfile = String.Format("{0}Modules/Shop/Images/Standard/shop.css",UrlHelper.GetApplicationPath());
			this.RegisterStylesheet("shopcss",cssfile);

			this._shopShop	= this._module.GetShopById(this._module.CurrentShopId);
			this._module.CurrentShopCategoryId	= this._shopShop.CategoryId;

            if (!IsPostBack)
            {
                ShopProduct product = this._module.GetShopProductById(this._module.CurrentShopProductId);
                if (product != null)
                {
                    this.txtMessage.Text = product.Message;
                    this.txtPrice.Text = product.Price.ToString();
                    this.txtSubject.Text = product.Title;
                    this.btnDelete.Visible = true;

                    if (product.Images.Count > 0)
                    {
                        MemoryStream ms = new MemoryStream();
                        ShopImage image = (ShopImage)product.Images[0];

                        if (image.Data != null)
                        {
                            this.ImageControl1.Bitmap = Utils.Utils.ImageResize(image.Data, this._module.ImageWidth); ;
                            this.ImageControl1.Visible = true;
                        }
                    }
                }
                this.BindTopFooter();
                base.LocalizeControls();
                this.BindJS();
                this.BindEmoticon();
            }
		}
        /// <summary>
        /// Get the number of products.
        /// </summary>
        /// <returns></returns>
        public IList GetProductCount(ShopShop shop)
        {
            ISession session = this._sessionManager.OpenSession();
            try
            {
                string hql;
                hql = "select count(prod.Id) from ShopProduct prod Where prod.ShopId = :shopid";
                IQuery q = session.CreateQuery(hql);
                q.SetString("shopid", shop.Id.ToString());

                IList prodlist = q.List();
       

                return prodlist;
            }
            catch (Exception ex)
            {
                throw new Exception("Unable to get number of products", ex);
            }
        }
        public virtual void DeleteShop(ShopShop shop)
		{
            ISession session = this._sessionManager.OpenSession();
            NHibernate.ITransaction tx = session.BeginTransaction();
            try
			{
                session.Delete(shop);
                tx.Commit();
                session.Close();
			}
			catch (Exception ex)
			{
				tx.Rollback();
                throw new Exception("Unable to delete Shop" + "<br>" + ex.Message + "<br>" + ex.InnerException, ex);
			}
		}
		private void btnSave_Click(object sender, System.EventArgs e)
		{
			if (this.IsValid)
			{
				if (this._shop == null)
				{
					this._shop = new ShopShop();
				}
				
				this.SaveShop();
			}
		}
		private void ShopBreadCrumb()
		{
			if(this._module.CurrentShopId != 0)
			{
				this._shopShop	= this._module.GetShopById(this._module.CurrentShopId);
				this._shopCategory	= this._module.GetShopCategoryById(this._shopShop.CategoryId);

				this.hplShopLink.NavigateUrl	= String.Format("{0}/ShopView/{1}",UrlHelper.GetUrlFromSection(this._module.Section), this._module.CurrentShopId);
				this.hplShopLink.Text			= this._shopShop.Name;
				this.hplShopLink.Visible		= true;
				this.hplShopLink.CssClass		= "shop";

				this.lblForward_1.Visible = true;
				this.lblForward_2.Visible = true;

				this.hplCategoryLink.NavigateUrl	= String.Format("{0}/ShopCategoryList/{1}",UrlHelper.GetUrlFromSection(this._module.Section), this._module.CurrentShopCategoryId);
				this.hplCategoryLink.Text			= this._shopCategory.Name;
				this.hplCategoryLink.Visible		= true;
				this.hplCategoryLink.CssClass		= "shop";
			}

			if(this._module.CurrentShopProductId != 0)
			{
				this.hplProductlink.NavigateUrl	= String.Format("{0}/ShopViewProduct/{1}/post/{2}",UrlHelper.GetUrlFromSection(this._module.Section), this._module.CurrentShopId,this._module.CurrentShopProductId);
				this.hplProductlink.Visible		= true;
				this.hplProductlink.Text			= this._module.GetShopProductById(this._module.CurrentShopProductId).Title;
				this.hplProductlink.CssClass		= "shop";
				this.lblForward_3.Visible		= true;
			}

			HyperLink hplBreadCrumb	= (HyperLink)this.FindControl("hplShopBreadCrumb");
			if(hplBreadCrumb != null)
			{
				hplBreadCrumb.Text			= base.GetText("FORUMHOME");
				hplBreadCrumb.NavigateUrl	= UrlHelper.GetUrlFromSection(this._module.Section);
                hplBreadCrumb.ToolTip = base.GetText("FORUMHOME");
				hplBreadCrumb.CssClass		= "shop";
			}
		}