Click here to Skip to main content
15,891,863 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The project I'm making provides specifications that have changing revision levels. What I'm attempting to do is force a warning for a week prior to expiring. Once expired, someone trying to use it will have to enter a code that confirms they have verified rev levels are current (that's what the week warning is for). I'd like this to occur on the same date ever year.

Currently, it asks for the passcode every time it's opened. For example, I did expect to be asked for the passcode today. I entered it then closed the program. When I opened it, it asked me for it again. I did not expect to be asked again until next 7, 1.

The passcode is not intended to keep anyone out of the software permanently. It's actually given within the message that appears. It's just a means to document the person confirming that rev levels are current.

Please don't ask why I've done something the way I did. I know just enough to be dangerous. If something is glaringly obvious to you, please tell me, or direct me to where I can find the information. I don't mind figuring things out on my own, but it's a matter of "not knowing what I don't know". All of you at some point asked questions and had to learn. I'm doing the same.

Thank you

What I have tried:

private void Expiry() //This calls a separate form.
        {
            DateTime value1 = new DateTime(DateTime.Now.Year, 7, 1);
            DateTime value2 = new DateTime(DateTime.Now.Year, 7, 6);          
            
            if ((DateTime.Now > value1) && (DateTime.Now < value2)) //month, day in order
            {
                MessageBox.Show("Specs will expire on 07/07/. You will be asked to confirm rev levels are current.", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            if (DateTime.Now > new DateTime(DateTime.Now.Year, 07, 08)) //month, day in order
            {
                expire notice = new expire();
                notice.ShowDialog();
            }
            else
                if ((DateTime.Now < value1) || (DateTime.Now > value2)) //month, day in order
            {
                //MessageBox.Show("test");
            }
        }


This next code is for controlling the passcode messagebox.

private void btnExpired_Click(object sender, EventArgs e)
        {            
            string password = txtPassword.Text;

            if (txtPassword.Text == "1818")
            {
                MessageBox.Show("Unlocked", "Accepted", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Hide();
            }
            else
            {              
                MessageBox.Show("Software is not useable.","No Password Entered", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                Application.Exit();
            }
Posted
Updated 8-Jul-19 2:19am

1 solution

It looks like you are missing a thing or two.

First; where are you storing the date/time they last logged in That is what you have to check against

Second: Is this used by multiple people? If so then for each person you are going to need a unique id to tie to the date they last ran the program and of course as related to the first issue a place to store it
 
Share this answer
 
Comments
Smeezy 8-Jul-19 8:52am    
There are several people who have it installed. When they open it, it automatically checks for updates I've made on the server.

Why is the date they last opened it relevant? The way I am thinking of this working is that it's just functioning against a calendar. Doesn't it know that from the computer?

I'm not trying to be difficult. I just really don't understand the process you’re explaining and it’s likely because you don’t have all the information. Some of the next paragraph just occurred to me after reading your response.

I just need it to be specific to a computer, and not a person. So if the warning pops up, they (whoever the computer belongs to) have 5 days to check revisions. On day 6 they enter the passcode to signify they have confirmed levels are current. The other option is that they missed the warning. Whenever they open it again, it’s locked, and they have to verify revisions then. Either way, if they're using it with an out of date revision then they (whoever the computer belongs to) approved it. No one else could have.

Still, my sticking point is having the software function without asking for the passcode every time it’s opened after they enter it the first time. Until, that is, the warning period the following year.
MadMyche 8-Jul-19 10:16am    
Then why don't you have your "update server" keep track of the computers and the last time they updated?
Smeezy 8-Jul-19 10:42am    
MadMyche, simply, then I would be required to monitor rev levels. What if I'm gone, or leave this company and the revs expire? What I'm doing is making each person responsible to verify the information they're using is correct every year. We're engineers. We already have to do it. The difference is, currently we can throw away the old rev and print the new one. What I'm building here just makes our jobs more efficient.
MadMyche 8-Jul-19 11:12am    
Then automate the revision process, keep track of what machine has what revision; and then, it will be even more efficient.
Smeezy 8-Jul-19 11:25am    
Some of these revs don't change for 30 years, some 5 years. Some of these revs are not seen by one person for two years while another may use some of them every day.

I perform the updates. I would not know if a rev changed unless I needed to use the specification that changed. Someone else may be aware of the change.

By prompting them to verify revs every year, the odds of anything getting missed are nil. Whereas if it's done how you're suggesting, someone would open the specs just assuming they're up to date, in fact there could be one sitting there that I'm not aware of, and would have had no way to know unless I was using it.

So no matter who's using what rev on what specification, I'll be made aware that a change is necessary. This is why each person is responsible to verify their own rev levels.

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