HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/TDijk1/erp-apps.eu/wwwroot/CMSWebParts/Pux/Ecommerce/ManufacturerDetail.ascx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CMS.PortalControls;
using CMS.Helpers;
using CMS.Ecommerce;
using CMS.Controls;

public partial class CMSWebParts_Pux_Ecommerce_ManufacturerDetail : CMSAbstractWebPart
{
    public class ManufacturereItem
    {
        public string Name { get; set; }
        public string CodeName { get; set; }
        public string Description { get; set; }
        public string Website { get; set; }
        public string Logo { get; set; }
        public string ERPID { get; set; }
        public bool IsLogo { get; set; }
    }

    public string CodeName
    {
        get
        {
            return QueryHelper.GetString("codename", String.Empty).ToLowerInvariant();
            //return ValidationHelper.GetString(GetValue("CodeName"), string.Empty);
        }
        //set
        //{
        //    SetValue("CodeName", value);
        //}
    }

    private ManufacturereItem _manufacturer = null;
    public ManufacturereItem Manufacturer
    {
        get
        {
            if (_manufacturer == null)
            {
                var item = ManufacturerInfoProvider.GetManufacturerInfo(CodeName, CurrentSite.SiteName);

                _manufacturer = new ManufacturereItem()
                {
                    Name = item.ManufacturerDisplayName,
                    CodeName = item.ManufacturerName,
                    Description = item.ManufacturerDescription,
                    Website = item.ManufacturerHomepage,
                    Logo = "/CMSPages/GetMetaFile.aspx?fileguid=" + item.ManufacturerThumbnailGUID,
                    IsLogo = (item.ManufacturerThumbnailGUID == Guid.Empty) ? false : true
                };
            }

            return _manufacturer != null ? _manufacturer : new ManufacturereItem();
        }
    }

    #region "Control lifecycle"

    /// <summary>
    /// Content loaded event handler.
    /// </summary>
    //public override void OnContentLoaded()
    //{
    //    SetupControl();
    //    base.OnContentLoaded();
    //}

    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        SetupControl();
    }

    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (this.StopProcessing)
        {
            // Do not process
            this.Visible = false;
            return;
        }
        else
        {
            if (!string.IsNullOrEmpty(CodeName))
            {
                CMSWebParts_Pux_Comfor_Product_ProductList ProductListManufacturer = (CMSWebParts_Pux_Comfor_Product_ProductList)this.Page.LoadControl("~/CMSWebParts/Pux/Comfor/Product/ProductList.ascx");
                ProductListManufacturer.ManufacturerIDs = CodeName;
                ProductListManufacturer.Path = "/%";
                ProductListManufacturer.ShowHeader = true;
                pnlProducts.Controls.Add(ProductListManufacturer);

                plcLogoContainer.Visible = Manufacturer.IsLogo;
                plcContainer.Visible = !String.IsNullOrEmpty(Manufacturer.Description) || Manufacturer.IsLogo || !String.IsNullOrEmpty(Manufacturer.Website);
                plcDesctiptionContainer.Visible = !String.IsNullOrEmpty(Manufacturer.Description);
                plcWebsiteContainer.Visible = !String.IsNullOrEmpty(Manufacturer.Website);
            }
           
        }
    }

    /// <summary>
    /// Reloads the control data.
    /// </summary>
    public override void ReloadData()
    {
        base.ReloadData();

        SetupControl();
    }

    #endregion
}