Changed how Loader class processes 16-bit APL files

Added ReviewDate property to ProcInfo class
Changed how RevDate and ReviewDate values obtained from 16-bit data
Added AddSlaveNode and AddSlaveItem methods to ConfigInfo class
Added validity check to verify Procedure Set Path and Process Only In Location are in synch
This commit is contained in:
Rich 2012-12-04 22:32:34 +00:00
parent 44396a7200
commit 03d49ce2df
4 changed files with 64 additions and 54 deletions

View File

@ -7,16 +7,8 @@ namespace DataLoader
{
public partial class Loader
{
public bool BuildScopeApplicability()
{
bool rv = false;
//get scopes from proc.ini
rv |= CreateScopes();
//end get scopes from proc.ini
//get apl dictionary
Dictionary<string, Dictionary<string, string>> procAPLs = new Dictionary<string, Dictionary<string, string>>();
string[] procs = Directory.GetFiles(frmMain.MySettings.ProcedureSetPath, "PROC*.APL");
foreach (string proc in procs)
public Dictionary<string, string> MyProcAPL;
private static Dictionary<string, string> GetApple(string proc)
{
Dictionary<string, string> procAPL = new Dictionary<string, string>();
FileInfo myFile = new FileInfo(proc);
@ -40,26 +32,7 @@ namespace DataLoader
procAPL[recnum] = applicabilityToStr;
offset += 12;
}
procAPLs.Add(proc, procAPL);
}
//end get apl dictionary
rv = true;
return rv;
}
private bool CreateScopes()
{
string iniFile = string.Format(@"{0}\PROC.ini", frmMain.MySettings.ProcedureSetPath);
TextReader tr = File.OpenText(iniFile);
string line = string.Empty;
while (!line.StartsWith("Name="))
line = tr.ReadLine();
tr.Close();
string[] parts = line.Split('=');
string[] scopes = parts[1].Split(',');
foreach (string scope in scopes)
Console.WriteLine(scope);
return true;
return procAPL;
}
}
}

View File

@ -377,6 +377,12 @@ namespace DataLoader
get { return _RevDate; }
set { _RevDate = value; }
}
private string _ReviewDate;
public string ReviewDate
{
get { return _ReviewDate; }
set { _ReviewDate = value; }
}
public ProcInfo(DataRow dr, string afpath)
{
Number = dr["NUMBER"].ToString();
@ -396,9 +402,8 @@ namespace DataLoader
if (fis.Count > 0)
{
Rev = fis[0].Rev;
// the following line needs fixed, i.e. should the date come from the set file or
// the datetime stamp of dbf (GetDBFRevDate):
//RevDate = fis[0].RevDate ?? GetDBFRevDate(afpath);
RevDate = fis[0].RevDate ?? GetDBFRevDate(afpath);
ReviewDate = fis[0].ReviewDate;
}
}
public System.DateTime GetDTS(string date, string time)

View File

@ -80,6 +80,30 @@ namespace DataLoader
if (xmldoc != null) return xmldoc.InnerXml;
else return null;
}
public void AddSlaveNode(int index)
{
XmlElement slaves = xmldoc.SelectSingleNode("Config/Slaves") as XmlElement;
if (slaves == null)
{
slaves = xmldoc.CreateElement("Slaves");
xmldoc.DocumentElement.AppendChild(slaves);
}
XmlElement slave = xmldoc.CreateElement("Slave");
XmlAttribute xa = xmldoc.CreateAttribute("index");
xa.InnerText = index.ToString();
slave.Attributes.Append(xa);
slaves.AppendChild(slave);
}
public void AddSlaveItem(int index, string aname, string avalue)
{
string srch = "Config/Slaves/Slave[@index='" + index.ToString() + "']";
XmlElement slave = xmldoc.SelectSingleNode(srch) as XmlElement;
if (slave != null)
{
XmlAttribute xa = xmldoc.CreateAttribute(aname);
xa.InnerText = avalue;
slave.Attributes.Append(xa);
}
}
}
}

View File

@ -320,6 +320,14 @@ namespace DataLoader
}
}
}
//added by jcb 20121127
//check is ProcedureSetPath contains ProcessOnlyInLocation
if (ProcedureSetPath.StartsWith(ProcessOnlyInLocation) == false)
{
sb.Append(ErrorPrefix + "Check Process Only In Location value is pointing to similar directory as Procedure Set Path\r\n");
ErrorPrefix = "";
}
//end added by jcb 20121127
// BackupFileName = Has to be non-blank
if ((BackupFileName ?? "") == "")
{