Пример #1
0
        public OperationDescription(ContractDescription contract, MethodInfo operationMethod, OperationContractAttribute contractAttribute)
        {
            Contract       = contract;
            Name           = contractAttribute.Name ?? GetNameByAction(contractAttribute.Action) ?? GetNameByMethod(operationMethod);
            SoapAction     = contractAttribute.Action ?? $"{contract.Namespace.TrimEnd('/')}/{contract.Name}/{Name}";
            IsOneWay       = contractAttribute.IsOneWay;
            DispatchMethod = operationMethod;

            ReturnType = operationMethod.ReturnType;
            if (ReturnType.IsGenericType && ReturnType.GetGenericTypeDefinition() == typeof(Task <>))
            {
                ReturnType = ReturnType.GenericTypeArguments[0];
            }

            IsMessageContractResponse = ReturnType.CustomAttributes
                                        .FirstOrDefault(ca => ca.AttributeType == typeof(MessageContractAttribute)) != null;

            AllParameters = operationMethod.GetParameters()
                            .Select((info, index) => CreateParameterInfo(info, index, contract))
                            .ToArray();
            InParameters = AllParameters
                           .Where(soapParam => soapParam.Direction != SoapMethodParameterDirection.OutOnlyRef)
                           .ToArray();
            OutParameters = AllParameters
                            .Where(soapParam => soapParam.Direction != SoapMethodParameterDirection.InOnly)
                            .ToArray();

            IsMessageContractRequest =
                InParameters.Length == 1 &&
                InParameters.First().Parameter.ParameterType
                .CustomAttributes
                .FirstOrDefault(ca =>
                                ca.AttributeType == typeof(MessageContractAttribute)) != null;

            var elementAttributes = operationMethod.ReturnParameter.GetCustomAttributes <XmlElementAttribute>().ToList();

            if (elementAttributes.Count > 1)
            {
                ReturnChoices = elementAttributes.Select(e => new ReturnChoice(e.Type, e.ElementName, e.Namespace));
            }
            else if (elementAttributes.Count == 1)
            {
                var elementAttribute = elementAttributes.First();
                ReturnElementName = elementAttribute.ElementName;
                ReturnNamespace   = elementAttribute.Form == XmlSchemaForm.Unqualified ? string.Empty : elementAttribute.Namespace;
            }

            ReturnName = operationMethod.ReturnParameter.GetCustomAttribute <MessageParameterAttribute>()?.Name ?? Name + "Result";

            ReplyAction = contractAttribute.ReplyAction ?? $"{Contract.Namespace.TrimEnd('/')}/{contract.Name}/{Name + "Response"}";

            var faultContractAttributes = operationMethod.GetCustomAttributes <FaultContractAttribute>();

            Faults = faultContractAttributes
                     .Where(a => a.DetailType?.Name != null)
                     .Select(a => a.DetailType)
                     .ToArray();

            ServiceKnownTypes = operationMethod.GetCustomAttributes <ServiceKnownTypeAttribute>(inherit: false);
        }
Пример #2
0
        public OperationDescription(ContractDescription contract, MethodInfo operationMethod, OperationContractAttribute contractAttribute)
        {
            Contract   = contract;
            Name       = contractAttribute.Name ?? operationMethod.Name;
            SoapAction = contractAttribute.Action ?? $"{contract.Namespace.TrimEnd('/')}/{contract.Name}/{Name}";
            IsOneWay   = contractAttribute.IsOneWay;
            IsMessageContractResponse =
                operationMethod
                .ReturnType
                .CustomAttributes
                .FirstOrDefault(ca => ca.AttributeType == typeof(MessageContractAttribute)) != null;
            ReplyAction    = contractAttribute.ReplyAction;
            DispatchMethod = operationMethod;

            AllParameters = operationMethod.GetParameters()
                            .Select((info, index) => CreateParameterInfo(info, index, contract))
                            .ToArray();
            InParameters = AllParameters
                           .Where(soapParam => soapParam.Direction != SoapMethodParameterDirection.OutOnlyRef)
                           .ToArray();
            OutParameters = AllParameters
                            .Where(soapParam => soapParam.Direction != SoapMethodParameterDirection.InOnly)
                            .ToArray();

            IsMessageContractRequest =
                InParameters.Length == 1 &&
                InParameters.First().Parameter.ParameterType
                .CustomAttributes
                .FirstOrDefault(ca =>
                                ca.AttributeType == typeof(MessageContractAttribute)) != null;

            ReturnName = operationMethod.ReturnParameter.GetCustomAttribute <MessageParameterAttribute>()?.Name ?? Name + "Result";
        }
