My little C# project is coming along just fine. The basic idea is to create a synchronisation tool between an ERP application and Outlook, since the manufacturer of the ERP application has no plans on creating a “synchronize with Outlook” functionality in the near (and not so near) future. Since I don’t want to get into any legal stuff, I wanted to create a one-way sync-mechanism, basically a download-from-ERP-to-Outlook. And since I was in need for some project to learn C# better, this was the opportunity.
Since the ERP application has an ODBC DSN defined on the client to create a connection from MS Word to their data, I decided to use that to connect to the database. ODBC is not the fastest and most elegant thing around, but it’ll do the job just fine.
The main form is just a simple form with a textbox for the employerscode and two datefields, to specify the period that needs to be downloaded to Outlook. The functionality sofar:
– Employee-code is checked against the database
– Timespan is 7 days by default: changing the from-date, the to-date will be 7 days later
– Pressing sync will get all appointments in the daterange, and search for all attendees (other than the employee) of the appointment
What needs to be done to enter the Alpha-stage:
– Convert the found data to an Outlook.AppointmentItem and insert it into Outlook
– Have seperate time-fields (by default 00:00:00 and 23:59:59) to be able to enter a narrow timespan, without the user having to specify the time in each of the date-fields
Things I learned from working with C# (VS.NET 2003) are:
– Case sensitivity. Needs to get used to, and can be very annoying. Odbc is something else than odbc. When the compileroutput lists the error, is sometimes hard to spot what is wrong.
– Functions need not be declared before (above in the sourcecode) you use them. This is different from (object)pascal. But it’s nice: you can keep things together, without the need for a specific order. Alphabetically will do just fine.
– I’m not sure if it can be done in (object)pascal (never tried it), but variables declared within curly brackets have a scope only between these brackets. Very nice for dummy-variables, and you don’t want to make up another name, just because you’re still in the same function/procedure. If it’s a meaningless variable, using the same name is just fine.
– Compiler directives are nice. Having the ability to switch between debug and release with one buttonclick, makes it very usable to include lots of debugmessages, that just won’t show up when you build/run the release-version. No more forgetting about that one ShowMessage when releasing your work to the client.