Remove unused parameter from PromsPrinter constructor

Remove unused parameter from frmPDFStatusForm constructor
Remove event handler for cbxCheckedChanged
Set cbxCmpPRMSpfd to invisible since it is no longer needed
Remove unused parameter from frmPDFStatusForm constructor
Remove unused parameter from PromsPrinter constructor
Rename log static field to _MyLog
Set the Error Log file name to the Database name and the date of the previous Sunday - This will create a new error log file for each database each week
This commit is contained in:
Rich 2012-07-25 21:43:09 +00:00
parent 68d862f71f
commit 43203c4bdd
6 changed files with 42 additions and 15 deletions

View File

@ -1072,7 +1072,6 @@ namespace VEPROMS
this.cbxDebug.TabIndex = 98; this.cbxDebug.TabIndex = 98;
this.cbxDebug.Text = "Compare PDF"; this.cbxDebug.Text = "Compare PDF";
this.cbxDebug.UseVisualStyleBackColor = false; this.cbxDebug.UseVisualStyleBackColor = false;
this.cbxDebug.CheckedChanged += new System.EventHandler(this.cbxDebug_CheckedChanged);
// //
// cbxOrPgBrk // cbxOrPgBrk
// //
@ -1109,6 +1108,7 @@ namespace VEPROMS
this.cbxCmpPRMSpfd.TabIndex = 100; this.cbxCmpPRMSpfd.TabIndex = 100;
this.cbxCmpPRMSpfd.Text = "PROMS PDF to PROMS PDF"; this.cbxCmpPRMSpfd.Text = "PROMS PDF to PROMS PDF";
this.cbxCmpPRMSpfd.UseVisualStyleBackColor = false; this.cbxCmpPRMSpfd.UseVisualStyleBackColor = false;
this.cbxCmpPRMSpfd.Visible = false;
// //
// DlgPrintProcedure // DlgPrintProcedure
// //

View File

@ -399,7 +399,7 @@ namespace VEPROMS
{ {
SetupForProcedure(); SetupForProcedure();
this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n); this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNum, RevDate, pw.ToString(), cbxDebug.Checked, cbxOrPgBrk.Checked, cbxCmpPRMSpfd.Checked , cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, PDFPath, cbd, txbPDFName.Text, new Point(Left,Bottom)); frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNum, RevDate, pw.ToString(), cbxDebug.Checked, cbxOrPgBrk.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, PDFPath, cbd, txbPDFName.Text, new Point(Left,Bottom));
frmStatus.CloseWhenDone = true; frmStatus.CloseWhenDone = true;
Application.DoEvents(); Application.DoEvents();
frmStatus.ShowDialog(); frmStatus.ShowDialog();
@ -432,7 +432,7 @@ namespace VEPROMS
// Determine change bar settings. First get from config & then see if override from dialog. // Determine change bar settings. First get from config & then see if override from dialog.
// Also check that format allows override. // Also check that format allows override.
ChangeBarDefinition cbd = DetermineChangeBarSettings(); ChangeBarDefinition cbd = DetermineChangeBarSettings();
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNum, RevDate, pw.ToString(), cbxDebug.Checked, cbxOrPgBrk.Checked, cbxCmpPRMSpfd.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, PDFPath, cbd, txbPDFName.Text, new Point(Left, Bottom)); frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNum, RevDate, pw.ToString(), cbxDebug.Checked, cbxOrPgBrk.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, PDFPath, cbd, txbPDFName.Text, new Point(Left, Bottom));
frmStatus.ShowDialog(); frmStatus.ShowDialog();
this.Close(); this.Close();
ShowDebugFiles(); ShowDebugFiles();
@ -632,11 +632,9 @@ namespace VEPROMS
itm.Save(); itm.Save();
} }
} }
//private void cbxDebug_CheckedChanged(object sender, EventArgs e)
private void cbxDebug_CheckedChanged(object sender, EventArgs e) //{
{ // cbxCmpPRMSpfd.Visible = cbxDebug.Checked;
cbxCmpPRMSpfd.Visible = cbxDebug.Checked; //}
}
} }
} }

View File