Пример #3
0
    /// <summary>
    /// Renders control to String representation
    /// </summary>
    /// <param name="siteID">This SiteID is used in report query instead of default CMSContext one</param>
    public String RenderToString(int siteID)
    {
        // Change siteID from context to subscription id
        AllParameters.Add("CMSContextCurrentSiteID", siteID);

        // Reload data
        isSave = true;
        ReloadData(true);
        isSave = false;

        // If control is not visible - subscription (report's or all items) is not allowed or no data found
        if (!Visible)
        {
            return(String.Empty);
        }

        // Render to string
        StringBuilder    sb      = new StringBuilder();
        StringWriter     sw      = new StringWriter(sb);
        Html32TextWriter writer2 = new Html32TextWriter(sw);

        pnlContent.RenderControl(writer2);

        return(sb.ToString());
    }
Пример #4
0
            public static PageStatus Get(string name)
            {
                Parameter <PageStatus> value;

                if (AllParameters.TryGetValue(MakeKey(name), out value))
                {
                    return(value as PageStatus);
                }
                return(new PageStatus(name));
            }
 public CharacteristicsData(AllParameters characteristics)
 {
     level = characteristics.level;
     experience = characteristics.experience;
     toNextLevelExp = characteristics.toNextLevelExp;
     strength = characteristics.strength;
     health = characteristics.health;
     sniper = characteristics.sniper;
     freePoints = characteristics.freePoints;
 }
Пример #6
0
        private void AddParameter(MemberInfo info, Type parameterType, ParameterAttribute paramAttribute)
        {
            var paramInfo = new CommandParameterInfo(info, parameterType, paramAttribute);

            if (!NamedParameters.ContainsKey(paramInfo.Name))
            {
                NamedParameters[paramInfo.Name] = paramInfo;
            }
            AllParameters.Add(paramInfo);
        }
 static void Main(string[] args)
 {
     AllParameters allParameters = new AllParameters();
     IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(allParameters));
     Marshal.StructureToPtr(allParameters,ptr, true);
     AllParameters item = new AllParameters();
     if (GetAllConsoleParameters(ref ptr))
     {
         var array = item.Parameters;
     }
 }
        internal bool TrySubmit()
        {
            var canSubmit = AllParameters.Any(p => p.IsRemoved) ||
                            AllParameters.Any(p => p is AddedParameterViewModel) ||
                            !_parametersWithoutDefaultValues.OfType <ExistingParameterViewModel>().Select(p => p.ParameterSymbol).SequenceEqual(_originalParameterConfiguration.ParametersWithoutDefaultValues.Cast <ExistingParameter>().Select(p => p.Symbol)) ||
                            !_parametersWithDefaultValues.OfType <ExistingParameterViewModel>().Select(p => p.ParameterSymbol).SequenceEqual(_originalParameterConfiguration.RemainingEditableParameters.Cast <ExistingParameter>().Select(p => p.Symbol));

            if (!canSubmit)
            {
                _notificationService.SendNotification(ServicesVSResources.You_must_change_the_signature, severity: NotificationSeverity.Information);
                return(false);
            }

            return(true);
        }
