private void exportToPDFButton_Click(object sender, EventArgs e) { try { List <string> player1Result = new List <string>() { player1StatusLabel.Text, player1LevelLabel.Text, player1PriceLabel.Text, player15050StatusLabel.Text, player1PhoneCallStatusLabel.Text, player1AskAudienceStatusLabel.Text }; List <string> player2Result = new List <string>() { player2StatusLabel.Text, player2LevelLabel.Text, player2PriceLabel.Text, player25050StatusLabel.Text, player2PhoneCallStatusLabel.Text, player2AskAudienceStatusLabel.Text }; List <string> player3Result = new List <string>() { player3StatusLabel.Text, player3LevelLabel.Text, player3PriceLabel.Text, player35050StatusLabel.Text, player3PhoneCallStatusLabel.Text, player3AskAudienceStatusLabel.Text }; List <string> player4Result = new List <string>() { player4StatusLabel.Text, player4LevelLabel.Text, player4PriceLabel.Text, player45050StatusLabel.Text, player4PhoneCallStatusLabel.Text, player4AskAudienceStatusLabel.Text }; SaveFileDialog openFileDialog = new SaveFileDialog(); openFileDialog.Title = "Where to save your PDF?"; openFileDialog.Filter = "*.pdf|"; openFileDialog.FileName = "Game-Report.pdf"; openFileDialog.DefaultExt = "pdf"; openFileDialog.ValidateNames = true; openFileDialog.RestoreDirectory = true; openFileDialog.ShowDialog(); PDFHandler pHandler = new PDFHandler(openFileDialog.FileName); pHandler.createPDF(player1Result, player2Result, player3Result, player4Result); MetroMessageBox.Show(this, String.Format("{0} is created", openFileDialog.FileName), "", MessageBoxButtons.OK, MessageBoxIcon.Information, 150); log.Info(String.Format("{0} is created", openFileDialog.FileName)); } catch (Exception ex) { MetroMessageBox.Show(this, String.Format("Error: {0}", ex.Message), "", MessageBoxButtons.OK, MessageBoxIcon.Error, 150); log.Info(String.Format("Error: {0}", ex.Message)); } }
/// <summary> /// created and opens the modules that belongs to the clicked job and redirects the user to the edit module page /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void jobList_Click(object sender, BulletedListEventArgs e) { String text = jobList.Items[e.Index].Text; int objId = Int16.Parse(text.Remove(text.IndexOf(':'))); Job job = jobLogic.getJobById(objId); if (job != null) { PDFHandler handler = new PDFHandler(); Modul module = logic.getModulById(job.ModulID); handler.CreatePDF(module, Server); if (HttpContext.Current.User.IsInRole("Freigabeberechtigter") || HttpContext.Current.User.IsInRole("Koordinator")) { Response.Redirect(@"http://*****:*****@"http://localhost:56639/ModulBearbeiten.aspx?ModulID=" + job.ModulID); } } }