Archive for November, 2009

C# Dictionaries for Dummies

Wednesday, November 4th, 2009

How to use C# Dictionaries

In a nutshell:

Dictionaries can be used to store a list of items, but instead of using a standard flat “List” you can identify the records with a key.

First of all, make sure you’ve included the correct namespace:

using System.Collections.Generic;

Secondly you need to declare a dictionary.

For this example we are going to declare a dictionary called dicEmployees and within the dictionary we are going to store the identity number of the employee as well as their name.

Dictionary<int, string> dicEmployees = new Dictionary<int, string>();

Populating the Dictionary

Populating the dictionary is as easy as one-two-three…

dicEmployees.Add(14, “Marcus Orelius”);

In this case we’ve added Marcus Orelius with employee number 14 to our dictionary.

Retrieving Dictionary Values

Retrieving values are just as easy…

string sEmployeeName = dicEmployees[14];

Additional Options:

dicEmployees.ContainsKey(14); // Returns true/false; if the dictionary contains the key 14

dicEmployees.ContainsValue(”Marcus Orelius”); // Returns true/false; if the dictionary contains the value “Marcus Orelius”

dicEmployees.Count; // Returns the total item count in the dictionary (int)

dicEmployees.Keys; // Returns the “KeyCollection” list of the keys currently in the dictionary

dicEmployees.Values; // Returns a “ValueCollection” list of the values currently in the dictionary

Playing It Safe…

I highly recommend building in a safeguard when checking the values of a dictionary:

if(dicEmployees.ContainsKey(14))

return dicEmployees[14];

Dictionary of Dictionaries:

I recently tried a dictionary of dictionaries and was quite happy with the result. Let’s build on the previous example. Assume you want to store a list of years and include if Marcus ever took leave in those years. We are going to declare a dictionary of a dictionary which will enable us to store a list of employees and the years they worked plus if they ever went on leave…

Dictionary<int, Dictionary<int, bool>> dicEmployees = new Dictionary<int, Dictionary<int, bool>>();

Dictionary<int, bool> dicMarcus = new Dictionary<int, bool>();

//Add years and if Marcus ever took leave on those days

dicMarcus.Add(41, true);
dicMarcus.Add(42, true);
dicMarcus.Add(43, false);
dicMarcus.Add(44, true);
dicMarcus.Add(45, false);

dicEmployees.Add(14, dicMarcus);

//Did Marcus take leave when he was 43?

bool wasMarcusAtWorkAged43 = dicEmployees[14][43];

// Value returned is false

Hope that helps…

Die Skietwinkel – Launched!

Monday, November 2nd, 2009
Die Skietwinkel Website

Die Skietwinkel Website

We’ve launched the new “Die Skietwinkel” website on Friday.  Content are still very limited, with only contact details and general introduction page.

We are working on the product catalogue that will display all the products that are for sale in the shop.

General Overview of Die Skietwinkel:

Die Skietwinkel is a shop situated in Brandwag Centre in Bloemfontein (SA).  They are one of the largest hunting shops.  They stock everything under the sun that can be used for hunting: bows, rifles and accessories.

They also provide training on handling weaponry and are credited to provide certificates to help you gain your firearm license.

Die Skietwinkel can also arrange and take you on hunting trips as they are qualified Personal Hunters.

To visit the new site goto: http://www.skietwinkel.com

De Oude Kraal Spa Bookings & Stock Control System Launches

Monday, November 2nd, 2009

Spa Bookings & Stock Control System

We’ve recently launched our web application system developed for De Oude Kraal Spa. The spa bookings and stock control system is a prime example of our corporate web development services. Read on if you are interested in the system and what exactly it entails.

System Sections

  • Users & Groups (Admins, theraspists, suppliers and clients)
  • SMS Functionality
  • Bookings (packages, treatments, treatment-add-on’s and venue bookings)
  • Sales (of products)
  • Stock Control & Stock Take
  • Purchases
  • Package, treatments, treatment add-ons and product administraiton
  • Treatment types and rooms
  • Various reports
    • Stock Report
    • Bookings Report
    • Product Report

Menu

Spa Bookings & Stock Control Menu

Spa Bookings & Stock Control Menu

The menu includes icons to make identification of the menu items easier. The menu is also divided into categories to make navigation even easier. The stock control system is capable of synchronizing the client database with our SMS software to make communication as easy as possible.

Setting Up Data

Spa Bookings & Stock Control System - Managing Data

Spa Bookings & Stock Control System - Managing Data

Managing data is very easy and the data structure allows you to combine various package options including “non-commision” items and rooms.

Bookings

Spa Bookings & Stock Control System - Client Bookings

Spa Bookings & Stock Control System - Client Bookings

The bookings area display a grid with every therapist as a column and the time of day as a row. Time slots are broken down into 15 minute slots to make it possible to book 15 minute add-ons or treatments as well. Bookings can be moved by clicking on the “Move Booking” link for each booking.

Bookings are color coded to make identification as easy as possible.

Spa Bookings & Stock Control System - Room Bookings

Spa Bookings & Stock Control System - Room Bookings

Room bookings can also be made on the bookings page with default and/or custom prices.

Stocks & Stock Control

Spa Bookings & Stock Control System - Stocks

Spa Bookings & Stock Control System - Stocks

Product usage can by recorded in the database as well as the bottle weight of a specific product. This makes stock control and the purchasing of stocks very easy and accurate.

The system keeps track of stock usage and allows you to take a stock count whenever you want to while maintaining a complete record of stocks before and after every stock take.

Purchases

Spa Bookings & Stock Control System - Purchases

Spa Bookings & Stock Control System - Purchases

Products can be linked to suppliers in order to make purchasing even easier. When recording a purchase you can simply enter the quantities and prices of the products purchased. Stocks are automatically updated.

Reports

Spa Bookings & Stock Control System - Reports

Spa Bookings & Stock Control System - Reports

Various reports are available to make the management of your Spa as easy as possible. The Spa Bookings & Stock Control system ensures:

  • Complete management of your stocks
  • Management of commissions paid
  • Excellent profit and expenditure reports

Conclusion

Our spa bookings and stock control system was developed for De Oude Kraal Spa situated in Bloemfontein which ensured that the information provided by our system is of top-notch quality. The Spa Bookings and Stock Control System ensures that the name your Spa stands for is administrated the same way.

Feel free to contact us for more information or a demo of the system. The system is available in an online format.