Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection connection = new SqlConnection("Data Source=EDWINPC\\SQLEXPRESS01;Initial Catalog=payrollDatabase;Persist Security Info=True;User ID=admin;Password=Addicted");

            connection.Open();
            SqlCommand fetchdata = new SqlCommand("select Password from Employees where idNumber = '" + textBox1.Text + "'", connection);
            //int Password = fetchdata.ExecuteNonQuery();
            SqlDataReader storedPass = fetchdata.ExecuteReader();

            storedPass.Read();
            String Password  = storedPass["Password"].ToString();
            String Upassword = textBox2.Text.ToString();

            if (Password == Upassword)
            {
                landingpage land = new landingpage();
                land.Show();
                this.Hide();
            }
            else if (Password != Upassword)
            {
                MessageBox.Show("You have entered the wrong Password");
            }
            else
            {
                MessageBox.Show("User Does not exist");
            }
        }
Example #2
0
        private void back_Click(object sender, EventArgs e)
        {
            landingpage goToLanding = new landingpage();

            goToLanding.Show();
            this.Hide();
        }
Example #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            landingpage showLanding = new landingpage();

            showLanding.Show();
            this.Hide();
        }
Example #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection sqlconnection = new SqlConnection("Data Source=EDWINPC\\SQLEXPRESS01;Initial Catalog=payrollDatabase;Persist Security Info=True;User ID=admin;Password=Addicted");

            sqlconnection.Open();
            SqlCommand sqlcommand = new SqlCommand("insert into Employees(firstName,secondName, lastName, phoneNumber, altPhoneNumber, dateJoined, idNumber, gender, kraPin, nhif, nssf, Password) values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox7.Text + "','" + textBox9.Text + "','" + dateTimePicker1.Text + "','" + textBox4.Text + "','" + radioButton2.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox8.Text + "','" + textBox10.Text + "')", sqlconnection);
            int        i          = sqlcommand.ExecuteNonQuery();

            if (i != 0)
            {
                MessageBox.Show("Employee Created Successfully");
            }
            else
            {
                MessageBox.Show("Operation failed");
            }
            landingpage landing = new landingpage();

            landing.Show();
            this.Hide();
        }