public void DeleteVendor(int VendorID) { DataProvider.Instance().DeleteVendor(VendorID); var objBanners = new BannerController(); objBanners.ClearBannerCache(); }
protected void Page_Load( Object sender, EventArgs e ) { try { if( ( Request.QueryString["vendorid"] != null ) && ( Request.QueryString["bannerid"] != null ) ) { int intVendorId = int.Parse( Request.QueryString["vendorid"] ); int intBannerId = int.Parse( Request.QueryString["bannerid"] ); string strURL = "~/" + Globals.glbDefaultPage; BannerController objBanners = new BannerController(); BannerInfo objBanner = objBanners.GetBanner( intBannerId, intVendorId, PortalSettings.PortalId ); if( objBanner == null ) { //Try a Host Banner objBanner = objBanners.GetBanner( intBannerId, intVendorId, Null.NullInteger ); } if( objBanner != null ) { if( ! Null.IsNull( objBanner.URL ) ) { strURL = Globals.LinkClick( objBanner.URL, - 1, - 1, false ); } else { VendorController objVendors = new VendorController(); VendorInfo objVendor = objVendors.GetVendor( objBanner.VendorId, PortalSettings.PortalId ); if( objVendor == null ) { //Try a Host Vendor objVendor = objVendors.GetVendor( objBanner.VendorId, Null.NullInteger ); } if( objVendor != null ) { if( !String.IsNullOrEmpty(objVendor.Website) ) { strURL = Globals.AddHTTP( objVendor.Website ); } } } } else { if( Request.UrlReferrer != null ) { strURL = Request.UrlReferrer.ToString(); } } objBanners.UpdateBannerClickThrough( intBannerId, intVendorId ); Response.Redirect( strURL, true ); } } catch( Exception exc ) //Page failed to load { Exceptions.ProcessPageLoadException( exc ); } }
/// <summary> /// BindData gets the banners from the Database and binds them to the DataGrid /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 9/17/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> private void BindData() { BannerController objBanners = new BannerController(); //Localize the Grid Localization.LocalizeDataGrid( ref grdBanners, this.LocalResourceFile ); grdBanners.DataSource = objBanners.GetBanners( VendorID ); grdBanners.DataBind(); cmdAdd.NavigateUrl = FormatURL( "BannerId", "-1" ); }
public void DeleteVendors(int PortalID) { int TotalRecords = 0; foreach (VendorInfo vendor in GetVendors(PortalID, true, Null.NullInteger, Null.NullInteger, ref TotalRecords)) { if (vendor.Authorized == false) { DeleteVendor(vendor.VendorId); } } var objBanners = new BannerController(); objBanners.ClearBannerCache(); }
public string FormatItem(int VendorId, int BannerId, int BannerTypeId, string BannerName, string ImageFile, string Description, string URL, int Width, int Height) { var objBanners = new BannerController(); return objBanners.FormatBanner(VendorId, BannerId, BannerTypeId, BannerName, ImageFile, Description, URL, Width, Height, Convert.ToString(Settings["bannersource"]), PortalSettings.HomeDirectory, Convert.ToString(Settings["bannerclickthroughurl"])); }
/// ----------------------------------------------------------------------------- /// <summary> /// DNNTxtBannerGroup_PopulateOnDemand runs when something is entered on the /// BannerGroup field /// </summary> /// <remarks> /// </remarks> /// <history> /// [vmasanas] 9/29/2006 Implement a callback to display current groups /// to user so the BannerGroup can be easily selected /// </history> /// ----------------------------------------------------------------------------- protected void DNNTxtBannerGroup_PopulateOnDemand(object source, DNNTextSuggestEventArgs e) { DataTable dt; DNNNode objNode; var objBanners = new BannerController(); dt = objBanners.GetBannerGroups(PortalId); DataRow[] dr; dt.CaseSensitive = false; dr = dt.Select("GroupName like '" + e.Text + "%'"); foreach (DataRow d in dr) { objNode = new DNNNode(d["GroupName"].ToString()); objNode.ID = e.Nodes.Count.ToString(); e.Nodes.Add(objNode); } }
/// ----------------------------------------------------------------------------- /// <summary> /// cmdUpdate_Click runs when the Update Button is clicked /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 9/21/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> /// ----------------------------------------------------------------------------- protected void OnUpdateClick(object sender, EventArgs e) { try { //Only Update if the Entered Data is val if (Page.IsValid) { if (!cmdCopy.Visible) { BannerId = -1; } DateTime StartDate = Null.NullDate; if (!String.IsNullOrEmpty(txtStartDate.Text)) { StartDate = Convert.ToDateTime(txtStartDate.Text); } DateTime EndDate = Null.NullDate; if (!String.IsNullOrEmpty(txtEndDate.Text)) { EndDate = Convert.ToDateTime(txtEndDate.Text); } //Create an instance of the Banner DB component var objBanner = new BannerInfo(); objBanner.BannerId = BannerId; objBanner.VendorId = VendorId; objBanner.BannerName = txtBannerName.Text; objBanner.BannerTypeId = Convert.ToInt32(cboBannerType.SelectedItem.Value); objBanner.GroupName = DNNTxtBannerGroup.Text; objBanner.ImageFile = ctlImage.Url; if (!String.IsNullOrEmpty(txtWidth.Text)) { objBanner.Width = int.Parse(txtWidth.Text); } else { objBanner.Width = 0; } if (!String.IsNullOrEmpty(txtHeight.Text)) { objBanner.Height = int.Parse(txtHeight.Text); } else { objBanner.Height = 0; } objBanner.Description = txtDescription.Text; objBanner.URL = ctlURL.Url; objBanner.Impressions = int.Parse(txtImpressions.Text); objBanner.CPM = double.Parse(txtCPM.Text); objBanner.StartDate = StartDate; objBanner.EndDate = EndDate; objBanner.Criteria = int.Parse(optCriteria.SelectedItem.Value); objBanner.CreatedByUser = UserInfo.UserID.ToString(); var objBanners = new BannerController(); if (BannerId == Null.NullInteger) { //Add the banner within the Banners table objBanners.AddBanner(objBanner); } else { //Update the banner within the Banners table objBanners.UpdateBanner(objBanner); } //Redirect back to the portal home page Response.Redirect(EditUrl("VendorId", VendorId.ToString()), true); } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
/// ----------------------------------------------------------------------------- /// <summary> /// Page_Load runs when the control is loaded /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 9/21/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> /// ----------------------------------------------------------------------------- protected override void OnLoad(EventArgs e) { base.OnLoad(e); cmdCancel.Click += OnCancelClick; cmdCopy.Click += OnCopyClick; cmdDelete.Click += OnDeleteClick; cmdEmail.Click += OnEmailClick; cmdUpdate.Click += OnUpdateClick; DNNTxtBannerGroup.PopulateOnDemand += PopulateBannersOnDemand; try { if ((Request.QueryString["VendorId"] != null)) { VendorId = Int32.Parse(Request.QueryString["VendorId"]); } if ((Request.QueryString["BannerId"] != null)) { BannerId = Int32.Parse(Request.QueryString["BannerId"]); } //this needs to execute always to the client script code is registred in InvokePopupCal cmdStartCalendar.NavigateUrl = Calendar.InvokePopupCal(txtStartDate); cmdEndCalendar.NavigateUrl = Calendar.InvokePopupCal(txtEndDate); if (Page.IsPostBack == false) { ctlImage.FileFilter = Globals.glbImageFileTypes; ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem")); var objBannerTypes = new BannerTypeController(); //Get the banner types from the database cboBannerType.DataSource = objBannerTypes.GetBannerTypes(); cboBannerType.DataBind(); var objBanners = new BannerController(); if (BannerId != Null.NullInteger) { //Obtain a single row of banner information BannerInfo objBanner = objBanners.GetBanner(BannerId); if (objBanner != null) { txtBannerName.Text = objBanner.BannerName; cboBannerType.Items.FindByValue(objBanner.BannerTypeId.ToString()).Selected = true; DNNTxtBannerGroup.Text = objBanner.GroupName; ctlImage.Url = objBanner.ImageFile; if (objBanner.Width != 0) { txtWidth.Text = objBanner.Width.ToString(); } if (objBanner.Height != 0) { txtHeight.Text = objBanner.Height.ToString(); } txtDescription.Text = objBanner.Description; if (!String.IsNullOrEmpty(objBanner.URL)) { ctlURL.Url = objBanner.URL; } txtImpressions.Text = objBanner.Impressions.ToString(); txtCPM.Text = objBanner.CPM.ToString(); if (!Null.IsNull(objBanner.StartDate)) { txtStartDate.Text = objBanner.StartDate.ToShortDateString(); } if (!Null.IsNull(objBanner.EndDate)) { txtEndDate.Text = objBanner.EndDate.ToShortDateString(); } optCriteria.Items.FindByValue(objBanner.Criteria.ToString()).Selected = true; ctlAudit.CreatedByUser = objBanner.CreatedByUser; ctlAudit.CreatedDate = objBanner.CreatedDate.ToString(); var arrBanners = new ArrayList(); arrBanners.Add(objBanner); bannersRow.Visible = true; lstBanners.DataSource = arrBanners; lstBanners.DataBind(); } else //security violation attempt to access item not related to this Module { Response.Redirect(EditUrl("VendorId", VendorId.ToString()), true); } } else { txtImpressions.Text = "0"; txtCPM.Text = "0"; optCriteria.Items.FindByValue("1").Selected = true; cmdDelete.Visible = false; cmdCopy.Visible = false; cmdEmail.Visible = false; ctlAudit.Visible = false; } } } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
protected void OnEmailClick(object sender, EventArgs e) { //send email summary to vendor var objBanners = new BannerController(); var objBanner = objBanners.GetBanner(BannerId); if (objBanner != null) { var objVendors = new VendorController(); var objVendor = objVendors.GetVendor(objBanner.VendorId, PortalId); if (objVendor != null) { if (!Null.IsNull(objVendor.Email)) { var Custom = new ArrayList(); Custom.Add(objBanner.BannerName); Custom.Add(objBanner.Description); Custom.Add(objBanner.ImageFile); Custom.Add(objBanner.CPM.ToString("#0.#####")); Custom.Add(objBanner.Impressions.ToString()); Custom.Add(objBanner.StartDate.ToShortDateString()); Custom.Add(objBanner.EndDate.ToShortDateString()); Custom.Add(objBanner.Views.ToString()); Custom.Add(objBanner.ClickThroughs.ToString()); var errorMsg = Mail.SendMail(PortalSettings.Email, objVendor.Email, "", Localization.GetSystemMessage(PortalSettings, "EMAIL_BANNER_NOTIFICATION_SUBJECT", Localization.GlobalResourceFile, Custom), Localization.GetSystemMessage(PortalSettings, "EMAIL_BANNER_NOTIFICATION_BODY", Localization.GlobalResourceFile, Custom), "", "", "", "", "", ""); string strMessage; if (String.IsNullOrEmpty(errorMsg)) { strMessage = Localization.GetString("EmailSuccess", LocalResourceFile); UI.Skins.Skin.AddModuleMessage(this, strMessage, ModuleMessage.ModuleMessageType.GreenSuccess); } else { strMessage = Localization.GetString("EmailFailure", LocalResourceFile); strMessage = string.Format(strMessage, errorMsg); UI.Skins.Skin.AddModuleMessage(this, strMessage, ModuleMessage.ModuleMessageType.RedError); } } } } }
/// ----------------------------------------------------------------------------- /// <summary> /// cmdDelete_Click runs when the Delete Button is clicked /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 9/21/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> /// ----------------------------------------------------------------------------- protected void OnDeleteClick(object sender, EventArgs e) { try { if (BannerId != -1) { var objBanner = new BannerController(); objBanner.DeleteBanner(BannerId); //Redirect back to the portal home page Response.Redirect(EditUrl("VendorId", VendorId.ToString()), true); } } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (PortalSettings.BannerAdvertising != 0 && Visible) { int BannerType = 0; if (AllowNullBannerType) { if (!string.IsNullOrEmpty(BannerTypeId)) { BannerType = Int32.Parse(Convert.ToString(BannerTypeId)); } } else { if (string.IsNullOrEmpty(BannerTypeId)) { BannerType = PortalController.GetPortalSettingAsInteger("BannerTypeId", PortalSettings.PortalId, 1); } } //public attributes if (String.IsNullOrEmpty(GroupName)) { GroupName = PortalController.GetPortalSetting("BannerGroupName", PortalSettings.PortalId, ""); } if (String.IsNullOrEmpty(BannerCount)) { BannerCount = "1"; } int intPortalId; if (PortalSettings.BannerAdvertising == 1) { intPortalId = PortalSettings.PortalId; //portal } else { intPortalId = Null.NullInteger; //host } //load banners var objBanners = new BannerController(); ArrayList arrBanners = objBanners.LoadBanners(intPortalId, Null.NullInteger, BannerType, GroupName, int.Parse(BannerCount)); //bind to datalist lstBanners.DataSource = arrBanners; lstBanners.DataBind(); //set banner display characteristics if (lstBanners.Items.Count != 0) { lstBanners.RepeatLayout = BannerLayout; if (!String.IsNullOrEmpty(Width)) { lstBanners.Width = Unit.Parse(Width + "px"); } if(BannerColumns > 0) { lstBanners.RepeatColumns = BannerColumns; } if(BannerCellPadding > 0) { lstBanners.CellPadding = BannerCellPadding; } else { lstBanners.CellPadding = lstBanners.Items.Count == 1 ? 0 : 4; } lstBanners.CellSpacing = BannerCellSpacing; if (!String.IsNullOrEmpty(Orientation)) { switch (Orientation) { case "H": lstBanners.RepeatDirection = RepeatDirection.Horizontal; break; case "V": lstBanners.RepeatDirection = RepeatDirection.Vertical; break; } } else { lstBanners.RepeatDirection = RepeatDirection.Vertical; } if (!String.IsNullOrEmpty(BorderWidth)) { lstBanners.ItemStyle.BorderWidth = Unit.Parse(BorderWidth + "px"); } if (!String.IsNullOrEmpty(BorderColor)) { var objColorConverter = new ColorConverter(); lstBanners.ItemStyle.BorderColor = (Color) objColorConverter.ConvertFrom(BorderColor); } //item attributes if (!String.IsNullOrEmpty(RowHeight)) { lstBanners.ItemStyle.Height = Unit.Parse(RowHeight + "px"); } if (!String.IsNullOrEmpty(ColWidth)) { lstBanners.ItemStyle.Width = Unit.Parse(ColWidth + "px"); } } else { lstBanners.Visible = false; } } else { lstBanners.Visible = false; } }
protected void Page_Load( Object sender, EventArgs e ) { // public attributes if( BannerTypeId == "" ) { BannerTypeId = "1"; // banner } if( BannerCount == "" ) { BannerCount = "1"; } if( PortalSettings.BannerAdvertising != 0 ) { int intPortalId; if( PortalSettings.BannerAdvertising == 1 ) { intPortalId = PortalSettings.PortalId; // portal } else { intPortalId = Null.NullInteger; // host } // load banners BannerController objBanners = new BannerController(); ArrayList arrBanners = objBanners.LoadBanners(intPortalId, Null.NullInteger, Int32.Parse(BannerTypeId), GroupName, Int32.Parse(BannerCount)); if( arrBanners.Count == 0 ) { if( BannerTypeId == "1" ) { // add default banner if none found BannerInfo objBanner = new BannerInfo(); objBanner.BannerId = - 1; objBanner.ImageFile = Globals.ApplicationPath + "/images/banner.gif"; objBanner.URL = Globals.GetDomainName(Request); objBanner.BannerName = Localization.GetString( "Banner", Localization.GetResourceFile( this, MyFileName ) ); arrBanners.Add( objBanner ); } } // bind to datalist lstBanners.DataSource = arrBanners; lstBanners.DataBind(); // set banner display characteristics if( lstBanners.Items.Count != 0 ) { // container attributes lstBanners.RepeatLayout = RepeatLayout.Table; if( !String.IsNullOrEmpty(Width) ) { lstBanners.Width = Unit.Parse( Width + "px" ); } if( lstBanners.Items.Count == 1 ) { lstBanners.CellPadding = 0; lstBanners.CellSpacing = 0; } else { lstBanners.CellPadding = 4; lstBanners.CellSpacing = 0; } if( !String.IsNullOrEmpty(Orientation) ) { switch( Orientation ) { case "H": lstBanners.RepeatDirection = RepeatDirection.Horizontal; break; case "V": lstBanners.RepeatDirection = RepeatDirection.Vertical; break; } } else { lstBanners.RepeatDirection = RepeatDirection.Vertical; } if( !String.IsNullOrEmpty(BorderWidth) ) { lstBanners.ItemStyle.BorderWidth = Unit.Parse( BorderWidth + "px" ); } if( !String.IsNullOrEmpty(BorderColor) ) { ColorConverter objColorConverter = new ColorConverter(); lstBanners.ItemStyle.BorderColor = (Color)objColorConverter.ConvertFrom( BorderColor ); } // item attributes lstBanners.ItemStyle.VerticalAlign = VerticalAlign.Middle; if( !String.IsNullOrEmpty(RowHeight) ) { lstBanners.ItemStyle.Height = Unit.Parse( RowHeight + "px" ); } if( !String.IsNullOrEmpty(ColWidth) ) { lstBanners.ItemStyle.Width = Unit.Parse( ColWidth + "px" ); } } else { lstBanners.Visible = false; } } else { lstBanners.Visible = false; } }
// The Page_Load event handler on this User Control is used to // obtain a DataReader of banner information from the Banners // table, and then databind the results to a templated DataList // server control. It uses the DotNetNuke.BannerDB() // data component to encapsulate all data functionality. protected void Page_Load( Object sender, EventArgs e ) { try { int intPortalId=0; int intBannerTypeId=0; string strBannerGroup; int intBanners = 0; // banner parameters switch( Convert.ToString( Settings["bannersource"] ) ) { case "L": // local intPortalId = PortalId; break; case "": intPortalId = PortalId; break; case "G": // global intPortalId = Null.NullInteger; break; } if( Convert.ToString( Settings["bannertype"] ) != "" ) { intBannerTypeId = int.Parse( Convert.ToString( Settings["bannertype"] ) ); } strBannerGroup = Convert.ToString( Settings["bannergroup"] ); if( Convert.ToString( Settings["bannercount"] ) != "" ) { intBanners = int.Parse( Convert.ToString( Settings["bannercount"] ) ); } if( Convert.ToString( Settings["padding"] ) != "" ) { lstBanners.CellPadding = int.Parse( Convert.ToString( Settings["padding"] ) ); } // load banners if( intBanners != 0 ) { BannerController objBanners = new BannerController(); lstBanners.DataSource = objBanners.LoadBanners( intPortalId, ModuleId, intBannerTypeId, strBannerGroup, intBanners ); lstBanners.DataBind(); } // set banner display characteristics if( lstBanners.Items.Count != 0 ) { // container attributes lstBanners.RepeatLayout = RepeatLayout.Table; if( Convert.ToString( Settings["orientation"] ) != "" ) { switch( Convert.ToString( Settings["orientation"] ) ) { case "H": lstBanners.RepeatDirection = RepeatDirection.Horizontal; break; case "V": lstBanners.RepeatDirection = RepeatDirection.Vertical; break; } } else { lstBanners.RepeatDirection = RepeatDirection.Vertical; } if( Convert.ToString( Settings["border"] ) != "" ) { lstBanners.ItemStyle.BorderWidth = Unit.Parse( Convert.ToString( Settings["border"] ) + "px" ); } if( Convert.ToString( Settings["bordercolor"] ) != "" ) { ColorConverter objColorConverter = new ColorConverter(); lstBanners.ItemStyle.BorderColor = (Color)objColorConverter.ConvertFrom( Convert.ToString( Settings["bordercolor"] ) ); } // item attributes lstBanners.ItemStyle.VerticalAlign = VerticalAlign.Middle; if( Convert.ToString( Settings["rowheight"] ) != "" ) { lstBanners.ItemStyle.Height = Unit.Parse( Convert.ToString( Settings["rowheight"] ) + "px" ); } if( Convert.ToString( Settings["colwidth"] ) != "" ) { lstBanners.ItemStyle.Width = Unit.Parse( Convert.ToString( Settings["colwidth"] ) + "px" ); } } else { lstBanners.Visible = false; } } catch( Exception exc ) //Module failed to load { Exceptions.ProcessModuleLoadException( this, exc ); } }
/// ----------------------------------------------------------------------------- /// <summary> /// DNNTxtBannerGroup_PopulateOnDemand runs when something is entered on the /// BannerGroup field /// </summary> /// <remarks> /// </remarks> /// <history> /// [vmasanas] 9/29/2006 Implement a callback to display current groups /// to user so the BannerGroup can be easily selected /// </history> /// ----------------------------------------------------------------------------- protected void PopulateBannersOnDemand(object source, DNNTextSuggestEventArgs e) { var objBanners = new BannerController(); var dt = objBanners.GetBannerGroups(PortalId); dt.CaseSensitive = false; var dr = dt.Select("GroupName like '" + e.Text + "%'"); foreach (var d in dr) { var objNode = new DNNNode(d["GroupName"].ToString()) {ID = e.Nodes.Count.ToString()}; e.Nodes.Add(objNode); } }
/// <summary> /// The Page_Load event handler on this User Control is used to /// obtain a DataReader of banner information from the Banners /// table, and then databind the results to a templated DataList /// server control. It uses the DotNetNuke.BannerDB() /// data component to encapsulate all data functionality. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <remarks></remarks> protected override void OnLoad(EventArgs e) { base.OnLoad(e); //exit without displaying banners to crawlers if (Request.Browser.Crawler) { return; } try { int intPortalId = 0; int intBannerTypeId = 0; string strBannerGroup; int intBanners = 0; //banner parameters switch (Convert.ToString(Settings["bannersource"])) { case "L": //local case "": intPortalId = PortalId; break; case "G": //global intPortalId = Null.NullInteger; break; } if (!String.IsNullOrEmpty(Convert.ToString(Settings["bannertype"]))) { intBannerTypeId = Int32.Parse(Convert.ToString(Settings["bannertype"])); } strBannerGroup = Convert.ToString(Settings["bannergroup"]); if (!String.IsNullOrEmpty(Convert.ToString(Settings["bannercount"]))) { intBanners = Int32.Parse(Convert.ToString(Settings["bannercount"])); } if (!String.IsNullOrEmpty(Convert.ToString(Settings["padding"]))) { lstBanners.CellPadding = Int32.Parse(Convert.ToString(Settings["padding"])); } //load banners if (intBanners != 0) { var objBanners = new BannerController(); lstBanners.DataSource = objBanners.LoadBanners(intPortalId, ModuleId, intBannerTypeId, strBannerGroup, intBanners); lstBanners.DataBind(); } //set banner display characteristics if (lstBanners.Items.Count != 0) { //container attributes lstBanners.RepeatLayout = RepeatLayout.Table; if (!String.IsNullOrEmpty(Convert.ToString(Settings["orientation"]))) { switch (Convert.ToString(Settings["orientation"])) { case "H": lstBanners.RepeatDirection = RepeatDirection.Horizontal; break; case "V": lstBanners.RepeatDirection = RepeatDirection.Vertical; break; } } else { lstBanners.RepeatDirection = RepeatDirection.Vertical; } if (!String.IsNullOrEmpty(Convert.ToString(Settings["border"]))) { lstBanners.ItemStyle.BorderWidth = Unit.Parse(Convert.ToString(Settings["border"]) + "px"); } if (!String.IsNullOrEmpty(Convert.ToString(Settings["bordercolor"]))) { var objColorConverter = new ColorConverter(); lstBanners.ItemStyle.BorderColor = (Color) objColorConverter.ConvertFrom(Convert.ToString(Settings["bordercolor"])); } //item attributes if (!String.IsNullOrEmpty(Convert.ToString(Settings["rowheight"]))) { lstBanners.ItemStyle.Height = Unit.Parse(Convert.ToString(Settings["rowheight"]) + "px"); } if (!String.IsNullOrEmpty(Convert.ToString(Settings["colwidth"]))) { lstBanners.ItemStyle.Width = Unit.Parse(Convert.ToString(Settings["colwidth"]) + "px"); } } else { lstBanners.Visible = false; } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
public string FormatItem(int VendorId, int BannerId, int BannerTypeId, string BannerName, string ImageFile, string Description, string URL, int Width, int Height) { var objBanners = new BannerController(); return objBanners.FormatBanner(VendorId, BannerId, BannerTypeId, BannerName, ImageFile, Description, URL, Width, Height, PortalId == -1 ? "G" : "L", PortalSettings.HomeDirectory); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); //exit without incrementing count if page is indexed by crawler if (Request.Browser.Crawler) { return; } try { if ((Request.QueryString["vendorid"] != null) && (Request.QueryString["bannerid"] != null)) { int intVendorId = -1; if (Regex.IsMatch(Request.QueryString["vendorid"], "^\\d+$")) { intVendorId = int.Parse(Request.QueryString["vendorid"]); } int intBannerId = -1; if (Regex.IsMatch(Request.QueryString["bannerid"], "^\\d+$")) { intBannerId = int.Parse(Request.QueryString["bannerid"]); } int intPortalId = -1; if ((Request.QueryString["portalid"] != null)) { if (Regex.IsMatch(Request.QueryString["portalid"], "^\\d+$")) { intPortalId = int.Parse(Request.QueryString["portalid"]); } } else { intPortalId = Globals.GetPortalSettings().PortalId; } if (intBannerId != -1 && intVendorId != -1 && intPortalId != -1) { string strURL = "~/" + Globals.glbDefaultPage; var objBanners = new BannerController(); BannerInfo objBanner = objBanners.GetBanner(intBannerId); if (objBanner != null) { if (objBanners.IsBannerActive(objBanner)) { if (!Null.IsNull(objBanner.URL)) { strURL = Globals.LinkClick(objBanner.URL, -1, -1, false); } else { var objVendors = new VendorController(); VendorInfo objVendor = objVendors.GetVendor(objBanner.VendorId, intPortalId); if (objVendor == null) { objVendor = objVendors.GetVendor(objBanner.VendorId, Null.NullInteger); } if (objVendor != null) { if (!String.IsNullOrEmpty(objVendor.Website)) { strURL = Globals.AddHTTP(objVendor.Website); } } } objBanners.UpdateBannerClickThrough(intBannerId, intVendorId); } } else if (Request.UrlReferrer != null) { strURL = Request.UrlReferrer.ToString(); } Response.Redirect(strURL, true); } } } catch (Exception exc) //Page failed to load { Exceptions.ProcessPageLoadException(exc); } }
public string FormatItem( int vendorId, int bannerId, int bannerTypeId, string bannerName, string imageFile, string description, string url, int width, int height ) { BannerController objBanners = new BannerController(); return objBanners.FormatBanner( vendorId, bannerId, bannerTypeId, bannerName, imageFile, description, url, width, height, Convert.ToString( PortalSettings.BannerAdvertising == 1 ? "L" : "G" ), PortalSettings.HomeDirectory ); }