/// <summary>
        /// Расчитываем отчет
        /// </summary>
        private void RenderReport(MultiPsSelectedArgs args)
        {
            BusinessObjectHelper.BuildBusinessObjectsParams(_businessObjectName, args);

            LayoutGrid.RunAsync(() =>
            {
                string result = string.Empty;
                try
                {
                    var errs = new StringBuilder();
                    result   = StimulReportsProcedures.RenderReport(_xml, errs, args, Manager.Config.TimeZone);
                    if (errs.Length > 0)
                    {
                        Manager.UI.ShowMessage(errs.ToString());
                    }
                }
                catch (Exception ex)
                {
                    Manager.UI.ShowMessage(ex.Message);
                }

                return(result);
            }, rendered =>
            {
                if (string.IsNullOrEmpty(rendered) || rendered.Length <= 2)
                {
                    return;
                }

                _businessObjectName = string.Empty;
                _xml = null;
                try
                {
                    DesignerControl.ApplyRenderedReport(rendered);
                }
                catch (Exception ex)
                {
                    Manager.UI.ShowMessage(ex.Message);
                }
            });
        }
        protected override bool Execute(System.Activities.CodeActivityContext context)
        {
            Error.Set(context, null);

            if (string.IsNullOrEmpty(Args))
            {
                Error.Set(context, "Не определены объекты для которых будет сформирован отчет");
                return(false);
            }

            MultiPsSelectedArgs args;

            try
            {
                args = Args.DeserializeFromString <MultiPsSelectedArgs>();
            }
            catch (Exception ex)
            {
                Error.Set(context, "Ошибка преобразования параметров " + ex.Message);
                return(false);
            }

            args.DtStart = StartDateTime.Get(context); //Начальная дата
            args.DtEnd   = EndDateTime.Get(context);   //Конечная дата
            var reportUn = Report_id.Get(context);

            var businessObjectName = string.Empty; //Определяем какой бизнес объект используется в отчете

            try
            {
                try
                {
                    if (!string.IsNullOrEmpty(reportUn))
                    {
                        businessObjectName = ServiceFactory.StimulReportInvokeSync <string>("GetUsedBusinessObjectsNames", reportUn);
                    }
                }
                catch (Exception ex)
                {
                    Error.Set(context, "Ошибка запроса бизнес модели отчета " + ex.Message);
                    return(false);
                }

                BusinessObjectHelper.BuildBusinessObjectsParams(businessObjectName, args);

                var errs       = new StringBuilder();
                var compressed = StimulReportsProcedures.LoadDocument(Report_id.Get(context), errs, args, ReportFormat, args.TimeZoneId);
                if (errs.Length > 0)
                {
                    Error.Set(context, errs.ToString());
                }


                if (compressed == null)
                {
                    Error.Set(context, "Ошибка загрузки документа");
                    return(false);
                }

                SendEmail(context, CompressUtility.DecompressGZip(compressed));
            }
            catch (Exception ex)
            {
                Error.Set(context, ex.Message);
                if (!HideException.Get(context))
                {
                    throw ex;
                }
            }

            return(string.IsNullOrEmpty(Error.Get(context)));
        }