Beispiel #1
0
 private void loadBanner()
 {
     BannerItem banner = new BannerBL().GetBanner(_position);
     imgBanner.ImageUrl = banner != null ? "~" + banner.ImageUrl : string.Empty;
     lnkBanner.NavigateUrl = banner != null ? banner.Url : string.Empty;
     if (banner == null)
         this.Visible = false;
 }
Beispiel #2
0
        protected void dgvBanners_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            List<BannerItem> images = (List<BannerItem>)ViewState["images"];

            for (int i = 0; i < images.Count; i++)
            {
                if (images[i].BannerID == int.Parse(((Label)dgvBanners.Rows[e.RowIndex].FindControl("lblBannerID")).Text))
                {
                    images.RemoveAt(i);
                    BannerBL bannerBL = new BannerBL();
                    bannerBL.DeleteBanner(int.Parse(((Label)dgvBanners.Rows[e.RowIndex].FindControl("lblBannerID")).Text));
                    break;
                }
            }
            loadImages();
        }
Beispiel #3
0
        private void loadBanner(int bannerPositionID)
        {
            BannerBL bannerBL = new BannerBL();
            List<BannerItem> banners = bannerBL.GetBannersForPosition(bannerPositionID);
            dgvBanners.DataSource = banners;

            if (banners != null && banners.Count > 0)
            {
                ViewState["images"] = banners;
                loadImages();
                dgvBanners.Visible = true;
            }
            else
            {
                ViewState["images"] = null;
                dgvBanners.Visible = false;
            }
        }
Beispiel #4
0
        private void save()
        {
            Banner banner = new Banner();
            banner.BannerPositionID = int.Parse(cmbPosition.SelectedValue);

            int index = 0;
            if (ViewState["images"] != null)
                foreach (GridViewRow row in dgvBanners.Rows)
                {
                    ((List<BannerItem>)ViewState["images"])[index].Url = ((TextBox)row.FindControl("txtLink")).Text;
                    index++;
                }

            banner.Banners = (List<BannerItem>)ViewState["images"];

            BannerBL bannerBL = new BannerBL();
            bannerBL.SaveBanner(banner);
        }
Beispiel #5
0
 private void loadPositions()
 {
     BannerBL bannerBL = new BannerBL();
     cmbPosition.DataSource = bannerBL.GetBannerPositions();
     cmbPosition.DataTextField = "name";
     cmbPosition.DataValueField = "bannerPositionID";
     cmbPosition.DataBind();
     cmbPosition_SelectedIndexChanged(this, null);
 }
Beispiel #6
0
 private void loadBanner()
 {
     BannerItem banner = new BannerBL().GetBanner(_position);
     imgBanner.ImageUrl = banner != null ? banner.ImageUrl : string.Empty;
     lnkBanner.NavigateUrl = banner != null ? banner.Url : string.Empty;
 }
Beispiel #7
0
        private void save()
        {
            Banner banner = new Banner();
            banner.BannerPositionID = int.Parse(cmbPosition.SelectedValue);
            banner.Banners = (List<BannerItem>)ViewState["images"];

            BannerBL bannerBL = new BannerBL();
            bannerBL.SaveBanner(banner);
        }