protected override void GenerateReportTitle() { PdfPTable titleTable = null; if (this.reportTitleIconStatus == ReportTitleIconStatus.Alarm) { titleTable = PdfElementGenerator.createTable(new float[] { 0.84f, 0.04f, 0.12f }); } else if (this.reportTitleIconStatus == ReportTitleIconStatus.OK) { titleTable = PdfElementGenerator.createTable(new float[] { 0.89f, 0.04f, 0.07f }); } else { titleTable = PdfElementGenerator.createTable(new float[] { 0.89f, 0.04f, 0.07f }); } PdfPCell[] rowCells = titleTable.Rows[0].GetCells(); if (!string.IsNullOrWhiteSpace(this.Title)) { rowCells[0].Phrase = PdfElementGenerator.createDocumentTitlePhrase(this.Title.Trim() == ReportConstString.TitleDefaultString ? "" : this.Title); } if (this.reportTitleIconStatus == ReportTitleIconStatus.Alarm && reportCrossSmall != null) { rowCells[1].Image = this.getImage(Utils.CopyToBinary(reportCrossSmall)); rowCells[1].FixedHeight = 18; rowCells[2].Phrase = PdfElementGenerator.createDocumentTitlePhrase(ReportConstString.TitleAlarmString); } else if (this.reportTitleIconStatus == ReportTitleIconStatus.OK && reportOkSmall != null) { rowCells[1].Image = this.getImage(Utils.CopyToBinary(reportOkSmall)); rowCells[1].FixedHeight = 18; rowCells[2].Phrase = PdfElementGenerator.createDocumentTitlePhrase(ReportConstString.TitleOkString); } else { // nothing to do } rowCells[2].PaddingBottom = 0; rowCells[2].VerticalAlignment = Element.ALIGN_MIDDLE; document.Add(titleTable); PdfElementGenerator.AddEmptyParagraphToDocument(this.document, this.sectionMargin); }
protected override void GenerateReportTitle() { Range titleRange = this.getSectionRangeFromSummary(1); titleRange.Cells[1, 1] = this.Title.Trim() == ReportConstString.TitleDefaultString ? "" : this.Title; if (this.reportTitleIconStatus == ReportTitleIconStatus.Alarm) { Utils.SaveTheFile(Utils.CopyToBinary(reportCrossSmall), this.tempReportTitleIconPath); this.summary.Shapes.AddPicture(this.tempReportTitleIconPath, MsoTriState.msoFalse, MsoTriState.msoTrue, titleRange.Cells[1, 6].Left + 1, titleRange.Cells[1, 6].Top + 1, titleRange.Cells.Height - 1, titleRange.Cells.Height - 1); titleRange.Cells[1, 6] = string.Format(" {0}", ReportConstString.TitleAlarmString); } else if (this.reportTitleIconStatus == ReportTitleIconStatus.OK) { Utils.SaveTheFile(Utils.CopyToBinary(reportOkSmall), this.tempReportTitleIconPath); this.summary.Shapes.AddPicture(this.tempReportTitleIconPath, MsoTriState.msoFalse, MsoTriState.msoTrue, titleRange.Cells[1, 6].Left + 1, titleRange.Cells[1, 6].Top + 1, titleRange.Cells.Height - 1, titleRange.Cells.Height - 1); titleRange.Cells[1, 6] = string.Format(" {0}", ReportConstString.TitleOkString); } else { //nothing to do } titleRange.Font.Size = 12; titleRange.Font.Bold = true; }
private void InitEvents() { #region checkbox cbCompanyName.CheckedChanged += new EventHandler(delegate(object sender, EventArgs args) { this.tbCompanyName.Enabled = cbCompanyName.Checked; this.tbCompanyName.Focus(); }); cbAdress.CheckedChanged += new EventHandler(delegate(object sender, EventArgs args) { this.tbAdress.Enabled = this.cbAdress.Checked; tbAdress.Focus(); }); this.cbContactPhone.CheckedChanged += new EventHandler(delegate(object sender, EventArgs args) { this.tbContactPhone.Enabled = this.cbContactPhone.Checked; tbContactPhone.Focus(); }); this.cbEMail.CheckedChanged += new EventHandler(delegate(object sender, EventArgs args) { this.tbEMail.Enabled = this.cbEMail.Checked; tbEMail.Focus(); }); this.cbFax.CheckedChanged += new EventHandler(delegate(object sender, EventArgs args) { this.tbFax.Enabled = this.cbFax.Checked; tbFax.Focus(); }); this.cbReportTitle.CheckedChanged += new EventHandler(delegate(object sender, EventArgs args) { this.tbReportTitle.Enabled = this.cbReportTitle.Checked; tbReportTitle.Focus(); }); this.cbWebSite.CheckedChanged += new EventHandler(delegate(object sender, EventArgs args) { this.tbWebSite.Enabled = this.cbWebSite.Checked; tbWebSite.Focus(); }); this.cbLogo.CheckedChanged += new EventHandler(delegate(object sender, EventArgs args) { this.btnOpen.Enabled = this.cbLogo.Checked; btnOpen.Focus(); }); #endregion #region button this.btnOpen.Click += new EventHandler(delegate(object sender, EventArgs args){ OpenFileDialog file = new OpenFileDialog(); if (file.ShowDialog() == DialogResult.OK) { string src = file.FileName.ToString(); pbLogo.Image = System.Drawing.Image.FromFile(src); } }); this.btnSave.Click += new EventHandler(delegate(object sender, EventArgs args) { ReportConfig config; bool flag = false; if (ID == 0) { config = new ReportConfig(); config.Id = (int)(ID + 1); flag = true; } else { config = rc; flag = false; } config.ReportTitle = this.tbReportTitle.Text; config.CompanyName = this.tbCompanyName.Text; config.ContactPhone = this.tbCompanyName.Text; config.Email = this.tbEMail.Text; config.Fax = this.tbFax.Text; config.WebSite = this.tbWebSite.Text; config.Adress = this.tbAdress.Text; if (pbLogo.Image != null) { config.Logo = Utils.CopyToBinary(pbLogo.Image); } if (processor.InsertOrUpdate <ReportConfig>(config, null, flag)) { MessageBox.Show("Saved Corrected", "OK", MessageBoxButtons.OK); } else { MessageBox.Show("Saved Failure", "Error", MessageBoxButtons.OK); } }); #endregion }