Пример #9
0
        public OperationDescription(ContractDescription contract, MethodInfo operationMethod, OperationContractAttribute contractAttribute)
        {
            Contract       = contract;
            Name           = contractAttribute.Name ?? GetNameByAction(contractAttribute.Action) ?? operationMethod.Name;
            SoapAction     = contractAttribute.Action ?? $"{contract.Namespace.TrimEnd('/')}/{contract.Name}/{Name}";
            IsOneWay       = contractAttribute.IsOneWay;
            ReplyAction    = contractAttribute.ReplyAction;
            DispatchMethod = operationMethod;

            var returnType = operationMethod.ReturnType;

            if (returnType.IsGenericType && returnType.GetGenericTypeDefinition() == typeof(Task <>))
            {
                returnType = returnType.GenericTypeArguments[0];
            }

            IsMessageContractResponse = returnType.CustomAttributes
                                        .FirstOrDefault(ca => ca.AttributeType == typeof(MessageContractAttribute)) != null;

            AllParameters = operationMethod.GetParameters()
                            .Select((info, index) => CreateParameterInfo(info, index, contract))
                            .ToArray();
            InParameters = AllParameters
                           .Where(soapParam => soapParam.Direction != SoapMethodParameterDirection.OutOnlyRef)
                           .ToArray();
            OutParameters = AllParameters
                            .Where(soapParam => soapParam.Direction != SoapMethodParameterDirection.InOnly)
                            .ToArray();

            IsMessageContractRequest =
                InParameters.Length == 1 &&
                InParameters.First().Parameter.ParameterType
                .CustomAttributes
                .FirstOrDefault(ca =>
                                ca.AttributeType == typeof(MessageContractAttribute)) != null;

            ReturnName = operationMethod.ReturnParameter.GetCustomAttribute <MessageParameterAttribute>()?.Name ?? Name + "Result";

            var faultContractAttributes = operationMethod.GetCustomAttributes <FaultContractAttribute>();

            Faults = faultContractAttributes
                     .Where(a => a.DetailType?.Name != null)
                     .Select(a => a.DetailType)
                     .ToArray();
        }
 public OperationDescription(ContractDescription contract, MethodInfo operationMethod, OperationContractAttribute contractAttribute)
 {
     Contract       = contract;
     Name           = contractAttribute.Name ?? operationMethod.Name;
     SoapAction     = contractAttribute.Action ?? $"{contract.Namespace.TrimEnd('/')}/{contract.Name}/{Name}";
     IsOneWay       = contractAttribute.IsOneWay;
     ReplyAction    = contractAttribute.ReplyAction;
     DispatchMethod = operationMethod;
     AllParameters  = operationMethod.GetParameters()
                      .Select((info, index) => CreateParameterInfo(info, index, contract))
                      .ToArray();
     InParameters = AllParameters
                    .Where(soapParam => soapParam.Direction != SoapMethodParameterDirection.OutOnlyRef)
                    .ToArray();
     OutParameters = AllParameters
                     .Where(soapParam => soapParam.Direction != SoapMethodParameterDirection.InOnly)
                     .ToArray();
     ReturnName = operationMethod.ReturnParameter.GetCustomAttribute <MessageParameterAttribute>()?.Name ?? Name + "Result";
 }
Пример #11
0
        /// <summary>
        ///     Get the amount of <see cref="BaseParam" /> present on the current item.
        /// </summary>
        /// <param name="param"><see cref="BaseParam" /> for which to get the amount.</param>
        /// <param name="includeNonBase">
        ///     A value indicating whether to include bonuses that are not primary or the item's base
        ///     parameter.
        /// </param>
        /// <returns>Returns the amount of <see cref="BaseParam" /> present on the current item.</returns>
        public int GetParameterValue(BaseParam baseParam, bool includeNonBase)
        {
            Parameter present = AllParameters.FirstOrDefault(_ => _.BaseParam == baseParam);

            // ReSharper disable InvertIf
            if (present == null)
            {
                return(0);
            }

            if (includeNonBase)
            {
                return((int)present.Cast <ParameterValueFixed>().Sum(p => p.Amount));
            }

            return
                ((int)
                 present.Where(_ => _.Type == ParameterType.Base || _.Type == ParameterType.Primary)
                 .Cast <ParameterValueFixed>()
                 .Sum(p => p.Amount));
        }
Пример #12
0
        public IEnumerable <string> KerbalNames()
        {
            // Find all the child items that store Kerbal names
            if (nameStorageItems == null)
            {
                nameStorageItems = new List <IKerbalNameStorage>();
                foreach (IKerbalNameStorage item in AllParameters.OfType <IKerbalNameStorage>().Union(
                             behaviours.OfType <IKerbalNameStorage>()))
                {
                    nameStorageItems.Add(item);
                }
            }

            foreach (IKerbalNameStorage item in nameStorageItems)
            {
                foreach (string name in item.KerbalNames())
                {
                    yield return(name);
                }
            }
        }
