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

View File

@ -399,7 +399,7 @@ namespace VEPROMS
{
SetupForProcedure();
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;
Application.DoEvents();
frmStatus.ShowDialog();
@ -432,7 +432,7 @@ namespace VEPROMS
// Determine change bar settings. First get from config & then see if override from dialog.
// Also check that format allows override.
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();
this.Close();
ShowDebugFiles();
@ -632,11 +632,9 @@ namespace VEPROMS
itm.Save();
}
}
private void cbxDebug_CheckedChanged(object sender, EventArgs e)
{
cbxCmpPRMSpfd.Visible = cbxDebug.Checked;
}
//private void cbxDebug_CheckedChanged(object sender, EventArgs e)
//{
// 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
//UpdateProcedureConfig(pi, ap.RevNumber, ap.RevDate, myDTS);
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.CloseWhenDone = !ViewPDF;
frm.ShowDialog();

View File

@ -42,13 +42,13 @@ namespace VEPROMS
set { _OpenPDF = value; }
}
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;
InitializeComponent();
// 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.
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;
this.Text = "Creating PDF of " + myItem.DisplayNumber;
_NewLocation = newLocation;

View File

@ -29,7 +29,7 @@ namespace VEPROMS
public partial class frmVEPROMS : DevComponents.DotNetBar.Office2007RibbonForm
{
#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
#region PropertiesVariables
private bool _panelExpandedChanging = false;
@ -192,6 +192,10 @@ namespace VEPROMS
Properties.Settings.Default.DefaultDB = Database.SelectedDatabase;
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);
tv.Nodes.Add(tn);
tv.NodePSI += new vlnTreeViewPSIEvent(tv_NodePSI);
@ -233,7 +237,32 @@ namespace VEPROMS
tv.ReportAllProceduresInconsistencies += new vlnTreeViewEvent(tv_ReportAllProceduresInconsistencies);
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)
{
byte[] buffer;
@ -1855,7 +1884,7 @@ namespace VEPROMS
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)
{
Properties.Settings.Default.OutlookEmail = frm.OutlookEmail;

View File

@ -86,7 +86,7 @@ namespace PrintMSWord
changeBarData.ChangeBarMessage == "DateAndChgID" ? PrintChangeBarText.DateChgID :
changeBarData.ChangeBarMessage == "None" ? PrintChangeBarText.None :
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('\\','_'));
pp.StatusChanged += new PromsPrinterStatusEvent(pp_StatusChanged);
_ElapsedTime = new Dictionary<PromsPrinterStatusType, TimeSpan>();