Eliminate Annotation changes from Change Reports

Dialog for Email Error Log
This commit is contained in:
Rich 2012-04-26 22:06:37 +00:00
parent 3baf4f6fe9
commit b3c9d8791c
4 changed files with 558 additions and 1 deletions

View File

@ -593,6 +593,8 @@ namespace Volian.Controls.Library
RefreshList();
//if (lbChanges.Items.Count > 0)
//{
//jcb added 20120425 to suppress annotations in report
_AnnotationList = AnnotationAuditInfoList.GetChronology(0, 0);
OnChronologyPrintRequest(new DisplayHistoryReportEventArgs(Volian.Base.Library.VlnSettings.TemporaryFolder + @"\MyChronology.pdf", MyItemInfo.MyProcedure, _ChronologyAuditList, _AnnotationList));
//}
}
@ -601,7 +603,9 @@ namespace Volian.Controls.Library
RefreshList();
//if (lbChanges.Items.Count > 0)
//{
OnSummaryPrintRequest(new DisplayHistoryReportEventArgs(Volian.Base.Library.VlnSettings.TemporaryFolder + @"\MySummary.pdf", MyItemInfo.MyProcedure, _SummaryAuditList, _AnnotationList));
//jcb added 20120425 to suppress annotations in report
_AnnotationList = AnnotationAuditInfoList.GetChronology(0, 0);
OnSummaryPrintRequest(new DisplayHistoryReportEventArgs(Volian.Base.Library.VlnSettings.TemporaryFolder + @"\MySummary.pdf", MyItemInfo.MyProcedure, _SummaryAuditList, _AnnotationList));
//}
}
private void btnRefresh_Click(object sender, EventArgs e)

View File

