Permalink
Browse files

fix

  • Loading branch information...
jeremy
jeremy committed Nov 5, 2018
2 parents 662da96 + 9696d31 commit 9f74f18ed28fae18b40bea955952bbb4d7c476d6
Showing with 27 additions and 175 deletions.
  1. +6 −3 EDI.Fabric/Libraries/Data/Get.cs
  2. +14 −5 EDI.Fabric/Libraries/Data/SimpleDB.cs
  3. +0 −167 EDI.Fabric/Libraries/Writers/Types/X12850.cs
  4. +7 −0 README.md
@@ -9,14 +9,17 @@ namespace EDI.Fabric.Libraries.Data
class Get
{
// @SimpleDB class
private static SimpleDB _db;
private static SimpleDB Db;
//private static readonly IEDIextraction _class;
public Get(string conn)
{
_db = new SimpleDB(conn);
Db = new SimpleDB(conn);
}
// If I were dealing with thousands of records I might not simply join the tables
// and loop all the data but would instead run two queries however,
// I don't expect more than 10 or 20 in most cases.
public Dictionary<int, Dictionary<string, string>> GetTransactions(string portID, string startDate, string endDate)
{
//01006097142
@@ -30,7 +33,7 @@ public Get(string conn)
" AND (dbo.TransMaster.PODATE <= '" + endDate + "') " +
" AND (dbo.TransMaster.Status <> 0)";
return _db.Query(sql);
return Db.Query(sql);
}
}
}
@@ -29,8 +29,16 @@ public SimpleDB(string conn)
cmd.Connection = sqlConnection1;
sqlConnection1.Open();
Dictionary<int, Dictionary<string, string>> _return = new Dictionary<int, Dictionary<string, string>>();
/**
* something to hang our results on
* I don't expect more than a few 100 records per run
* A simple query and loop to sort the data should suffice
*
* data[0] = {{key, value},{key, value}, etc..},
* data[1] = {{key, value},{key, value}, etc..},
* etc...
* */
Dictionary<int, Dictionary<string, string>> dReturn = new Dictionary<int, Dictionary<string, string>>();
var reader = cmd.ExecuteReader();
int row = 0;
@@ -45,7 +53,8 @@ public SimpleDB(string conn)
for (int i = 0; i < count; i++)
{
Console.WriteLine(row + " " + reader.GetName(i) + " " + reader.GetValue(i));
// Console.WriteLine(row + " " + reader.GetName(i) + " " + reader.GetValue(i)); // debug
if(false == col.ContainsKey(reader.GetName(i).ToString()))
col.Add(reader.GetName(i).ToString(), reader.GetValue(i).ToString());
/*
@@ -70,14 +79,14 @@ public SimpleDB(string conn)
}
*/
}
_return.Add(row, col);
dReturn.Add(row, col);
row++;
}
} while (reader.NextResult());
sqlConnection1.Close();
return _return;
return dReturn;
}
}

This file was deleted.

Oops, something went wrong.
@@ -8,6 +8,13 @@ The final product (if it ever goes to production ) will probably not look anythi
This is just a proof of concept.
### EDI ([E]lectronic [D]ata [I]nterchange)
https://www.up.com/suppliers/order_inv/edi/what_is_edi/
EDI has been around since the 1960's but EDI is still in use today by many major companies. When it's understood it can be compared to a DOM in that it has opening and closing envelopes encapsulating sections of data. The schema for the document is contained in a header of 105 characters and a major delimiter.
### Arguments
[[-flag] [value] [-flag] [value] ... ... ]

0 comments on commit 9f74f18

Please sign in to comment.