Пример #13
0
        static void BuildExpressionParameters(List<MenuAction> sourceActions)
        {
            //Find all unique menu parameters
            AllParameters.Clear();
            foreach (var action in sourceActions)
            {
                var param = GenerateParameter(action);
                if (param != null && IsNewParameter(param))
                    AllParameters.Add(param);

                param = GenerateParameterIsOpen(action);
                if(param != null && IsNewParameter(param))
                    AllParameters.Add(param);
            }
            bool IsNewParameter(ExpressionParameters.Parameter param)
            {
                foreach (var item in AllParameters)
                {
                    if (string.IsNullOrEmpty(item.name))
                        continue;
                    if (item.name == param.name)
                    {
                        if (item.valueType == param.valueType)
                            return false;
                        else
                        {
                            BuildFailed = true;
                            EditorUtility.DisplayDialog("Build Error", $"Unable to build VRCExpressionParameters. Parameter named '{item.name}' is used twice but with different types.", "Okay");
                            return false;
                        }
                    }
                }
                return true;
            }

            //Add
            foreach(var param in AllParameters)
                DefineExpressionParameter(param);
        }
        private List <SymbolDisplayPart> GetSignatureDisplayParts()
        {
            var displayParts = new List <SymbolDisplayPart>();

            displayParts.AddRange(_declarationParts);
            displayParts.Add(new SymbolDisplayPart(SymbolDisplayPartKind.Punctuation, null, "("));

            var first = true;

            foreach (var parameter in AllParameters.Where(p => !p.IsRemoved))
            {
                if (!first)
                {
                    displayParts.Add(new SymbolDisplayPart(SymbolDisplayPartKind.Punctuation, null, ","));
                    displayParts.Add(new SymbolDisplayPart(SymbolDisplayPartKind.Space, null, " "));
                }

                first = false;

                switch (parameter)
                {
                case ExistingParameterViewModel existingParameter:
                    displayParts.AddRange(existingParameter.ParameterSymbol.ToDisplayParts(s_parameterDisplayFormat));
                    break;

                case AddedParameterViewModel addedParameterViewModel:
                    var languageService = _document.GetLanguageService <IChangeSignatureViewModelFactoryService>();
                    displayParts.AddRange(languageService.GeneratePreviewDisplayParts(addedParameterViewModel));
                    break;

                default:
                    throw ExceptionUtilities.UnexpectedValue(parameter.GetType().ToString());
                }
            }

            displayParts.Add(new SymbolDisplayPart(SymbolDisplayPartKind.Punctuation, null, ")"));
            return(displayParts);
        }
Пример #15
0
        public OAuthRequest Sign(string tokenSecret)
        {
            String SigBaseStringParams = "";
            var    orderedParameters   = AllParameters.OrderBy(d => d.Key);

            foreach (var item in orderedParameters)
            {
                if (SigBaseStringParams != "")
                {
                    SigBaseStringParams += "&";
                }
                SigBaseStringParams += item.Key + "=" + item.Value;
            }

            String SigBaseString = Method.ToUpper() + "&";

            SigBaseString += OAuthEncoding.Encode(Url.ToString()) + "&" + OAuthEncoding.Encode(SigBaseStringParams);

            String Signature;

#if WINMD
            IBuffer KeyMaterial = CryptographicBuffer.ConvertStringToBinary(Context.ConsumerToken.Secret + "&" + tokenSecret, BinaryStringEncoding.Utf8);
            MacAlgorithmProvider HmacSha1Provider = MacAlgorithmProvider.OpenAlgorithm("HMAC_SHA1");
            CryptographicKey     MacKey           = HmacSha1Provider.CreateKey(KeyMaterial);
            IBuffer DataToBeSigned  = CryptographicBuffer.ConvertStringToBinary(SigBaseString, BinaryStringEncoding.Utf8);
            IBuffer SignatureBuffer = CryptographicEngine.Sign(MacKey, DataToBeSigned);
            Signature = CryptographicBuffer.EncodeToBase64String(SignatureBuffer);
#else
            HMACSHA1     myhmacsha1 = new HMACSHA1(Encoding.UTF8.GetBytes(Context.ConsumerToken.Secret + "&" + tokenSecret));
            byte[]       byteArray  = Encoding.UTF8.GetBytes(SigBaseString);
            MemoryStream stream     = new MemoryStream(byteArray);
            byte[]       hashValue  = myhmacsha1.ComputeHash(stream);
            Signature = System.Convert.ToBase64String(hashValue);
#endif
            AuthParameters.Add(OAuthParameters.SIGNATURE, Signature);

            return(this);
        }
