Okay first of all thanks for taking the time to read this post. So I took a C# class this last spring semester and love programming with it now. The program I am working on I decided to make for my job that will help with scheduling.
Here's where the problem is that I am having. The program has saving and load for employee information that involves and object array (consisting of strings, int, booleans, and different type of arrays, I'll go over the details alittle farther down). The program also saves and load names for shift types and employee positions (it will also save the shift's to assign and all their info).
Now I have found a way to save but I feel like I am doing it all wrong. The info is saved to different .txt documents that are read and wrote to. The employee one looks like this
True,Test Employee 6,02/02/1920,90,Employee,Usher<>True Door<>False Concessions<>True Box<>False Glasses<>True
Here's how this is read (and written).
1) It reads until a comma is reached. each letter is stored in a string and then it checks to see if the world is true or false (it's stored as a boolean), this is for enabling or disabling an employee status (thinking if they go on long breaks)
2) After that it reads the next part till comma and its stored as a string. This is the employee's name
3) After the second comma it reads in the date of birth to a string (can be used to figure out the employee's age)
4) The next piece is stored as an int and is the employee's age (still following the whole comma thing)
5) Then the next part is stored as a string and is the employee's position (comma rule again)
6) And the last part is for knowing what shifts the employee can work and can't (reads in the name of the shift to a string then if it sees a "<" it checks the next character if it's ">" then it reading in the words after (these are stored as boolean and tell if the employee can work that shift type) and when it see a space it checks the next shift (these are stored in an object array that consists of a string and a boolean and the space increments the array)
Once the program detects the new line character it increments the employee object is incrmented. Okay so hopefully you have followed me so far.
Although this is a cleaver way of storing and loading data it's very ineffecient. The one problem is that if I change anything on any of the employees it has to pretty much overright the notepad document with a new blank one and then populate it. Well then it gets worse. For some reason everytime I read in the data I have excess array spaces of empty data (it has issues were it reads in return lines or something like that). Also if I remove an employee or edit I have to clear out the employee object array and then repopulate it by reading back in the file i just stored.
Also all those shift types if I change ones name or delete one (or add one) in another part of the program that does just that (I have no way of going threw the employee array and seeing if that shift exists in their line of code then delete it out or change its name or add it)
The other parts I said that save and load (shift types and employee positions) are purely a saved names in the text file.
So I have all these text files and I have a very inefficent way of loading and saving. So I assume databasing would allow me to change these individual elements without rewritting a file or having to use tons of code that is unneccesary.
FYI I have no clue how to use a database or anything so I can use all the help and such.
Hopefully this makes sense and thanks for the help (sorry I had to rush it ran out of time)