Ejemplo n.º 1
0
		private void LoadPromotions()
		{
			BEPromotions promotions = new BEPromotions();
			BPPromotions bp = new BPPromotions();
			promotions = bp.SelectAllActive();

			for (int i=0;i<promotions.tbl_Promotions.Count;i++)
			{
				if (promotions.tbl_Promotions[i].PromotionName != "" || !promotions.tbl_Promotions[i].IsPromotionImageIDNull() || promotions.tbl_Promotions[i].PromotionDescription != "")
				{
					if (this.FindControl("pnlPromotion"+(i+1).ToString()) != null)
					{
						this.FindControl("pnlPromotion"+(i+1).ToString()).Visible = true;
						((Label)this.FindControl("lblPromotion"+(i+1).ToString()+"Heading")).Text = promotions.tbl_Promotions[i].PromotionName;
						((Label)this.FindControl("lblPromotion"+(i+1).ToString()+"Description")).Text = promotions.tbl_Promotions[i].PromotionDescription;
						if(promotions.tbl_Promotions[i].IsPromotionImageIDNull())
						{
							this.FindControl("pnlPromotionImage"+(i+1).ToString()).Visible = false;
							this.FindControl("imgPromotion"+(i+1).ToString()).Visible = false;
						}else
						{
							this.FindControl("pnlPromotionImage"+(i+1).ToString()).Visible = true;
							Image pageImage = ((Image)this.FindControl("imgPromotion"+(i+1).ToString()));
							pageImage.Visible = true;
							pageImage.ImageUrl = GetImageName(promotions.tbl_Promotions[i].PromotionImageID,"promo_");
						}
					}
				}
			}
		}
Ejemplo n.º 2
0
		private void Page_Load(object sender, System.EventArgs e)
		{
			this.AuthenticatePage(new string[] {PermissionLevels.EditPromotions, PermissionLevels.ViewPromotions, PermissionLevels.AddPromotions});
			if (!IsPostBack)
			{
				BEPromotions promotions = new BEPromotions();
				BPPromotions bp = new BPPromotions();
				promotions = bp.SelectAll();
				for (int i=1; i<=promotions.tbl_Promotions.Rows.Count;i++)
				{
					FillTextBoxesFromDataRow(i.ToString(),promotions.tbl_Promotions[i-1]);
				}
			}
		}
Ejemplo n.º 3
0
		private void btnSubmit_ServerClick(object sender, System.EventArgs e)
		{
			BEPromotions promotions = new BEPromotions();
			BPPromotions bp = new BPPromotions();
			promotions = bp.SelectAll();
			int counter = 1;

			while (this.FindControl("pnlPromotion" + counter.ToString()) != null && ((Panel)this.FindControl("pnlPromotion" + counter.ToString())).Visible != false)
			{
				BEPromotions.tbl_PromotionsRow dr;
				if (promotions.tbl_Promotions.Rows.Count >= counter)
				{
					dr = promotions.tbl_Promotions[counter-1];
				}
				else
				{
					dr = promotions.tbl_Promotions.Newtbl_PromotionsRow();
				}
				FillDataRowFromTextBoxes(counter.ToString(),dr);
				if (promotions.tbl_Promotions.Rows.Count < counter)
				{
					promotions.tbl_Promotions.Addtbl_PromotionsRow(dr);
				}
				//CreateResizedImage(BEImages DSImages, int ImageID, string prefix, int width, int height, Page page)
				if (!dr.IsPromotionImageIDNull())
				{
					MWUtility.CreateResizedImage(dr.PromotionImageID, "promo", "", promotionImageSize, 0, this);
				}

				counter++;
			}
			bp.Update(promotions);
			Response.Redirect("index.aspx");
		}