Exemple #1
0
        private void btnMThursday_Click(object sender, EventArgs e)
        {
            string        Datestring   = dateTimePicker2.Text;
            DateTime      Date         = DateTime.Parse(Datestring);
            DateTime      Thursday     = Date.AddDays(3);
            DatabaseClass Connect      = DatabaseClass.Instance;
            String        GetThursday  = "SELECT [Crop_Name],[JobName],[amount] FROM [dbo].[Job]" + " JOIN Crop ON Job.CropID=Crop.CropID JOIN JobType ON Job.JobTypeId=JobType.JobtypeID JOIN users ON Job.UserID = users.UserID WHERE Date ='" + Thursday.ToShortDateString() + "' AND  Username = '******'";
            DataSet       Thursdaydata = Connect.getDataSet(GetThursday);

            DataViewDailyL.ReadOnly   = true;
            DataViewDailyL.DataSource = Thursdaydata.Tables[0];
        }
Exemple #2
0
        public int passwordCounter = 0;//a counter for the password!
        private void btnLogin_Click(object sender, EventArgs e)
        {
            getuser = txtUserName.Text;

            DatabaseClass dbLogin = DatabaseClass.Instance;

            bool r = dbLogin.loginFul(txtUserName.Text, txtPassword.Text);//remove check

            if (r == true)
            {
                passwordCounter = 0;
                Login loginForm = new Login();
                this.Hide();              //hides
                loginForm.Close();        //closes after hiding.
            }
            else if (r == false)          //if password is wrong!
            {
                if (passwordCounter >= 3) //if 3 times or more
                {
                    lblLogin.Text = "3rd attempt failed: Forcing Shutdown";
                    MessageBox.Show("3rd attempt failed: Forcing Shutdown");
                    Application.Exit();
                }
                else if (passwordCounter == 2)
                {
                    lblLogin.Text = "2nd attempt failed: username or password is incorrect";
                    MessageBox.Show("Last Attempt: Please Contact a Manager");
                }
                else if (passwordCounter == 1)
                {
                    lblLogin.Location = new Point(30, 160);
                    lblLogin.Text     = "1st attempt failed: username or password is incorrect";
                }
                passwordCounter += 1;//the counter for each time wrong
            }
        }