Пример #16
0
        private bool EditableParameterSelected(out int index)
        {
            index = -1;

            if (!AllParameters.Any())
            {
                return(false);
            }

            if (!SelectedIndex.HasValue)
            {
                return(false);
            }

            index = SelectedIndex.Value;

            if (index == 0 && _thisParameter != null)
            {
                return(false);
            }

            return(true);
        }
Пример #17
0
        private List <SymbolDisplayPart> GetSignatureDisplayParts()
        {
            var displayParts = new List <SymbolDisplayPart>();

            displayParts.AddRange(_declarationParts);
            displayParts.Add(new SymbolDisplayPart(SymbolDisplayPartKind.Punctuation, null, "("));

            bool first = true;

            foreach (var parameter in AllParameters.Where(p => !p.IsRemoved))
            {
                if (!first)
                {
                    displayParts.Add(new SymbolDisplayPart(SymbolDisplayPartKind.Punctuation, null, ","));
                    displayParts.Add(new SymbolDisplayPart(SymbolDisplayPartKind.Space, null, " "));
                }

                first = false;
                displayParts.AddRange(parameter.ParameterSymbol.ToDisplayParts(_parameterDisplayFormat));
            }

            displayParts.Add(new SymbolDisplayPart(SymbolDisplayPartKind.Punctuation, null, ")"));
            return(displayParts);
        }
Пример #18
0
    /// <summary>
    /// Returns report graph.
    /// </summary>
    private void GetReportGraph(ReportGraphInfo reportGraph)
    {
        Visible         = true;
        ucChart.Visible = true;

        int correctWidth = 0;

        if (ComputedWidth != 0)
        {
            correctWidth = ModifyGraphInfo();
        }

        if (Width != String.Empty)
        {
            int graphWidth = ValidationHelper.GetInteger(Width, 0);
            if (graphWidth != 0)
            {
                reportGraph.GraphWidth = graphWidth;
            }
        }

        if (Height != 0)
        {
            reportGraph.GraphHeight = Height;
        }

        ReportGraph graph = new ReportGraph();

        graph.ChartControl = ucChart;

        ReportInfo report = ReportInfoProvider.GetReportInfo(reportGraph.GraphReportID);

        if (report == null)
        {
            return;
        }

        // Check graph security settings
        if (report.ReportAccess != ReportAccessEnum.All)
        {
            if (!CMSContext.CurrentUser.IsAuthenticated())
            {
                Visible = false;
                return;
            }
        }

        // Set default parametrs directly if not set
        if (ReportParameters == null)
        {
            // Load ReportInfo
            if (report != null)
            {
                FormInfo fi = new FormInfo(report.ReportParameters);
                // Get datarow with required columns
                ReportParameters = fi.GetDataRow();
                fi.LoadDefaultValues(ReportParameters, true);
            }
        }

        // If used via widget - this function ensure showing specific interval from actual time (f.e. last 6 weeks)
        ApplyTimeParameters();

        // Only use base parameters in case of stored procedure
        if (QueryIsStoredProcedure)
        {
            AllParameters = SpecialFunctions.ConvertDataRowToParams(ReportParameters, null);
        }

        ContextResolver resolver = CMSContext.CurrentResolver.CreateContextChild();

        // Indicaates whether exception was throw during data loading
        bool errorOccurred = false;

        // Create graph image
        try
        {
            // Resolve parameters in query
            resolver.SourceParameters = AllParameters.ToArray();

            // Resolve dynamic data macros
            if (DynamicMacros != null)
            {
                for (int i = 0; i <= DynamicMacros.GetUpperBound(0); i++)
                {
                    resolver.AddDynamicParameter(DynamicMacros[i, 0], DynamicMacros[i, 1]);
                }
            }

            // Prepare query attributes
            QueryText = resolver.ResolveMacros(reportGraph.GraphQuery);
            QueryIsStoredProcedure = reportGraph.GraphQueryIsStoredProcedure;

            // LoadData
            DataSet dsGraphData = LoadData();

            // Test if dataset is empty
            if (DataHelper.DataSourceIsEmpty(dsGraphData))
            {
                string noRecordText = ValidationHelper.GetString(reportGraph.GraphSettings["QueryNoRecordText"], String.Empty);
                if (noRecordText != String.Empty)
                {
                    lblInfo.Text    = noRecordText;
                    lblInfo.Visible = true;
                    ucChart.Visible = false;
                    menuCont.MenuID = String.Empty;
                    return;
                }
                Visible = false;
            }
            else
            {
                // Create Chart
                graph.CorrectWidth = correctWidth;
                graph.CreateChart(reportGraph, dsGraphData, resolver);
            }
        }
        catch (Exception ex)
        {
            EventLogProvider ev = new EventLogProvider();
            ev.LogEvent("Get report graph", "E", ex);
            graph.CorrectWidth = correctWidth;
            graph.CreateInvalidDataGraph(reportGraph, "Reporting.Graph.InvalidDataGraph", false);
            errorOccurred = true;
        }

        // Export data
        if ((report != null) && (!errorOccurred))
        {
            ProcessExport(ValidationHelper.GetCodeName(report.ReportDisplayName));
        }
    }
 private int SubParamCompleted()
 {
     return(AllParameters.Where(p => p.State == ParameterState.Complete).Count());
 }
