private void StartAsynch(object _linkBiInterface) { LinkBiInterface linkBiInterface = (LinkBiInterface)_linkBiInterface; string fileName = linkBiInterface.Render(); linkBiInterface.FileName = fileName; }
public bool Deploy() { bool result = true; Dictionary <LinkBiInterfaceType, string> exports = new Dictionary <LinkBiInterfaceType, string>(); // Run through all server connections. foreach (LinkBiServerConnection serverConnection in this.Properties.ServerConnections.Values) { // Check if an export with the server connection's interface type was already created. if (exports.ContainsKey(serverConnection.InterfaceType)) { continue; } LinkBiInterface exportInterface = null; switch (serverConnection.InterfaceType) { case LinkBiInterfaceType.PowerBI: exportInterface = new Excel(this.Core, this); break; case LinkBiInterfaceType.CustomCharts: exportInterface = new CustomCharts(this.Core, this); break; } if (exportInterface == null) { continue; } // Create the export for the server connection's provider. string fileName = exportInterface.Render(); exports.Add(serverConnection.InterfaceType, fileName); } // Run through all server connections. foreach (LinkBiServerConnection serverConnection in this.Properties.ServerConnections.Values) { // Deploy the file to the server. if (serverConnection.Deploy( exports[serverConnection.InterfaceType] ) == false) { result = false; } } return(result); }
private void GetProgress(HttpContext context) { if (HttpContext.Current.Session["CurrentLinkBiCreation"] == null) { context.Response.Write("-1"); } else { LinkBiInterface linkBiInterface = (LinkBiInterface)HttpContext.Current.Session["CurrentLinkBiCreation"]; context.Response.Write(linkBiInterface.Progress); } context.Response.ContentType = "text/plain"; }
public bool Deploy(Guid idServerConnection) { bool result = true; string export = null; if (!this.Properties.ServerConnections.ContainsKey(idServerConnection)) { return(false); } LinkBiServerConnection serverConnection = this.Properties.ServerConnections[idServerConnection]; LinkBiInterface exportInterface = null; switch (serverConnection.InterfaceType) { case LinkBiInterfaceType.PowerBI: exportInterface = new Excel(this.Core, this); break; case LinkBiInterfaceType.CustomCharts: exportInterface = new CustomCharts(this.Core, this); break; } if (exportInterface != null) { // Create the export for the server connection's provider. export = exportInterface.Render(); // Deploy the file to the server. if (serverConnection.Deploy( export ) == false) { result = false; } } else { return(false); } return(result); }
private void SendMail(LinkBiInterface linkBiInterface) { // Create a new mail configuration and load the // configuration values from the web.config file. MailConfiguration mailConfiguration = new MailConfiguration(true); // Create a new mail by the mail configuration. Mail mail = new Mail(mailConfiguration, Global.Core.ClientName); // Set the full path to the mail's template file. mail.TemplatePath = Path.Combine( Request.PhysicalApplicationPath, "App_Data", "MailTemplates", Global.Language.ToString(), "LinkBiExportFinished.html" ); // Add the placeholder value for the user's first name. mail.Placeholders.Add("FirstName", Global.User.FirstName); // Add the placeholder value for the user's last name. mail.Placeholders.Add("LastName", Global.User.LastName); mail.Placeholders.Add("imagepath", "http://" + Request.Url.Host.ToString() + "/Images/Logos/link.png"); mail.Attachments.Add( "LinkBiExport.xls", File.ReadAllBytes(linkBiInterface.FileName) ); try { // Send the mail. mail.Send(Global.User.Mail); } catch (Exception ex) { base.ShowMessage( string.Format(Global.LanguageManager.GetText("MailSendError"), Global.User.Mail, ex.Message), WebUtilities.MessageType.Error ); } }
private void Start(LinkBiInterface linkBiInterface) { if (chkMailMe.Checked) { linkBiInterface.SendMail = true; linkBiInterface.Language = Global.Language.ToString(); linkBiInterface.Request = Request; linkBiInterface.User = Global.User; } HttpContext.Current.Session["CurrentLinkBiCreation"] = linkBiInterface; ParameterizedThreadStart threadStart = new ParameterizedThreadStart(StartAsynch); Thread thread = new Thread(threadStart); thread.Start(linkBiInterface); Response.Redirect("Status.aspx"); }
protected void Page_Load(object sender, EventArgs e) { if (Request.Params["Method"] == "Download") { if (HttpContext.Current.Session["CurrentLinkBiCreation"] != null) { LinkBiInterface linkBiInterface = (LinkBiInterface)HttpContext.Current.Session["CurrentLinkBiCreation"]; base.WriteFileToResponse( linkBiInterface.FileName, "LinkBI" + (new FileInfo(linkBiInterface.FileName)).Extension, linkBiInterface.MimeType, true ); } return; } pnlProgress.Visible = false; pnlDownload.Visible = false; if (HttpContext.Current.Session["CurrentLinkBiCreation"] != null) { LinkBiInterface linkBiInterface = (LinkBiInterface)HttpContext.Current.Session["CurrentLinkBiCreation"]; if (linkBiInterface.Progress < 100) { pnlProgress.Visible = true; } else { if (Request.Params["MailMe"] == "true") { SendMail(linkBiInterface); } pnlDownload.Visible = true; } } }