using System; using System.Data; using System.Collections; using System.Web; using System.Web.UI; using CMS.GlobalHelper; using CMS.PortalControls; using CMS.Reporting; using CMS.CMSHelper; using CMS.PortalEngine; public partial class CMSWebParts_Reporting_Value : CMSAbstractWebPart { #region "Properties" /// /// Value set by report name and value. /// public string ReportValue { get { return ValidationHelper.GetString(GetValue("ReportValue"), String.Empty); } set { SetValue("ReportValue", value); } } /// /// Gets or sets the XML schema of parameters dataset. /// public string ParametersXmlSchema { get { return ValidationHelper.GetString(GetValue("ParametersXmlSchema"), String.Empty); } set { SetValue("ParametersXmlSchema", value); } } /// /// If true, chart subscription is enabled /// public bool EnableSubscription { get { return ValidationHelper.GetBoolean(GetValue("EnableSubscription"), false); } set { SetValue("EnableSubscription", value); } } /// /// Gets or sets chart name in format reportname;itemname. /// public string ParametersXmlData { get { return ValidationHelper.GetString(GetValue("ParametersXmlData"), String.Empty); } set { SetValue("ParametersXmlData", value); } } #endregion #region "Methods" /// /// Content loaded event handler. /// public override void OnContentLoaded() { base.OnContentLoaded(); SetupControl(); } /// /// Initializes the control properties. /// protected void SetupControl() { if (StopProcessing) { // Do nothing } else { string[] items = ReportValue.Split(';'); if ((items != null) && (items.Length == 2)) { ucValue.Parameter = items[0] + "." + items[1]; ucValue.ReportItemName = items[0] + ";" + items[1]; ucValue.CacheItemName = CacheItemName; ucValue.CacheMinutes = CacheMinutes; ucValue.CacheDependencies = CacheDependencies; ucValue.ItemType = ReportItemType.Graph; ucValue.LoadDefaultParameters(ParametersXmlData, ParametersXmlSchema); ucValue.EnableSubscription = EnableSubscription; ucValue.IsLiveSite = (CMSContext.ViewMode == ViewModeEnum.LiveSite); ; ucValue.ReloadData(true); } } } /// /// Reloads data. /// public override void ReloadData() { base.ReloadData(); SetupControl(); } /// /// OnPreRender override - set visibility. /// protected override void OnPreRender(EventArgs e) { // Set visibility of current webpart with dependence on graph visibility Visible = ucValue.Visible; base.OnPreRender(e); } #endregion }