Пример #20
0
    /// <summary>
    /// Returns report graph.
    /// </summary>
    private void GetReportGraph(ReportGraphInfo reportGraph)
    {
        // Check whether report graph is defined
        if (reportGraph == null)
        {
            return;
        }

        report = ReportInfoProvider.GetReportInfo(reportGraph.GraphReportID);
        //check graph security settings
        if (report.ReportAccess != ReportAccessEnum.All)
        {
            if (!CMSContext.CurrentUser.IsAuthenticated())
            {
                Visible = false;
                return;
            }
        }

        EnableSubscription = (EnableSubscription && ValidationHelper.GetBoolean(ReportGraphInfo.GraphSettings["SubscriptionEnabled"], true) && report.ReportEnableSubscription);
        if (EmailMode && !EnableSubscription)
        {
            this.Visible = false;
            return;
        }

        //Set default parametrs directly if not set
        if (ReportParameters == null)
        {
            //Load ReportInfo
            if (report != null)
            {
                FormInfo fi = new FormInfo(report.ReportParameters);
                // Get datarow with required columns
                ReportParameters = fi.GetDataRow(false);
                fi.LoadDefaultValues(ReportParameters, true);
            }
        }

        // Only use base parameters in case of stored procedure
        if (QueryIsStoredProcedure)
        {
            AllParameters = SpecialFunctions.ConvertDataRowToParams(ReportParameters, null);
        }

        // Indicaates whether exception was throw during data loading
        errorOccurred = false;

        // Create graph data
        try
        {
            ContextResolver resolver = CMSContext.CurrentResolver.CreateContextChild();
            //Resolve parameters in query
            resolver.SourceParameters = AllParameters.ToArray();

            // Resolve dynamic data macros
            if (DynamicMacros != null)
            {
                for (int i = 0; i <= DynamicMacros.GetUpperBound(0); i++)
                {
                    resolver.AddDynamicParameter(DynamicMacros[i, 0], DynamicMacros[i, 1]);
                }
            }

            //Prepare query attributes
            QueryText = resolver.ResolveMacros(reportGraph.GraphQuery);
            QueryIsStoredProcedure = reportGraph.GraphQueryIsStoredProcedure;

            // Load data
            DataSource = LoadData();

            if (DataHelper.DataSourceIsEmpty(DataSource) && EmailMode && SendOnlyNonEmptyDataSource)
            {
                Visible = false;
                return;
            }
        }
        catch (Exception ex)
        {
            EventLogProvider ev = new EventLogProvider();
            ev.LogEvent("Get report graph", "E", ex);
            lblError.Text    = ex.Message;
            lblError.Visible = true;
            errorOccurred    = true;
        }
    }
