예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            String userName = ((txtUsrname.Text).Clone().ToString()).Replace(" ", string.Empty);
            String password = (txtPwrd.Text).Clone().ToString();

            if (userName == "" && password == "")
            {
                usernameVerifyMessage.Show();
                passwordVerifyMessage.Show();
                hideLabels();
            }
            else if (userName == "")
            {
                usernameVerifyMessage.Show();
                hideLabels();
            }
            else if (password == "")
            {
                passwordVerifyMessage.Show();
                hideLabels();
            }
            else
            {
                user User = new user(userName, -1, password, null, null, null, null, null);
                userDataManipulations userDataManipulations = new userDataManipulations();
                Boolean userValidity = userDataManipulations.authenticateUser(User);

                if (userValidity)
                {
                    wrapperDataBuffer.WrapperObject.Flag = 0;
                    MainMenuAdmin newMainMenuAdmin = new MainMenuAdmin();
                    newMainMenuAdmin.Show();
                    this.Hide();
                }
                else
                {
                    loginVerifyMessage.Show();
                    hideLabels();
                }
            }
        }
예제 #2
0
        private void btnAddService_Click(object sender, EventArgs e)
        {
            String fName = ((txtFname.Text).Replace(" ", string.Empty)).Clone().ToString();
            String lName = ((txtLname.Text).Replace(" ", string.Empty)).Clone().ToString();
            String nic = ((txtNIC.Text).Replace(" ", string.Empty)).Clone().ToString();
            String role = ((txtRole.Text).Replace(" ", string.Empty)).Clone().ToString();
            String usName = ((userName.Text).Replace(" ", string.Empty)).Clone().ToString();

            if (fName == "")
            {
                fnameVerify.Show();
                hideLabelsTimer();
            }
            else if (lName == "")
            {
                lnameVerify.Show();
                hideLabelsTimer();
            }
            else if (usName == "")
            {
                userNameVerify.Show();
                hideLabelsTimer();
            }
            else if (nic == "")
            {
                nicVerify.Show();
                hideLabelsTimer();
            }
            else if (role == "")
            {
                roleVerify.Show();
                hideLabelsTimer();
            }
            else if (password.Text == "")
            {
                passwordVerify.Show();
                hideLabelsTimer();
            }
            else
            {
                String uName = (userName.Text).Clone().ToString();
                int urole = ((KeyValuePair<int, string>)txtRole.SelectedItem).Key;
                String uPword = (password.Text).Clone().ToString();
                String uFName = (txtFname.Text).Clone().ToString();
                String uLName = (txtLname.Text).Clone().ToString();
                String uAddress = (txtAddress.Text).Clone().ToString();
                String uTel = (txtTel.Text).Clone().ToString();
                String uLNic = (txtNIC.Text).Clone().ToString();
                userDataManipulations userDataManipulations = new userDataManipulations();
                if (!(userDataManipulations.validateUserName(uName)))
                {
                    user newUser = new user(uName, urole, uPword, uFName, uLName, uAddress, uTel, uLNic);
                    Boolean userInsertionFlag = userDataManipulations.addNewUser(newUser);
                    if (userInsertionFlag)
                    {
                        userInsertionSuccessMsg.Show();
                        hideLabelsTimer();
                    }
                    else
                    {
                        userInsertFailureMsg.Show();
                        hideLabelsTimer();
                    }
                }
                else
                {
                    userNameVerify.Show();
                }

            }
        }