Getting Orders Into the System
So my business process goes something like this: I scour the Internet to find something I want to buy. Mostly, I buy things in boxes of random assortment and I provide the labor to identify and list the individual pieces. My value is in identification of these things. And I buy boxes of large quantities of things, so this means that traditional means of tracking aren’t necessarily the best– and when I buy, I don’t know exactly what I’m getting.
When you set out to design a system, you want to make sure that you have a good data model and that using that system is easiest for its main user. Since the main user is me right now, that means that I’m pretty aware of how I’d like to use the system!
Since I get invoices from my suppliers via email and I make purchases from all over the world, the easiest path for me to get data into my system would use email. So I created an email box to receive the invoices that I will forward to it after I have paid them.
The first step I did with coding that I’ve done is to create a simple C# DLL that I can call both from a Windows Service and a Console Application for easy testing. The main body of this part of the application flow is defined as follows:
- Open a the mailbox that has the orders looking for email.
- For each email in the system, parse the email looking for specific markers that tell what was purchased
- How much?
- When it was purchased?
- How much for shipping, insurance and additional charges?
This is working pretty well, except for the fact that sometimes I’m paying in a foreign currency and the translation needs to be made into U.S. Dollars. If dollars is provided in the email, and I recognize it, then I will make sure to save that dollar amount and make the calculations required, but more often than not I forget to do this before I send it to the system (or the format) and so I will need a way to look at orders after they are in the system, and that is where this development project begins.