Added try/catch logic to code that loads formats
Add defaults for user configuration data
This commit is contained in:
parent
9df3bccd71
commit
211e8b086c
@ -2,6 +2,9 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<configSections>
|
<configSections>
|
||||||
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
|
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
|
||||||
|
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||||
|
<section name="DataLoader.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
|
</sectionGroup>
|
||||||
</configSections>
|
</configSections>
|
||||||
<log4net>
|
<log4net>
|
||||||
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
|
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
|
||||||
@ -15,7 +18,7 @@
|
|||||||
</appender>
|
</appender>
|
||||||
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
|
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
|
||||||
<layout type="log4net.Layout.PatternLayout">
|
<layout type="log4net.Layout.PatternLayout">
|
||||||
<conversionPattern value="--> %date [%thread] %-5level %logger (%property{log4net:HostName}) [%ndc] - %message%newline" />
|
<conversionPattern value="--> %date [%thread] %-5level %logger (%property{log4net:HostName}) [%ndc] - %message%newline"/>
|
||||||
</layout>
|
</layout>
|
||||||
</appender>
|
</appender>
|
||||||
<appender name="EventLogAppender" type="log4net.Appender.EventLogAppender">
|
<appender name="EventLogAppender" type="log4net.Appender.EventLogAppender">
|
||||||
@ -41,7 +44,7 @@
|
|||||||
<eventLogEntryType value="Error" />
|
<eventLogEntryType value="Error" />
|
||||||
</mapping>
|
</mapping>
|
||||||
<layout type="log4net.Layout.PatternLayout">
|
<layout type="log4net.Layout.PatternLayout">
|
||||||
<param name="ConversionPattern" value="---> %d [%t] %-5p %c - %m%n" />
|
<param name="ConversionPattern" value="---> %d [%t] %-5p %c - %m%n"/>
|
||||||
</layout>
|
</layout>
|
||||||
</appender>
|
</appender>
|
||||||
<root>
|
<root>
|
||||||
@ -68,4 +71,26 @@
|
|||||||
connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=VEPROMS;Integrated Security=True"
|
connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=VEPROMS;Integrated Security=True"
|
||||||
providerName="System.Data.SqlClient" />
|
providerName="System.Data.SqlClient" />
|
||||||
</connectionStrings>
|
</connectionStrings>
|
||||||
|
<userSettings>
|
||||||
|
<DataLoader.Properties.Settings>
|
||||||
|
<setting name="VeSamFilename" serializeAs="String">
|
||||||
|
<value />
|
||||||
|
</setting>
|
||||||
|
<setting name="DbfPathname" serializeAs="String">
|
||||||
|
<value />
|
||||||
|
</setting>
|
||||||
|
<setting name="LoadWordDoc" serializeAs="String">
|
||||||
|
<value>Checked</value>
|
||||||
|
</setting>
|
||||||
|
<setting name="LoadRTFDoc" serializeAs="String">
|
||||||
|
<value>Unchecked</value>
|
||||||
|
</setting>
|
||||||
|
<setting name="PurgeData" serializeAs="String">
|
||||||
|
<value>Checked</value>
|
||||||
|
</setting>
|
||||||
|
<setting name="VePromsFilename" serializeAs="String">
|
||||||
|
<value />
|
||||||
|
</setting>
|
||||||
|
</DataLoader.Properties.Settings>
|
||||||
|
</userSettings>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
@ -92,6 +92,8 @@ namespace DataLoader
|
|||||||
{
|
{
|
||||||
string fmtname = fi.Name.Substring(0, fi.Name.Length - 7);
|
string fmtname = fi.Name.Substring(0, fi.Name.Length - 7);
|
||||||
// remove the all.xml part of the filename.
|
// remove the all.xml part of the filename.
|
||||||
|
try
|
||||||
|
{
|
||||||
parent = AddFormatToDB(basefmt, fmtname, issub, DateTime.Now, "Migration");
|
parent = AddFormatToDB(basefmt, fmtname, issub, DateTime.Now, "Migration");
|
||||||
|
|
||||||
// now see if there are any subformats associated with this, if so
|
// now see if there are any subformats associated with this, if so
|
||||||
@ -101,8 +103,21 @@ namespace DataLoader
|
|||||||
foreach (FileInfo sfi in sfis)
|
foreach (FileInfo sfi in sfis)
|
||||||
{
|
{
|
||||||
string nm = sfi.Name.Substring(0, sfi.Name.Length - 7);
|
string nm = sfi.Name.Substring(0, sfi.Name.Length - 7);
|
||||||
|
Console.WriteLine("Processing {0}", sfi.Name);
|
||||||
|
try
|
||||||
|
{
|
||||||
Format subfmt = AddFormatToDB(parent, nm, true, DateTime.Now, "Migration");
|
Format subfmt = AddFormatToDB(parent, nm, true, DateTime.Now, "Migration");
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("{0} - {1}", ex.GetType().Name, ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("{0} - {1}", ex.GetType().Name, ex.Message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -345,15 +345,15 @@ namespace DataLoader
|
|||||||
|
|
||||||
private void frmLoader_Load(object sender, EventArgs e)
|
private void frmLoader_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (Properties.Settings.Default["VeSamFilename"] != null)
|
if (Properties.Settings.Default["VeSamFilename"].ToString() != "")
|
||||||
this.tbVesamPath.Text = Properties.Settings.Default.VeSamFilename;
|
this.tbVesamPath.Text = Properties.Settings.Default.VeSamFilename;
|
||||||
if (Properties.Settings.Default["DbfPathname"] != null)
|
if (Properties.Settings.Default["DbfPathname"].ToString() != "")
|
||||||
this.tbSource.Text = Properties.Settings.Default.DbfPathname;
|
this.tbSource.Text = Properties.Settings.Default.DbfPathname;
|
||||||
if (Properties.Settings.Default["LoadWordDoc"] != null)
|
if (Properties.Settings.Default["LoadWordDoc"].ToString() != "")
|
||||||
this.cbSaveDoc.CheckState = Properties.Settings.Default.LoadWordDoc;
|
this.cbSaveDoc.CheckState = Properties.Settings.Default.LoadWordDoc;
|
||||||
if (Properties.Settings.Default["PurgeData"] != null)
|
if (Properties.Settings.Default["PurgeData"].ToString() != "")
|
||||||
this.cbPurgeData.CheckState = Properties.Settings.Default.PurgeData;
|
this.cbPurgeData.CheckState = Properties.Settings.Default.PurgeData;
|
||||||
if (Properties.Settings.Default["LoadRTFDoc"] != null)
|
if (Properties.Settings.Default["LoadRTFDoc"].ToString() != "")
|
||||||
this.cbSaveRTF.CheckState = Properties.Settings.Default.LoadRTFDoc;
|
this.cbSaveRTF.CheckState = Properties.Settings.Default.LoadRTFDoc;
|
||||||
if (Properties.Settings.Default["VePromsFilename"] != null)
|
if (Properties.Settings.Default["VePromsFilename"] != null)
|
||||||
this.tbVePromsPath.Text = Properties.Settings.Default.VePromsFilename;
|
this.tbVePromsPath.Text = Properties.Settings.Default.VePromsFilename;
|
||||||
@ -370,7 +370,6 @@ namespace DataLoader
|
|||||||
Properties.Settings.Default.VePromsFilename = tbVePromsPath.Text;
|
Properties.Settings.Default.VePromsFilename = tbVePromsPath.Text;
|
||||||
Properties.Settings.Default.Save();
|
Properties.Settings.Default.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnBrowseVeProms_Click(object sender, EventArgs e)
|
private void btnBrowseVeProms_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
fbd.SelectedPath = tbVePromsPath.Text;
|
fbd.SelectedPath = tbVePromsPath.Text;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user