diff --git a/PROMS/DataLoader/Applicability.cs b/PROMS/DataLoader/Applicability.cs index ebdcf239..a035ca6e 100644 --- a/PROMS/DataLoader/Applicability.cs +++ b/PROMS/DataLoader/Applicability.cs @@ -7,59 +7,32 @@ namespace DataLoader { public partial class Loader { - public bool BuildScopeApplicability() + public Dictionary MyProcAPL; + private static Dictionary GetApple(string proc) { - bool rv = false; - //get scopes from proc.ini - rv |= CreateScopes(); - //end get scopes from proc.ini - //get apl dictionary - Dictionary> procAPLs = new Dictionary>(); - string[] procs = Directory.GetFiles(frmMain.MySettings.ProcedureSetPath, "PROC*.APL"); - foreach (string proc in procs) + Dictionary procAPL = new Dictionary(); + FileInfo myFile = new FileInfo(proc); + FileStream fs = myFile.OpenRead(); + BinaryReader br = new BinaryReader(fs); + byte[] myBuff = new byte[myFile.Length]; + br.Read(myBuff, 0, (int)myFile.Length); + br.Close(); + fs.Close(); + int offset = 0; + while (offset < myBuff.Length) { - Dictionary procAPL = new Dictionary(); - FileInfo myFile = new FileInfo(proc); - FileStream fs = myFile.OpenRead(); - BinaryReader br = new BinaryReader(fs); - byte[] myBuff = new byte[myFile.Length]; - br.Read(myBuff, 0, (int)myFile.Length); - br.Close(); - fs.Close(); - int offset = 0; - while (offset < myBuff.Length) - { - string recnum = Encoding.Default.GetString(myBuff, offset, 8); - int applicability = BitConverter.ToInt32(myBuff, offset + 8); - string applicabilityToStr = string.Format("{0:X8}", applicability); - //4294967296 - if (!procAPL.ContainsKey(recnum)) - procAPL.Add(recnum, applicabilityToStr); - else - if (procAPL[recnum] != applicabilityToStr) - procAPL[recnum] = applicabilityToStr; - offset += 12; - } - procAPLs.Add(proc, procAPL); + string recnum = Encoding.Default.GetString(myBuff, offset, 8); + int applicability = BitConverter.ToInt32(myBuff, offset + 8); + string applicabilityToStr = string.Format("{0:X8}", applicability); + //4294967296 + if (!procAPL.ContainsKey(recnum)) + procAPL.Add(recnum, applicabilityToStr); + else + if (procAPL[recnum] != applicabilityToStr) + procAPL[recnum] = applicabilityToStr; + offset += 12; } - //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; } } } diff --git a/PROMS/DataLoader/Approve.cs b/PROMS/DataLoader/Approve.cs index 41bd99e2..1aca95f3 100644 --- a/PROMS/DataLoader/Approve.cs +++ b/PROMS/DataLoader/Approve.cs @@ -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) diff --git a/PROMS/DataLoader/ConfigInfo.cs b/PROMS/DataLoader/ConfigInfo.cs index 73e17f7c..d788cbf2 100644 --- a/PROMS/DataLoader/ConfigInfo.cs +++ b/PROMS/DataLoader/ConfigInfo.cs @@ -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); + } + } } } diff --git a/PROMS/DataLoader/DataLoaderSettings.cs b/PROMS/DataLoader/DataLoaderSettings.cs index 260ba10b..10587b89 100644 --- a/PROMS/DataLoader/DataLoaderSettings.cs +++ b/PROMS/DataLoader/DataLoaderSettings.cs @@ -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 ?? "") == "") {