This commit is contained in:
John Jenko 2010-03-25 14:40:00 +00:00
parent 84f26c2f9b
commit 182e9a1fd3

View File

@ -57,45 +57,67 @@ namespace DataLoader
string xtproccmd = "SELECT * FROM [xtprocid] WHERE [SETID]='" + setid + "' AND [PROCID]='" + procid + "'"; string xtproccmd = "SELECT * FROM [xtprocid] WHERE [SETID]='" + setid + "' AND [PROCID]='" + procid + "'";
using (OleDbDataAdapter da = new OleDbDataAdapter(xtproccmd, _DbConnect)) using (OleDbDataAdapter da = new OleDbDataAdapter(xtproccmd, _DbConnect))
{ {
DataSet ds = new DataSet(); try
da.Fill(ds); {
DataTable dt = ds.Tables[0]; DataSet ds = new DataSet();
dt.CaseSensitive = true; da.Fill(ds);
DataRow dr = dt.Rows[0]; // there should be only one entry! DataTable dt = ds.Tables[0];
retval = dr["Procnum"].ToString(); // this should be the procedure number! dt.CaseSensitive = true;
ds.Dispose(); DataRow dr = dt.Rows[0]; // there should be only one entry!
retval = dr["Procnum"].ToString(); // this should be the procedure number!
ds.Dispose();
}
catch (Exception ex)
{
return "<Procedure Number>";//ex.GetType().Name + " " + ex.Message;
}
} }
return retval; return retval;
} }
private string GetPath(string setid) private string GetPath(string setid)
{ {
string xtsetcmd = "SELECT * FROM [xtsetid] WHERE [SETID]='" + setid + "'"; try
OleDbDataAdapter da = new OleDbDataAdapter(xtsetcmd, _DbConnect); {
DataSet ds = new DataSet(); string xtsetcmd = "SELECT * FROM [xtsetid] WHERE [SETID]='" + setid + "'";
da.Fill(ds); OleDbDataAdapter da = new OleDbDataAdapter(xtsetcmd, _DbConnect);
DataTable dt = ds.Tables[0]; DataSet ds = new DataSet();
dt.CaseSensitive = true; da.Fill(ds);
DataRow dr = dt.Rows[0]; // there should be only one entry! DataTable dt = ds.Tables[0];
string retval = dr["Path"].ToString(); dt.CaseSensitive = true;
da.Dispose(); DataRow dr = dt.Rows[0]; // there should be only one entry!
ds.Dispose(); string retval = dr["Path"].ToString();
return retval; // dr["Path"].ToString(); // this should be the path to the proc set! da.Dispose();
ds.Dispose();
return retval; // dr["Path"].ToString(); // this should be the path to the proc set!
}
catch (Exception ex)
{
return "<Procedure Set Location>";//ex.GetType().Name + " " + ex.Message;
}
} }
private string GetTitle(string setid, string procid) private string GetTitle(string setid, string procid)
{ {
string xtproccmd = "SELECT * FROM [xtprocid] WHERE [SETID]='" + setid + "' AND [PROCID]='" + procid + "'"; try
OleDbDataAdapter da = new OleDbDataAdapter(xtproccmd, _DbConnect); {
DataSet ds = new DataSet();
da.Fill(ds); string xtproccmd = "SELECT * FROM [xtprocid] WHERE [SETID]='" + setid + "' AND [PROCID]='" + procid + "'";
DataTable dt = ds.Tables[0]; OleDbDataAdapter da = new OleDbDataAdapter(xtproccmd, _DbConnect);
dt.CaseSensitive = true; DataSet ds = new DataSet();
DataRow dr = dt.Rows[0]; // there should be only one entry! da.Fill(ds);
string retval = dr["Proctitle"].ToString(); DataTable dt = ds.Tables[0];
da.Dispose(); dt.CaseSensitive = true;
ds.Dispose(); DataRow dr = dt.Rows[0]; // there should be only one entry!
return retval; // dr["Proctitle"].ToString(); // this should be the procedure number! string retval = dr["Proctitle"].ToString();
da.Dispose();
ds.Dispose();
return retval; // dr["Proctitle"].ToString(); // this should be the procedure number!
}
catch (Exception ex)
{
return "<Procedure Title>";//ex.GetType().Name + " " + ex.Message;
}
} }
public string GetDescription(string key) public string GetDescription(string key)
@ -222,18 +244,27 @@ namespace DataLoader
private static DocVersionInfo PartialMatch(string path) private static DocVersionInfo PartialMatch(string path)
{ {
string partial = GetPartial(path); string partial = GetPartial(path);
foreach (DocVersionInfo dvi in _DocVersions) if (partial != null)
{ {
if (dvi.MyFolder.Title.ToUpper().EndsWith(partial.ToUpper())) foreach (DocVersionInfo dvi in _DocVersions)
return dvi; {
if (dvi.MyFolder.Title.ToUpper().EndsWith(partial.ToUpper()))
return dvi;
}
} }
return null; return null;
} }
private static string GetPartial(string path) private static string GetPartial(string path)
{ {
string[] parts = path.Split("\\".ToCharArray()); Console.WriteLine(string.Format("GetPartial path = {0}",path));
return "\\" + parts[parts.Length - 2] + "\\" + parts[parts.Length - 1]; if (path.Contains("\\"))
{
string[] parts = path.Split("\\".ToCharArray());
return "\\" + parts[parts.Length - 2] + "\\" + parts[parts.Length - 1];
}
else
return null;
} }
private static DocVersionInfo ExactMatch(string path) private static DocVersionInfo ExactMatch(string path)