Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                this.Title = "Отчеты";
            }

            var table = new Table();

            this.ReportLinkPanel.Controls.Add(table);

            var daschboardStorage    = new SchowcaseDataClassesDataContext();
            var distribDaschboarList = daschboardStorage.DashboardStorages.Where(c => c.StorageType == 1);

            if (distribDaschboarList.Any())
            {
                var distribDaschboar = distribDaschboarList.First();
                this.DownloadInstallerLinkButton.Text = $"Загрузить дистрибутив (опубликован {distribDaschboar.PublicationDate})";
            }
            else
            {
                this.DownloadInstallerLinkButton.Text = "Дистрибутив не найден в базе данных";
            }

            foreach (var daschboard in daschboardStorage.DashboardStorages.Where(c => c.StorageType == 0).OrderBy(c => c.DashboardOrder))
            {
                var text = $"{daschboard.Description}  ({daschboard.Identifier} {daschboard.PublicationDate})";
                var lb   = new LinkButton {
                    ID = daschboard.Identifier, Text = text, OnClientClick = "document.forms[0].target='_blank'"
                };
                lb.Click += this.LinkButtonClick;

                var row = new TableRow();
                table.Controls.Add(row);
                var cell = new TableCell();
                row.Controls.Add(cell);
                cell.Controls.Add(lb);
                if (daschboard.DashboardPreview != null)
                {
                    if (daschboard.DashboardPreview.Length > 0)
                    {
                        var myimage = new Image();
                        myimage.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(daschboard.DashboardPreview.ToArray(), 0, daschboard.DashboardPreview.ToArray().Length);
                        myimage.Height   = 150;
                        myimage.Width    = 300;
                        var imageCell = new TableCell();
                        row.Controls.Add(imageCell);
                        imageCell.Controls.Add(myimage);
                        //this.Image1.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(daschboard.DashboardPreview.ToArray(), 0, daschboard.DashboardPreview.ToArray().Length);
                    }
                }
            }
        }
Пример #2
0
 protected void MyDashboardViewer_DashboardLoading(object sender, DevExpress.DashboardWeb.DashboardLoadingEventArgs e)
 {
     try
     {
         var daschboardStorage = new SchowcaseDataClassesDataContext();
         var daschboardList    = daschboardStorage.DashboardStorages.Where(c => c.Identifier == e.DashboardId);
         if (daschboardList.Any())
         {
             var daschboard = daschboardList.First();
             e.DashboardXml = Encoding.UTF8.GetString(daschboard.DashboardBLOB.ToArray());
         }
         else
         {
             e.DashboardXml = string.Empty;
             this.Response.Write($"Графическая панель {e.DashboardId} отсутствует в базе данных!");
         }
     }
     catch (Exception ex)
     {
         this.Response.Write("Ошибка при формировании отчета: " + ex);
     }
 }
Пример #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         var daschboardStorage = new SchowcaseDataClassesDataContext();
         var daschboardList    = daschboardStorage.DashboardStorages.Where(c => c.StorageType == 1);
         if (daschboardList.Any())
         {
             var daschboard = daschboardList.First();
             var bytes      = daschboard.DashboardBLOB.ToArray();
             var stream     = new MemoryStream(bytes);
             this.Response.Clear();
             this.Response.AppendHeader(@"Content-Type", @"application/vnd.msign"); // Задаем тип документа
             this.Response.AppendHeader(@"Content-Transfer-Encoding", @"binary");
             this.Response.AppendHeader(@"Content-Disposition", "attachment; filename=SchowcaseDisainerSetup.msi");
             stream.WriteTo(this.Response.OutputStream);
         }
         else
         {
             this.Response.Write("Дистрибутив отсутствует отсутствует в базе данных!");
         }
     }
 }