Click here to Skip to main content
15,894,180 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi there, this is my first post and I hope to be clear enought.

I'm writing a .NET application using C# language. This application will run in Industrial environment (I mean, it will control a machine) and so it need some specific features often required in this field:

1. The software must authenticate the user: for example, some users can only start/stop the machine, others can change settings and make backups, others can only read settings, and so on...

I would not prefer tu use authentication based on windows users for this, is there any good example on how to implement some base authentication system, maybe using database?

2. I also need to trace user activity (who/when logged, what he has modified) and machine statistics (how many parts worked per session, session results, and so on...)

I know this is not so specific point, but I actually have to decide what to implement and how, so just need some good ideas about what approuch to use (maybe database logging, or xml files?.

3. Last question is about software settings: where to store settings, considering that I will need to export/import them? If I use standard .NET "properties" class, I don't know how to export/import. Is there any good example/library on how to manage settings in database and/or xml file?

Unfortunately I come from "old" c++ programming, and have very little experience in .NET/Windows programming.

Thanks a lot for your suggestions,
Simone
Posted

1 solution

simonerom wrote:
1. The software must authenticate the user: for example, some users can only start/stop the machine, others can change settings and make backups, others can only read settings, and so on...

I would not prefer to use authentication based on windows users for this, is there any good example on how to implement some base authentication system, maybe using database?


Sure - you can use a database. You need to define users, who occupy roles, each of which have permissions. A user can have one or more roles, and roles can have one or more permissions.

I wrote an article about user authentication:

User Login For WinForm Applications[^]

simonerom wrote:
2. I also need to trace user activity (who/when logged, what he has modified) and machine statistics (how many parts worked per session, session results, and so on...)

I know this is not so specific point, but I actually have to decide what to implement and how, so just need some good ideas about what approach to use (maybe database logging, or xml files?.


This is an implementation detail, but I would use the database for logging. You can always export to XML if you want to later on. Either way, you're going to have to develop an interface to view the user activity log.


simonerom wrote:
3. Last question is about software settings: where to store settings, considering that I will need to export/import them? If I use standard .NET "properties" class, I don't know how to export/import. Is there any good example/library on how to manage settings in database and/or xml file?


.Net supports XML settings - unless there's a need to import/export existing settings from another application, you shouldn't have to worry about it. BTW, any application data/settings should be saved int he user's applicationdata folder. DotNet provies a method for yyou to determine that foldername on the fly, but it IS *Windows user* specific. If multiple users can log into the application, I would use the global applicationdata folder instead of the user-specific one. Again, .Net gives you a way to determine this folder name through code.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900