Пример #1
0
        private void btnEnter_Click(object sender, EventArgs e)
        {
            try
            {
                Human_Resources HR              = new Human_Resources();      // Create an object for the HR class
                string          userNm          = txtUsername.Text;
                string          userPass        = txtPassword.Text;
                string          confirm         = txtConfirm.Text;
                string          writeLoginTable = "INSERT INTO Login VALUES(@Username, @Password, @Question, @Answer)";
                string          readLogintable  = "SELECT * FROM Login";

                if (validateUserInput(userNm, userPass, confirm))
                {
                    int    x            = createUser(writeLoginTable, readLogintable, userNm, userPass);
                    string updateQueiry = "UPDATE Employees SET UserID = '" + x.ToString() + "' WHERE Id = '" + int.Parse(txtId.Text) + "'";
                    HR.updatedata(updateQueiry);
                    MessageBox.Show("User Successfully created!");
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
            }
        }
Пример #2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            string updateQueiry = "UPDATE Sales_Order SET " + columnComboBox.Text + " = '" + txtNewVal.Text + "' WHERE salesOrder_ID = '" + float.Parse(txtIdUp.Text) + "'";

            HR.updatedata(updateQueiry);
            readAll();
        }
Пример #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (tmp[2] == textBox1.Text)
     {
         Human_Resources HR = new Human_Resources();
         New_password    NP = new New_password();
         NP.ShowDialog();
         MessageBox.Show(NP.getPass);
         string updateQueiry = "UPDATE Login SET Password = '******' WHERE Id = '" + int.Parse(tmp[0]) + "'";
         HR.updatedata(updateQueiry);
         MessageBox.Show("New Password Created");
         this.Close();
     }
     else
     {
         errorProvider1.SetError(textBox1, "Wrong answer!");
     }
 }