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>
|
||||
<configSections>
|
||||
<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>
|
||||
<log4net>
|
||||
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
|
||||
@ -15,7 +18,7 @@
|
||||
</appender>
|
||||
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
|
||||
<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>
|
||||
</appender>
|
||||
<appender name="EventLogAppender" type="log4net.Appender.EventLogAppender">
|
||||
@ -41,7 +44,7 @@
|
||||
<eventLogEntryType value="Error" />
|
||||
</mapping>
|
||||
<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>
|
||||
</appender>
|
||||
<root>
|
||||
@ -65,7 +68,29 @@
|
||||
connectionString="Data Source=rhmdesktop\SQLEXPRESS;AttachDbFilename="C:\VS2005Projects\VEPROMS_USERS\VEPROMS_Users.mdf";Integrated Security=True;User Instance=True"
|
||||
providerName="System.Data.SqlClient" />-->
|
||||
<add name="VEPROMS"
|
||||
connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=VEPROMS;Integrated Security=True"
|
||||
providerName="System.Data.SqlClient" />
|
||||
connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=VEPROMS;Integrated Security=True"
|
||||
providerName="System.Data.SqlClient" />
|
||||
</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>
|
||||
|
@ -88,20 +88,35 @@ namespace DataLoader
|
||||
foreach (FileInfo fi in fis)
|
||||
{
|
||||
bool issub = (fi.Name.IndexOf("_") > 0) ? true : false;
|
||||
if (!issub && fi.Name.ToLower()!="baseall.xml")
|
||||
if (!issub && fi.Name.ToLower() != "baseall.xml")
|
||||
{
|
||||
string fmtname = fi.Name.Substring(0, fi.Name.Length - 7);
|
||||
// remove the all.xml part of the filename.
|
||||
parent = AddFormatToDB(basefmt, fmtname, issub, DateTime.Now, "Migration");
|
||||
|
||||
// now see if there are any subformats associated with this, if so
|
||||
// add them here...
|
||||
DirectoryInfo sdi = new DirectoryInfo("c:\\development\\fmtall");
|
||||
FileInfo[] sfis = di.GetFiles(fmtname+"_*.xml");
|
||||
foreach (FileInfo sfi in sfis)
|
||||
try
|
||||
{
|
||||
string nm = sfi.Name.Substring(0, sfi.Name.Length-7);
|
||||
Format subfmt = AddFormatToDB(parent, nm, true, DateTime.Now, "Migration");
|
||||
parent = AddFormatToDB(basefmt, fmtname, issub, DateTime.Now, "Migration");
|
||||
|
||||
// now see if there are any subformats associated with this, if so
|
||||
// add them here...
|
||||
DirectoryInfo sdi = new DirectoryInfo("c:\\development\\fmtall");
|
||||
FileInfo[] sfis = di.GetFiles(fmtname + "_*.xml");
|
||||
foreach (FileInfo sfi in sfis)
|
||||
{
|
||||
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");
|
||||
}
|
||||
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)
|
||||
{
|
||||
if (Properties.Settings.Default["VeSamFilename"] != null)
|
||||
if (Properties.Settings.Default["VeSamFilename"].ToString() != "")
|
||||
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;
|
||||
if (Properties.Settings.Default["LoadWordDoc"] != null)
|
||||
if (Properties.Settings.Default["LoadWordDoc"].ToString() != "")
|
||||
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;
|
||||
if (Properties.Settings.Default["LoadRTFDoc"] != null)
|
||||
if (Properties.Settings.Default["LoadRTFDoc"].ToString() != "")
|
||||
this.cbSaveRTF.CheckState = Properties.Settings.Default.LoadRTFDoc;
|
||||
if (Properties.Settings.Default["VePromsFilename"] != null)
|
||||
this.tbVePromsPath.Text = Properties.Settings.Default.VePromsFilename;
|
||||
@ -370,7 +370,6 @@ namespace DataLoader
|
||||
Properties.Settings.Default.VePromsFilename = tbVePromsPath.Text;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
|
||||
private void btnBrowseVeProms_Click(object sender, EventArgs e)
|
||||
{
|
||||
fbd.SelectedPath = tbVePromsPath.Text;
|
||||
|
Loading…
x
Reference in New Issue
Block a user