@ -988,7 +988,7 @@ namespace VEPROMS
// Moved to end so that Item and Content are saved at the same time // Moved to end so that Item and Content are saved at the same time
//UpdateProcedureConfig(pi, ap.RevNumber, ap.RevDate, myDTS); //UpdateProcedureConfig(pi, ap.RevNumber, ap.RevDate, myDTS);
string waterMark = Stage.Get(RevStage).IsApproved > 0 ? null : Stage.Get(RevStage).Name; string waterMark = Stage.Get(RevStage).IsApproved > 0 ? null : Stage.Get(RevStage).Name;
frmPDFStatusForm frm = new frmPDFStatusForm(pi, ap.RevNumber, ap.RevDate.ToString("MM/dd/yyyy"), waterMark, false, false, false, ViewPDF, true, VlnSettings.TemporaryFolder, new ChangeBarDefinition(pi.MyDocVersion.MyConfig as DocVersionConfig, pi.ActiveFormat), pdfTmp, location); frmPDFStatusForm frm = new frmPDFStatusForm(pi, ap.RevNumber, ap.RevDate.ToString("MM/dd/yyyy"), waterMark, false, false, ViewPDF, true, VlnSettings.TemporaryFolder, new ChangeBarDefinition(pi.MyDocVersion.MyConfig as DocVersionConfig, pi.ActiveFormat), pdfTmp, location);
frm.AllowAllWatermarks = true; frm.AllowAllWatermarks = true;
frm.CloseWhenDone = !ViewPDF; frm.CloseWhenDone = !ViewPDF;
frm.ShowDialog(); frm.ShowDialog();

View File