Пример #21
0
    /// <summary>
    /// Returns report graph.
    /// </summary>
    private void GetReportGraph(ReportGraphInfo reportGraph)
    {
        Visible         = true;
        ucChart.Visible = true;

        int correctWidth = 0;

        if (ComputedWidth != 0)
        {
            correctWidth = ModifyGraphInfo();
        }

        if (Width != String.Empty)
        {
            int graphWidth = ValidationHelper.GetInteger(Width, 0);
            if (graphWidth != 0)
            {
                reportGraph.GraphWidth = graphWidth;
            }
        }

        if (Height != 0)
        {
            reportGraph.GraphHeight = Height;
        }

        ReportGraph graph = new ReportGraph();

        graph.ChartControl = ucChart;

        report = ReportInfoProvider.GetReportInfo(reportGraph.GraphReportID);
        if (report == null)
        {
            return;
        }

        // Check graph security settings
        if (report.ReportAccess != ReportAccessEnum.All)
        {
            if (!CMSContext.CurrentUser.IsAuthenticated())
            {
                Visible = false;
                return;
            }
        }

        // Set default parametrs directly if not set
        if (ReportParameters == null)
        {
            // Load ReportInfo
            if (report != null)
            {
                FormInfo fi = new FormInfo(report.ReportParameters);

                // Get datarow with required columns
                ReportParameters = fi.GetDataRow(false);
                fi.LoadDefaultValues(ReportParameters, true);
            }
        }

        // If used via widget - this function ensure showing specific interval from actual time (f.e. last 6 weeks)
        ApplyTimeParameters();

        // Only use base parameters in case of stored procedure
        if (QueryIsStoredProcedure)
        {
            AllParameters = SpecialFunctions.ConvertDataRowToParams(ReportParameters, null);
        }

        ContextResolver resolver = CMSContext.CurrentResolver.CreateContextChild();

        errorOccurred = false;

        // Create graph image
        try
        {
            // Resolve parameters in query
            resolver.SourceParameters = AllParameters.ToArray();

            // Resolve dynamic data macros
            if (DynamicMacros != null)
            {
                for (int i = 0; i <= DynamicMacros.GetUpperBound(0); i++)
                {
                    resolver.AddDynamicParameter(DynamicMacros[i, 0], DynamicMacros[i, 1]);
                }
            }

            // Prepare query attributes
            QueryText = resolver.ResolveMacros(reportGraph.GraphQuery);
            QueryIsStoredProcedure = reportGraph.GraphQueryIsStoredProcedure;

            // LoadData
            DataSet dsGraphData = LoadData();

            // Empty dataset, and flag not send empty dataset is set
            if (SendOnlyNonEmptyDataSource && EmailMode && DataHelper.DataSourceIsEmpty(dsGraphData))
            {
                Visible = false;
                return;
            }

            // Test if dataset is empty
            if (DataHelper.DataSourceIsEmpty(dsGraphData))
            {
                string noRecordText = CMSContext.ResolveMacros(ValidationHelper.GetString(reportGraph.GraphSettings["QueryNoRecordText"], String.Empty));
                if (noRecordText != String.Empty)
                {
                    ltlEmail.Text   = noRecordText;
                    lblInfo.Text    = noRecordText;
                    ucChart.Visible = false;
                    menuCont.MenuID = String.Empty;
                    EnableExport    = false;
                    plcInfo.Visible = true;
                }
                else
                {
                    Visible = false;
                }
            }
            else
            {
                // Create Chart
                graph.CorrectWidth = correctWidth;
                if (EmailMode)
                {
                    byte[] data = graph.CreateChart(reportGraph, dsGraphData, resolver, true);
                    ltlEmail.Text = "##InlineImage##" + reportGraph.GraphName + "##InlineImage##";
                    ReportSubscriptionSender.AddToRequest(report.ReportName, "g" + reportGraph.GraphName, data);
                }
                else
                {
                    graph.CreateChart(reportGraph, dsGraphData, resolver);
                }
            }

            // Check if subscription is allowed
            EnableSubscription = (EnableSubscription && ValidationHelper.GetBoolean(ReportGraphInfo.GraphSettings["SubscriptionEnabled"], true) && report.ReportEnableSubscription);
            if (EmailMode && !EnableSubscription)
            {
                this.Visible = false;
                return;
            }
        }
        catch (Exception ex)
        {
            EventLogProvider ev = new EventLogProvider();
            ev.LogEvent("Get report graph", "E", ex);
            graph.CorrectWidth = correctWidth;
            graph.CreateInvalidDataGraph(reportGraph, "Reporting.Graph.InvalidDataGraph", false);
            errorOccurred = true;
        }
    }