@ -0,0 +1,266 @@
namespace Volian.Controls.Library
{
partial class frmSendErrorLog
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnSend = new DevComponents.DotNetBar.ButtonX();
this.btnCancel = new DevComponents.DotNetBar.ButtonX();
this.gpEmailSettings = new DevComponents.DotNetBar.Controls.GroupPanel();
this.rbOutlook = new System.Windows.Forms.RadioButton();
this.rbManual = new System.Windows.Forms.RadioButton();
this.tbServer = new System.Windows.Forms.TextBox();
this.tbUsername = new System.Windows.Forms.TextBox();
this.tbPassword = new System.Windows.Forms.TextBox();
this.lblServer = new System.Windows.Forms.Label();
this.lblUsername = new System.Windows.Forms.Label();
this.lblPassword = new System.Windows.Forms.Label();
this.panel1 = new System.Windows.Forms.Panel();
this.tbContent = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.gpEmailSettings.SuspendLayout();
this.SuspendLayout();
//
// btnSend
//
this.btnSend.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnSend.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnSend.Location = new System.Drawing.Point(306, 299);
this.btnSend.Name = "btnSend";
this.btnSend.Size = new System.Drawing.Size(75, 23);
this.btnSend.TabIndex = 0;
this.btnSend.Text = "Send";
this.btnSend.Click += new System.EventHandler(this.btnSend_Click);
//
// btnCancel
//
this.btnCancel.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnCancel.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(387, 299);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 1;
this.btnCancel.Text = "Cancel";
//
// gpEmailSettings
//
this.gpEmailSettings.CanvasColor = System.Drawing.SystemColors.Control;
this.gpEmailSettings.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
this.gpEmailSettings.Controls.Add(this.panel1);
this.gpEmailSettings.Controls.Add(this.lblPassword);
this.gpEmailSettings.Controls.Add(this.lblUsername);
this.gpEmailSettings.Controls.Add(this.lblServer);
this.gpEmailSettings.Controls.Add(this.tbPassword);
this.gpEmailSettings.Controls.Add(this.tbUsername);
this.gpEmailSettings.Controls.Add(this.tbServer);
this.gpEmailSettings.Controls.Add(this.rbManual);
this.gpEmailSettings.Controls.Add(this.rbOutlook);
this.gpEmailSettings.Location = new System.Drawing.Point(12, 169);
this.gpEmailSettings.Name = "gpEmailSettings";
this.gpEmailSettings.Size = new System.Drawing.Size(450, 124);
//
//
//
this.gpEmailSettings.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2;
this.gpEmailSettings.Style.BackColorGradientAngle = 90;
this.gpEmailSettings.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground;
this.gpEmailSettings.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.gpEmailSettings.Style.BorderBottomWidth = 1;
this.gpEmailSettings.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.gpEmailSettings.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.gpEmailSettings.Style.BorderLeftWidth = 1;
this.gpEmailSettings.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.gpEmailSettings.Style.BorderRightWidth = 1;
this.gpEmailSettings.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.gpEmailSettings.Style.BorderTopWidth = 1;
this.gpEmailSettings.Style.CornerDiameter = 4;
this.gpEmailSettings.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded;
this.gpEmailSettings.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center;
this.gpEmailSettings.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
this.gpEmailSettings.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near;
//
//
//
this.gpEmailSettings.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square;
//
//
//
this.gpEmailSettings.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.gpEmailSettings.TabIndex = 2;
this.gpEmailSettings.Text = "Email Settings";
//
// rbOutlook
//
this.rbOutlook.AutoSize = true;
this.rbOutlook.BackColor = System.Drawing.Color.Transparent;
this.rbOutlook.Checked = true;
this.rbOutlook.Location = new System.Drawing.Point(4, 4);
this.rbOutlook.Name = "rbOutlook";
this.rbOutlook.Size = new System.Drawing.Size(62, 17);
this.rbOutlook.TabIndex = 0;
this.rbOutlook.TabStop = true;
this.rbOutlook.Text = "Outlook";
this.rbOutlook.UseVisualStyleBackColor = false;
this.rbOutlook.CheckedChanged += new System.EventHandler(this.emailSettingChanged);
//
// rbManual
//
this.rbManual.AutoSize = true;
this.rbManual.BackColor = System.Drawing.Color.Transparent;
this.rbManual.Location = new System.Drawing.Point(4, 27);
this.rbManual.Name = "rbManual";
this.rbManual.Size = new System.Drawing.Size(101, 17);
this.rbManual.TabIndex = 1;
this.rbManual.Text = "Manual Settings";
this.rbManual.UseVisualStyleBackColor = false;
//
// tbServer
//
this.tbServer.Enabled = false;
this.tbServer.Location = new System.Drawing.Point(201, 26);
this.tbServer.Name = "tbServer";
this.tbServer.Size = new System.Drawing.Size(240, 20);
this.tbServer.TabIndex = 2;
//
// tbUsername
//
this.tbUsername.Enabled = false;
this.tbUsername.Location = new System.Drawing.Point(201, 53);
this.tbUsername.Name = "tbUsername";
this.tbUsername.Size = new System.Drawing.Size(240, 20);
this.tbUsername.TabIndex = 3;
//
// tbPassword
//
this.tbPassword.Enabled = false;
this.tbPassword.Location = new System.Drawing.Point(201, 80);
this.tbPassword.Name = "tbPassword";
this.tbPassword.PasswordChar = '*';
this.tbPassword.Size = new System.Drawing.Size(240, 20);
this.tbPassword.TabIndex = 4;
//
// lblServer
//
this.lblServer.AutoSize = true;
this.lblServer.BackColor = System.Drawing.Color.Transparent;
this.lblServer.Enabled = false;
this.lblServer.Location = new System.Drawing.Point(111, 29);
this.lblServer.Name = "lblServer";
this.lblServer.Size = new System.Drawing.Size(84, 13);
this.lblServer.TabIndex = 5;
this.lblServer.Text = "Outgoing Server";
//
// lblUsername
//
this.lblUsername.AutoSize = true;
this.lblUsername.BackColor = System.Drawing.Color.Transparent;
this.lblUsername.Enabled = false;
this.lblUsername.Location = new System.Drawing.Point(138, 56);
this.lblUsername.Name = "lblUsername";
this.lblUsername.Size = new System.Drawing.Size(55, 13);
this.lblUsername.TabIndex = 6;
this.lblUsername.Text = "Username";
//
// lblPassword
//
this.lblPassword.AutoSize = true;
this.lblPassword.BackColor = System.Drawing.Color.Transparent;
this.lblPassword.Enabled = false;
this.lblPassword.Location = new System.Drawing.Point(142, 83);
this.lblPassword.Name = "lblPassword";
this.lblPassword.Size = new System.Drawing.Size(53, 13);
this.lblPassword.TabIndex = 7;
this.lblPassword.Text = "Password";
//
// panel1
//
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel1.Location = new System.Drawing.Point(0, 23);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(447, 1);
this.panel1.TabIndex = 3;
//
// tbContent
//
this.tbContent.Location = new System.Drawing.Point(12, 38);
this.tbContent.Multiline = true;
this.tbContent.Name = "tbContent";
this.tbContent.Size = new System.Drawing.Size(450, 115);
this.tbContent.TabIndex = 3;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 13);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(165, 13);
this.label1.TabIndex = 4;
this.label1.Text = "Add additional comments below...";
//
// frmSendErrorLog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(474, 334);
this.Controls.Add(this.label1);
this.Controls.Add(this.tbContent);
this.Controls.Add(this.gpEmailSettings);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnSend);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "frmSendErrorLog";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Send Error Log to Volian Support";
this.gpEmailSettings.ResumeLayout(false);
this.gpEmailSettings.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private DevComponents.DotNetBar.ButtonX btnSend;
private DevComponents.DotNetBar.ButtonX btnCancel;
private DevComponents.DotNetBar.Controls.GroupPanel gpEmailSettings;
private System.Windows.Forms.RadioButton rbManual;
private System.Windows.Forms.RadioButton rbOutlook;
private System.Windows.Forms.Label lblPassword;
private System.Windows.Forms.Label lblUsername;
private System.Windows.Forms.Label lblServer;
private System.Windows.Forms.TextBox tbPassword;
private System.Windows.Forms.TextBox tbUsername;
private System.Windows.Forms.TextBox tbServer;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.TextBox tbContent;
private System.Windows.Forms.Label label1;
}
}

