Exemplo n.º 1
0
 private int getPositionID(string position)
 {
     try
     {
         int positionID = Convert.ToInt32(utilities.DataLookUp("PositionID", "tblPosition",
                                                               "PositionName='" + position + "'"));
         return(positionID);
     }catch (Exception ex)
     {
         string msg = ex.Message;;
         return(0);
     }
 }
Exemplo n.º 2
0
        private void LoginProgram()
        {
            try
            {
                string username = txtUserName.Text;
                string password = txtPassword.Text;

                if (username.Trim().Equals("") || password.Trim().Equals(""))
                {
                    MessageBox.Show("Please enter the username and password.", "Human Resource",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    string id = utilities.DataLookUp("UserID", "tblUsers", " Username='******' AND UserPassword='******'");

                    if (!id.Equals(""))
                    {
                        MessageBox.Show("Authorized. Welcome!!", "Human Resource",
                                        MessageBoxButtons.OK, MessageBoxIcon.Information);

                        HumanResource_MainForm mainForm = new HumanResource_MainForm();
                        mainForm.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("Incorrect Username or Password ", "Human Resource",
                                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }