Example #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         BOLBanners            bolBanners = new BOLBanners();
         IQueryable <vBanners> BannerList = bolBanners.GetBannersByPositionCode(_positionCode);
         int BannerCount = BannerList.Count();
         if (BannerCount > 0)
         {
             int      RandVal = GetRandRow(BannerCount);
             string   FileName;
             vBanners CurBanner = (BannerList.Skip(RandVal).Take(1)).Single();
             FileName = CurBanner.BanFile;
             if (CurBanner.HCTypeCode == 1)
             {
                 if (CurBanner.TargetUrl != "")
                 {
                     hlBanner.NavigateUrl = "http://" + CurBanner.TargetUrl;
                 }
                 imgBanner.ImageUrl = "~/" + FileName;// ResolveUrl("~/") + string.Format("Imager.aspx?ImgFilePath={0}&StaticWidth={1}&StaticHeight={2}", Server.UrlEncode(Tools.Encode("Files/Banners/" + FileName)), CurBanner.Width, CurBanner.Height);
                 imgBanner.Width    = (int)CurBanner.Width;
                 //imgBanner.Height = (int)CurBanner.Height;
             }
             else if (CurBanner.HCTypeCode == 2)
             {
                 ltrFlash.Visible = true;
                 ltrFlash.Text    = @"<OBJECT classid=""clsid:D27CDB6E-AE6D-11cf-96B8-444553540000""
                                  codebase=""http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0""
                                  ID=awards WIDTH=" + CurBanner.Width + " HEIGHT=" + CurBanner.Height + @">
                                  <PARAM NAME=movie VALUE=""" + ResolveUrl("~/") + CurBanner.BanFile.Replace("//", "/") + @"""> 
                                  <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#> 
                                  <EMBED src=""" + ResolveUrl("~/") + CurBanner.BanFile.Replace("//", "/") + @""" quality=high bgcolor=# WIDTH=" + CurBanner.Width + " HEIGHT=" + CurBanner.Height + @" TYPE=""application/x-shockwave-flash"" PLUGINSPAGE=""http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash""></EMBED>
                                 </OBJECT>";
                 hlBanner.Visible = false;
             }
             else if (CurBanner.HCTypeCode == 3)
             {
                 ltrFlash.Visible = false;
                 hlBanner.Visible = false;
                 ltrText.Visible  = true;
                 ltrText.Text     = CurBanner.Text;
             }
         }
         else
         {
             hlBanner.Visible = false;
         }
     }
     catch (Exception rr)
     {
     }
     //Random rnd = new Random();
     //rnd.
 }
Example #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         BOLBanners BannersBOL = new BOLBanners();
         rptBanners.DataSource = BannersBOL.GetBannersByPositionCode(_positionCode).Take(4);
         rptBanners.DataBind();
     }
     catch (Exception err)
     {
         BOLErrorLogs ErrorLogsBOL = new BOLErrorLogs();
         ErrorLogsBOL.Insert(err.Message, DateTime.Now, Request.Url.AbsolutePath, "UCBannerList::Load");
     }
 }
Example #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        #region Tab Pages
        #endregion
        BOLClass        = new BOLBanners();
        lblSysName.Text = BOLClass.PageLable;

        if ((Code == null) && (!NewMode))
        {
            return;
        }
        if (!Page.IsPostBack)
        {
            #region Fill Combo
            cboHCTypeCode.DataSource   = new BOLHardCode().GetHCDataTable("HCBannerTypes");
            cboPositionCode.DataSource = new BOLHardCode().GetHCDataTable("BannerPositions");
            #endregion
            if (!NewMode)
            {
                LoadData((int)Code);
            }
        }
    }
Example #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            //return;
            IQueryable <vRandBanners> BannerList;
            HttpContext context = HttpContext.Current;
            if (context.Cache["Banners" + _positionCode] == null)
            {
                BOLBanners bolBanners = new BOLBanners();
                BannerList = bolBanners.GetRandBannersByPositionCode(_positionCode);
                context.Cache.Insert("Banners" + _positionCode, BannerList, null, DateTime.Now.AddMinutes(CachingTime), TimeSpan.Zero);
            }
            BannerList = (IQueryable <vRandBanners>)context.Cache["Banners" + _positionCode];


            //int BannerCount = BannerList.Count();
            if (BannerList.Any())
            {
                //int RandVal = GetRandRow(BannerCount);
                string       FileName;
                vRandBanners CurBanner = BannerList.First(); //(BannerList.Skip(RandVal).Take(1)).Single();
                FileName = CurBanner.BanFile;
                if (CurBanner.HCTypeCode == 1)
                {
                    if (CurBanner.TargetUrl != "")
                    {
                        hlBanner.NavigateUrl = "http://" + CurBanner.TargetUrl;
                    }
                    imgBanner.ImageUrl      = "https://static.Khabardaan.ir/Files/Banners/" + FileName;// ResolveUrl("~/") + string.Format("Imager.aspx?ImgFilePath={0}&StaticWidth={1}&StaticHeight={2}", Server.UrlEncode(Tools.Encode("Files/Banners/" + FileName)), CurBanner.Width, CurBanner.Height);
                    imgBanner.AlternateText = CurBanner.Text;
                    //hlBanner.Width = (int)CurBanner.Width;
                    //hlBanner.Height = (int)CurBanner.Height;
                }
                else if (CurBanner.HCTypeCode == 2)
                {
                    ltrFlash.Visible = true;
                    ltrFlash.Text    = @"<OBJECT classid=""clsid:D27CDB6E-AE6D-11cf-96B8-444553540000""
                                     codebase=""http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0""
                                     ID=awards WIDTH=" + CurBanner.Width + " HEIGHT=" + CurBanner.Height + @">
                                     <PARAM NAME=movie VALUE=""" + ResolveClientUrl("~/Files/Banners/") + CurBanner.BanFile + @"""> 
                                     <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#> 
                                     <EMBED src=""" + ResolveUrl("~/Files/Banners/") + CurBanner.BanFile + @""" quality=high bgcolor=# WIDTH=" + CurBanner.Width + " HEIGHT=" + CurBanner.Height + @" TYPE=""application/x-shockwave-flash"" PLUGINSPAGE=""http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash""></EMBED>
                                    </OBJECT>";
                    hlBanner.Visible = false;
                }
                else if (CurBanner.HCTypeCode == 3)
                {
                    ltrFlash.Visible = false;
                    hlBanner.Visible = false;
                    ltrText.Visible  = true;
                    if (CurBanner.Width != null && CurBanner.Height != null)
                    {
                        ltrText.Text = "<div style=\"width:" + CurBanner.Width + "px;height:" + CurBanner.Height + ";\">" + CurBanner.Text + "</div>";
                    }
                    else
                    {
                        ltrText.Text = CurBanner.Text;
                    }
                }
            }
            else
            {
                hlBanner.Visible = false;
            }
        }
        catch (Exception rr)
        {
        }
        //Random rnd = new Random();
        //rnd.
    }