View File

@ -0,0 +1,167 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using LBOutlookLibrary;
using System.Reflection;
using VEPROMS.CSLA.Library;
using System.Text.RegularExpressions;
using System.Net.Mail;
using System.Net;
using System.IO;
namespace Volian.Controls.Library
{
public partial class frmSendErrorLog : Form
{
private string _ErrorLogPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS\ErrorLog.txt";
public bool OutlookEmail
{
get { return rbOutlook.Checked; }
set
{
if (value)
rbOutlook.Checked = true;
else
rbManual.Checked = true;
}
}
public string SMTPServer
{
get { return tbServer.Text; }
set { tbServer.Text = value; }
}
public string SMTPUser
{
get { return tbUsername.Text; }
set { tbUsername.Text = value; }
}
public frmSendErrorLog(bool outlookEmail, string smtpServer, string smtpUser)
{
InitializeComponent();
tbPassword.PasswordChar = '\u25CF';
OutlookEmail = outlookEmail;
SMTPServer = smtpServer;
SMTPUser = smtpUser;
}
private void emailSettingChanged(object sender, EventArgs e)
{
tbServer.Enabled = tbUsername.Enabled = tbPassword.Enabled =
lblServer.Enabled = lblUsername.Enabled = lblPassword.Enabled = rbManual.Checked;
}
private void btnSend_Click(object sender, EventArgs e)
{
if (OutlookEmail)
{
if (SendOutlookEmail())
{
this.DialogResult = DialogResult.OK;
this.Close();
}
}
else
{
if (SendSMTPEmail())
{
this.DialogResult = DialogResult.OK;
this.Close();
}
}
}
private bool SendSMTPEmail()
{
FileStream fs = null;
try
{
MailMessage mm = new MailMessage();
mm.From = new MailAddress(SMTPUser);
mm.To.Add("support@volian.com");
//mm.To.Add("rmark@epix.net");
//mm.To.Add("jcbodine@gmail.com");
mm.Subject = "PROMS Error Log " + DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss");
mm.Body = Header + "\r\n\r\n" + tbContent.Text;
fs = File.Open(_ErrorLogPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
mm.Attachments.Add(new Attachment(fs, "ErrorLog.txt"));
SmtpClient sc = new SmtpClient(SMTPServer);
sc.EnableSsl = true;
sc.Credentials = new NetworkCredential(SMTPUser, tbPassword.Text);
sc.Send(mm);
return true;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return false;
}
finally
{
fs.Close();
}
}
public string Header
{
get
{
StringBuilder sb = new StringBuilder();
//sb.Append("PROMS\t\tVersion: ");
sb.AppendLine("PROMS");
sb.Append("Version: ");
sb.Append(AssemblyVersion);
DateTime buildDateTime = new System.IO.FileInfo(Assembly.GetExecutingAssembly().Location).LastWriteTime;
sb.AppendLine(String.Format("\t\tBuild Date: {0}", buildDateTime.ToString()));
string connectionString = Database.VEPROMS_Connection;
Match mServer = Regex.Match(connectionString, ".*Data Source=([^;]*).*");
string server = (mServer.Success) ? mServer.Groups[1].Value : "unknown";
if (server.StartsWith(@".\")) server = @"Local \ " + server.Substring(2);
string databaseName = Database.SelectedDatabase;
sb.Append(string.Format("SQL Server: {0}", server));
sb.AppendLine(string.Format("\t\tDatabase: {0}", databaseName));
if (OutlookEmail)
sb.AppendLine("sent via outlook");
else
sb.AppendLine("sent via manual settings");
return sb.ToString();
}
}
private bool SendOutlookEmail()
{
try
{
LBApplicationClass app = new LBApplicationClass();
LBMailItemClass msg = app.CreateMailItem();
msg.Recipients.Add("support@volian.com");
//msg.Recipients.Add("rmark@epix.net");
//msg.Recipients.Add("jcbodine@gmail.com");
//msg.To = "jcbodine@gmail.com";//"rmark@epix.net";
//msg.Recipients.Add("jcbodine@gmail.com");
msg.Subject = "PROMS Error Log " + DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss");
msg.BodyFormat = LBOlBodyFormat.olFormatPlain;
msg.Body = Header + "\r\n\r\n" + tbContent.Text;
msg.AddAttachment(_ErrorLogPath);
msg.Send();
return true;
}
catch (Exception ex)
{
if (ex.Message.ToLower().Contains("failed due to the following error: 80080005"))
MessageBox.Show("You cannot send email via a running instance of Outlook from VE PROMS running from within Visual Studio.");
else
MessageBox.Show(string.Format("{0} - {1}", ex.GetType().Name, ex.Message));
return false;
}
}
public string AssemblyVersion
{
get
{
return Application.ProductVersion;
return Assembly.GetExecutingAssembly().GetName().Version.ToString();
}
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>