@ -42,13 +42,13 @@ namespace VEPROMS
set { _OpenPDF = value; } set { _OpenPDF = value; }
} }
private Point _NewLocation; private Point _NewLocation;
public frmPDFStatusForm(ItemInfo myItem, string rev, string revDate, string watermark, bool debugOutput, bool origPgBrk, bool PromsToPROMSpdfCompare, bool openPDF, bool overWrite, string pdfPath, ChangeBarDefinition cbd,string pdfFile, Point newLocation) public frmPDFStatusForm(ItemInfo myItem, string rev, string revDate, string watermark, bool debugOutput, bool origPgBrk, bool openPDF, bool overWrite, string pdfPath, ChangeBarDefinition cbd,string pdfFile, Point newLocation)
{ {
OpenPDF = openPDF; OpenPDF = openPDF;
InitializeComponent(); InitializeComponent();
// if the version number of PROMS is 1.0, then we are running a Demo version. // if the version number of PROMS is 1.0, then we are running a Demo version.
// When running a Demo version, force a "Sample" watermark when printing. // When running a Demo version, force a "Sample" watermark when printing.
MyPromsPrinter = new PromsPrinter(myItem, rev, revDate, (VlnSettings.ReleaseMode.Equals("DEMO")) ? "Sample" : watermark, debugOutput, origPgBrk, PromsToPROMSpdfCompare, pdfPath + @"\\Compare", false, overWrite, cbd, pdfFile);//openPDF); MyPromsPrinter = new PromsPrinter(myItem, rev, revDate, (VlnSettings.ReleaseMode.Equals("DEMO")) ? "Sample" : watermark, debugOutput, origPgBrk, pdfPath + @"\\Compare", false, overWrite, cbd, pdfFile);//openPDF);
PDFPath = pdfPath; PDFPath = pdfPath;
this.Text = "Creating PDF of " + myItem.DisplayNumber; this.Text = "Creating PDF of " + myItem.DisplayNumber;
_NewLocation = newLocation; _NewLocation = newLocation;

View File

@ -29,7 +29,7 @@ namespace VEPROMS
public partial class frmVEPROMS : DevComponents.DotNetBar.Office2007RibbonForm public partial class frmVEPROMS : DevComponents.DotNetBar.Office2007RibbonForm
{ {
#region Log4Net #region Log4Net
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#endregion #endregion
#region PropertiesVariables #region PropertiesVariables
private bool _panelExpandedChanging = false; private bool _panelExpandedChanging = false;
@ -192,6 +192,10 @@ namespace VEPROMS
Properties.Settings.Default.DefaultDB = Database.SelectedDatabase; Properties.Settings.Default.DefaultDB = Database.SelectedDatabase;
Properties.Settings.Default.Save(); Properties.Settings.Default.Save();
} }
DateTime dtSunday = DateTime.Now.AddDays(-((int)DateTime.Now.DayOfWeek));
ChangeLogFileName("LogFileAppender", Database.SelectedDatabase + " " + dtSunday.ToString("yyyyMMdd") + " ErrorLog.txt");
_MyLog.InfoFormat("\r\nSession Beginning\r\n<===================== User: {0}/{1} Started {2} =====================>"
, Environment.UserDomainName,Environment.UserName, DateTime.Now.ToString("dddd MMMM d, yyyy h:mm:ss tt"));
VETreeNode tn = VETreeNode.GetFolder(1); VETreeNode tn = VETreeNode.GetFolder(1);
tv.Nodes.Add(tn); tv.Nodes.Add(tn);
tv.NodePSI += new vlnTreeViewPSIEvent(tv_NodePSI); tv.NodePSI += new vlnTreeViewPSIEvent(tv_NodePSI);
@ -233,7 +237,32 @@ namespace VEPROMS
tv.ReportAllProceduresInconsistencies += new vlnTreeViewEvent(tv_ReportAllProceduresInconsistencies); tv.ReportAllProceduresInconsistencies += new vlnTreeViewEvent(tv_ReportAllProceduresInconsistencies);
tv.ViewPDF += new vlnTreeViewPdfEvent(tv_ViewPDF); tv.ViewPDF += new vlnTreeViewPdfEvent(tv_ViewPDF);
} }
static string _ErrorLogFileName;
public static string ErrorLogFileName
{
get { return frmVEPROMS._ErrorLogFileName; }
set { frmVEPROMS._ErrorLogFileName = value; }
}
static bool ChangeLogFileName(string AppenderName, string NewFilename)
{
log4net.Repository.ILoggerRepository RootRep;
RootRep = log4net.LogManager.GetRepository();
foreach (log4net.Appender.IAppender iApp in RootRep.GetAppenders())
{
if (iApp.Name.CompareTo(AppenderName) == 0
&& iApp is log4net.Appender.FileAppender)
{
log4net.Appender.FileAppender fApp = (log4net.Appender.FileAppender)iApp;
string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
fApp.File = folderPath + @"\VEPROMS\" + NewFilename;
ErrorLogFileName = fApp.File;
fApp.ActivateOptions();
return true; // Appender found and name changed to NewFilename
}
}
return false;
}
void tv_ViewPDF(object sender, vlnTreeViewPdfArgs args) void tv_ViewPDF(object sender, vlnTreeViewPdfArgs args)
{ {
byte[] buffer; byte[] buffer;
@ -1855,7 +1884,7 @@ namespace VEPROMS
private void btnSendErrorLog_Click(object sender, EventArgs e) private void btnSendErrorLog_Click(object sender, EventArgs e)
{ {
frmSendErrorLog frm = new frmSendErrorLog(Properties.Settings.Default.OutlookEmail, Properties.Settings.Default["SMTPServer"].ToString(), Properties.Settings.Default["SMTPUser"].ToString()); frmSendErrorLog frm = new frmSendErrorLog(Properties.Settings.Default.OutlookEmail, Properties.Settings.Default["SMTPServer"].ToString(), Properties.Settings.Default["SMTPUser"].ToString(),ErrorLogFileName);
if (frm.ShowDialog(this) == DialogResult.OK) if (frm.ShowDialog(this) == DialogResult.OK)
{ {
Properties.Settings.Default.OutlookEmail = frm.OutlookEmail; Properties.Settings.Default.OutlookEmail = frm.OutlookEmail;

View File

@ -86,7 +86,7 @@ namespace PrintMSWord
changeBarData.ChangeBarMessage == "DateAndChgID" ? PrintChangeBarText.DateChgID : changeBarData.ChangeBarMessage == "DateAndChgID" ? PrintChangeBarText.DateChgID :
changeBarData.ChangeBarMessage == "None" ? PrintChangeBarText.None : changeBarData.ChangeBarMessage == "None" ? PrintChangeBarText.None :
changeBarData.ChangeBarMessage == "RevNum" ? PrintChangeBarText.RevNum : PrintChangeBarText.UserDef; changeBarData.ChangeBarMessage == "RevNum" ? PrintChangeBarText.RevNum : PrintChangeBarText.UserDef;
PromsPrinter pp = new PromsPrinter(myProcedure, tbRev.Text, tbRevDate.Text, cbWatermark.Text, cbDebugOutput.Checked, false, false, @"C:\TEMP\32Bit\Compare", openPdf, true, cbd, PromsPrinter pp = new PromsPrinter(myProcedure, tbRev.Text, tbRevDate.Text, cbWatermark.Text, cbDebugOutput.Checked, false, @"C:\TEMP\32Bit\Compare", openPdf, true, cbd,
myProcedure.DisplayNumber.Replace('/','_').Replace('\\','_')); myProcedure.DisplayNumber.Replace('/','_').Replace('\\','_'));
pp.StatusChanged += new PromsPrinterStatusEvent(pp_StatusChanged); pp.StatusChanged += new PromsPrinterStatusEvent(pp_StatusChanged);
_ElapsedTime = new Dictionary<PromsPrinterStatusType, TimeSpan>(); _ElapsedTime = new Dictionary<PromsPrinterStatusType, TimeSpan>();