Esempio n. 1
0
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            bool logged = false;

            if ((TxtUsername.Text.Length > 0) && (TxtPassword.Text.Length > 0))
            {
                foreach (string[] login in lm.Logins)
                {
                    if ((login[0].ToLower() == TxtUsername.Text.ToLower()) && (login[1] == cipher.Shift(TxtPassword.Text, 3)))
                    {
                        logged = true;
                        MessageBox.Show("Successful Login", "Login Attempt", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        FrmWelcomeScreen welcomeScreen = new FrmWelcomeScreen(pm.IsAboveOfficer(login[0]), login[0]);
                        this.Hide();
                        welcomeScreen.ShowDialog();
                        this.Close();
                    }
                }
            }
            if (!logged)
            {
                MessageBox.Show("Wrong credentials");
                TxtPassword.Clear();
                TxtUsername.Clear();
            }
        }
        private void ButLogin_Click(object sender, EventArgs e)
        {
            string usernameHandler = "";

            foreach (char i in TxtUsername.Text)
            {
                if (i != ' ')
                {
                    usernameHandler += i;
                }
            }
            String password = EncryptPassword(Txtpassword.Text);
            string realpass = UD.GetPass(usernameHandler, password).ToString();

            if (realpass == "1" && usernameHandler == "admin")
            {
                formManage.SetPassAndUser(TxtUsername.Text, Txtpassword.Text);
                TxtUsername.Clear();
                Txtpassword.Clear();
                this.Hide();
                formManage.ShowDialog();
                this.Show();
            }
            else
            {
                MessageBox.Show("Sai tên đăng nhập hoặc mật khẩu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Esempio n. 3
0
        private void PBoxLogin_Click(object sender, EventArgs e)
        {
            string username;
            string contrasena;
            string typeusername;

            username     = TxtUsername.Text;
            contrasena   = TxtContrasena.Text;
            typeusername = CmbCargo.Text;

            if (username == "Gerente" && contrasena == "123" && typeusername == "Gerente")
            {
                MessageBox.Show("Bienvenido al programa", "GERENTE");
                this.Hide();
                FrmMenú a = new FrmMenú();
                a.Show();
            }
            else if (username == "Auxiliar" && contrasena == "321" && typeusername == "Auxiliar")
            {
                MessageBox.Show("Bienvenido al programa", "AUXILIAR");
                this.Hide();
                FrmMenú a = new FrmMenú();
                a.Show();
                a.PBoxUsuarios.Enabled = false;
                a.PBoxUsuarios.Visible = false;
            }
            else
            {
                MessageBox.Show("Información invalida, vuelva a ingresar los datos", "ERROR");
                TxtUsername.Clear();
                TxtContrasena.Clear();
                TxtUsername.Focus();
                CmbCargo.Text = " ";
            }
        }
Esempio n. 4
0
 private void TexClear()
 {
     TxtNumber.Clear();
     TxtUsername.Clear();
     txtEmail.Clear();
     txtNoPhone.Clear();
     txtPassword.Clear();
 }
 private void TxtsResetter()
 {
     TxtIpAddress.Clear();
     TxtDatabaseName.Clear();
     TxtUsername.Clear();
     TxtPassword.Clear();
     TxtIpAddress.Focus();
 }
Esempio n. 6
0
 private void TxtUser_Enter(object sender, EventArgs e)
 {
     if (TxtUsername.Text == "Username")
     {
         TxtUsername.Text = "";
         TxtUsername.Clear();
         TxtUsername.ForeColor = Color.Black;
     }
 }
Esempio n. 7
0
 private void TxtUser_Leave(object sender, EventArgs e)
 {
     if (TxtUsername.Text == "")
     {
         TxtUsername.Clear();
         TxtUsername.Text      = "Username";
         TxtUsername.ForeColor = Color.Silver;
     }
 }
Esempio n. 8
0
 private void BtnReset_Click(object sender, RoutedEventArgs e)
 {
     DisableMinusButtons();
     TogglePlusButtons(true);
     _createUser = new User(_defaultUser);
     DataContext = _createUser;
     TxtUsername.Clear();
     PswdPassword.Clear();
     PswdConfirm.Clear();
     TxtUsername.Focus();
 }
 //reset method
 private void Reset()
 {
     TxtName.Clear();
     TxtSurname.Clear();
     TxtUsername.Clear();
     TxtPassword.Clear();
     CbxPosition.SelectedItem = null;
     BtnUpdate.Visibility     = Visibility.Hidden;
     BtnDelete.Visibility     = Visibility.Hidden;
     BtnRead.Visibility       = Visibility.Hidden;
 }
Esempio n. 10
0
        private async void BtnLogin_Click(object sender, RoutedEventArgs e)
        {
            if (await GameState.Login(TxtUsername.Text, PswdPassword.Password))
            {
                TxtUsername.Clear();
                PswdPassword.Clear();
                TxtUsername.Focus();

                GameState.Navigate(new GameOptionsPage());
            }
        }
Esempio n. 11
0
 public void ClearEmployeeView()
 {
     TxtName.Clear();
     TxtEmail.Clear();
     TxtPhone.Clear();
     TxtNoOfHours.Clear();
     ChkIsAdmin.IsChecked  = false;
     ChkIsActive.IsChecked = true;
     TxtUsername.Clear();
     TxtPassword.Clear();
 }
Esempio n. 12
0
        public LoginPage LoginInvalid(string username, string password)
        {
            //submit creds
            TxtUsername.Clear();
            TxtUsername.SendKeys(username);
            TxtPassword.Clear();
            TxtPassword.SendKeys(password);
            BtnLogin.Click();

            //homepage return
            return(this);
        }
Esempio n. 13
0
        public HomePage Login(string username, string password)
        {
            //submit creds
            TxtUsername.Clear();
            TxtUsername.SendKeys(username);
            TxtPassword.Clear();
            TxtPassword.SendKeys(password);
            BtnLogin.Click();

            //homepage return
            return(new HomePage());
        }
Esempio n. 14
0
        private void materialRaisedButton1_Click(object sender, EventArgs e)
        {
            if (TxtPsw.Text != TxtRepeatPsw.Text)
            {
                MessageBox.Show("Contraseña diferente", "Google LLC", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TxtPsw.Text       = "";
                TxtRepeatPsw.Text = "";
                TxtPsw.Focus();
                return;
            }

            try
            {
                if (TxtPsw.Text == TxtUsername.Text)
                {
                    MessageBox.Show("El usuario y al contraseña no pueden ser iguales");
                    TxtUsername.Clear();
                    TxtPsw.Clear();
                    TxtRepeatPsw.Clear();
                    comboBox1.SelectedIndex = 0;
                    return;
                }
                ControlDB DBControl  = new ControlDB(ControlDB.cPath, "dbQA.mdf");
                string[]  parameters = { "@name", "@Username", "@pass", "cat" };
                string[]  elements   = { TxtName.Name, TxtUsername.Text, TxtPsw.Text, comboBox1.SelectedIndex.ToString() };
                if (DBControl.Buscar("Select * from [User] where Username=@userName", parameters, elements))
                {
                    MessageBox.Show("El usuario ya existe");
                    TxtUsername.Clear();
                    TxtPsw.Clear();

                    return;
                }
                if (DBControl.Insertar("insert into [User] values(@Name,@userName,@pass,@cat)", parameters, elements))
                {
                    //MessageBox.Show("Usuario agregado");
                }
                else
                {
                    MessageBox.Show("El usuario no pudo ser agregado");
                    DBControl.Close();
                    return;
                }
                DBControl.Close();
            }
            catch (Exception)
            {
                MessageBox.Show("Por favor, verifique los datos");
            }

            // Despues de Agregar Usuario
            MessageBox.Show("Usuario agregado Correctamente", "Google LLC", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Esempio n. 15
0
        FormTwitter1 frm6  = new FormTwitter1();  //create an object named frm6 to link to the next twitter form created

        private void textBox1_Click(object sender, EventArgs e)
        {
            PicUsername.BackgroundImage = Properties.Resources.login_profile; //link to image location
            TxtUsername.Clear();                                              //clear text content in textbox when click event occurs

            //flowLayoutPanel1.BackColor = Color.FromArgb(78, 184, 206);
            //TxtUsername.ForeColor = Color.FromArgb(78, 184, 206);

            // flowLayoutPanel2.BackColor = Color.WhiteSmoke;
            // TxtUsername.ForeColor = Color.WhiteSmoke;

            //  flowLayoutPanel3.BackColor = Color.WhiteSmoke;
            // TxtUsername.ForeColor = Color.WhiteSmoke;
        }
Esempio n. 16
0
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(TxtUsername.Text) && !string.IsNullOrEmpty(TxtPassword.Text))
            {
                SqlConnection sqlConn = new SqlConnection("Data Source=DESKTOP-0997K4M;Initial Catalog=UserRegistrationDB;Integrated Security=True");
                SqlCommand    sqlComm = new SqlCommand("SELECT * FROM tblUser WHERE EmailAddress = @EmailAddress and Password = @Password", sqlConn);
                sqlConn.Open();

                SqlDataAdapter dataAdapter = new SqlDataAdapter();
                DataTable      dataTable   = new DataTable();
                sqlComm.Parameters.AddWithValue("@EmailAddress", TxtUsername.Text);
                sqlComm.Parameters.AddWithValue("@Password", TxtPassword.Text);
                DataSet dataSet = new DataSet();

                dataAdapter.SelectCommand = sqlComm;
                dataAdapter.Fill(dataTable);



                if (dataTable.Rows.Count > 0)
                {
                    TxtUsername.Clear();
                    TxtPassword.Clear();
                    ChckShowPassword.Checked = false;
                    this.Hide();


                    BCMainForm mainForm = new BCMainForm();
                    mainForm.ShowDialog();
                    mainForm = null;

                    this.Hide();
                    this.TxtUsername.Select();
                }
                else
                {
                    //show error message
                    MessageBox.Show("Username or Password incorrect. Try Agian", "Login form", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    TxtUsername.Focus();
                    TxtUsername.SelectAll();
                }
            }
            else
            {
                MessageBox.Show("Please enter username and password. ", "Create Account", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                TxtUsername.Select();
            }
        }
Esempio n. 17
0
        private async void BtnLogin_Click(object sender, RoutedEventArgs e)
        {
            if (await AppState.AttemptLogin(TxtUsername.Text, PswdPassword.Password))
            {
                AppState.CurrentUser = await AppState.LoadUser(TxtUsername.Text);

                AppState.SetUserDatabaseInformation();
                AppState.Navigate(new TrackerPage());
                TxtUsername.Clear();
                PswdPassword.Clear();
                TxtUsername.Focus();
            }
            else
            {
                AppState.DisplayNotification("Invalid credentials. Please try again.", "Personal Tracker");
            }
        }
Esempio n. 18
0
        private void MenuBtn_Click(object sender, EventArgs e)
        {
            switch ((sender as Button).Name)
            {
            case "BtnServer":
                TabControlCenter.SelectedTab = TabControlCenter.TabPages[0];
                break;

            case "BtnSchools":
                TabControlCenter.SelectedTab = TabControlCenter.TabPages[1];
                Schools();
                break;

            case "BtnLock":
                TxtUsername.Clear();
                TxtPassword.Clear();
                PanelLocked.Show();
                break;

            case "BtnExit":
                Close();
                break;

            case "BtnMadeBy":
                new MadeBy().ShowDialog();
                break;

            case "newschoolbtn":
                TabControlCenter.SelectedTab = TabControlCenter.TabPages[2];
                break;

            case "BtnNewSchoolNext":
                TabControlCenter.SelectedTab = TabControlCenter.TabPages[3];
                break;

            case "BtnSettings":
                TabControlCenter.SelectedTab = TabControlCenter.TabPages[4];
                break;
            }
        }
        private async void BtnAddAccount_Click(object sender, RoutedEventArgs e)
        {
            if (TxtUsername.Text.Length < 3 || TxtPassword.Password.Length < 3)
            {
                await this.ShowMessageAsync(LanguageManager.Translate("249"), LanguageManager.Translate("250"));

                return;
            }

            if (GlobalConfiguration.Instance.GetAccount(TxtUsername.Text) != null)
            {
                await this.ShowMessageAsync(LanguageManager.Translate("249"), LanguageManager.Translate("398"));

                return;
            }

            GlobalConfiguration.Instance.AddAccountAndSave(TxtUsername.Text, TxtPassword.Password, CmbServer.Text, TxtCharacter.Text, TxtNickname.Text);

            TxtUsername.Clear();
            TxtPassword.Clear();
            TxtCharacter.Clear();
            TxtNickname.Clear();
        }
Esempio n. 20
0
 private void TxtsResetter()
 {
     TxtUsername.Clear();
     TxtPassword.Clear();
     TxtUsername.Focus();
 }
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            if (!loggedIn)

            {
                while (attempt <= MaxAttempts)

                {
                    if (TxtUsername.Text != username)

                    {
                        // username is incorrect

                        MessageBox.Show("Invalid username, " + (MaxAttempts - attempt) + " attempts remaining");

                        attempt++;

                        return;
                    }

                    else

                    {   // username is correct
                        // so check password

                        if (TxtPassword.Text != myPassword)

                        {
                            // Incorrect password

                            attempt++;

                            MessageBox.Show("Incorrect password," + (MaxAttempts - attempt) + " attempts remaining");

                            return;
                        }

                        else

                        {
                            //Both are correct

                            attempt = 1; // reset the number of attempts

                            loggedIn = true;

                            // MessageBox.Show("Hi " + username + ", your login successful", "Welcome!!");



                            foreach (var grp in Login.Controls.OfType <GroupBox>())

                            {
                                foreach (var btn in grp.Controls.OfType <Button>())

                                {
                                    btn.Enabled = true;

                                    btn.ForeColor = Color.Black;
                                }
                            }



                            BtnLogin.Text = "Logout";

                            toolStripStatusLabel1.Text = "Hi " + username + ", you are logged in.";

                            // this.Width = 1600;

                            break; // come out of while loop
                        }//endif
                    }//endif
                }//end while
            }

            else

            {
                BtnLogin.Text = "Login";

                toolStripStatusLabel1.Text = "You are logged out.";

                loggedIn = false;



                TxtUsername.Clear();

                TxtPassword.Clear();



                foreach (var grp in Login.Controls.OfType <GroupBox>())

                {
                    foreach (var btn in grp.Controls.OfType <Button>())

                    {
                        btn.Enabled = false;
                    }
                }
            }
        }
Esempio n. 22
0
        //button register
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            //MessageBox.Show(rezult);
            if (TxtPassword.Text == "")
            {
                MessageBox.Show("Please enter password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TxtPassword.Focus();
                return;
            }
            if (TxtPassword2.Text == "")
            {
                MessageBox.Show("Please enter confirm password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TxtPassword.Focus();
                return;
            }
            if (TxtUsername.Text == "")
            {
                MessageBox.Show("Please enter username", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TxtPassword.Focus();
                return;
            }
            try
            {
                SqlConnection myConnection = default(SqlConnection);
                myConnection = new SqlConnection(@"Data Source=DESKTOP-NP1RDM2\BAZALUIMARIAN;Initial Catalog=task;Persist Security Info=True;User ID=sa; Password = 0299");



                if (TxtPassword.Text == TxtPassword2.Text)
                {
                    String query = "INSERT INTO dbo.Users (NameUser,PasswordUser) VALUES (@UserName,@Password)";

                    using (SqlCommand command = new SqlCommand(query, con))
                    {
                        command.Parameters.AddWithValue("@UserName", TxtUsername.Text);
                        command.Parameters.AddWithValue("@Password", TxtPassword.Text);
                        MessageBox.Show("Register successfully !", "Register Successfully", MessageBoxButtons.OK, MessageBoxIcon.Error);

                        con.Open();
                        int result = command.ExecuteNonQuery();

                        // Check Error
                        if (result < 0)
                        {
                            Console.WriteLine("Error inserting data into Database!");
                        }
                        Close();
                    }
                }



                else
                {
                    MessageBox.Show("Register Denied", "Register Denied", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    TxtUsername.Clear();
                    TxtPassword.Clear();
                    TxtPassword2.Clear();
                    TxtUsername.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 23
0
        FormFacebook3 frm3 = new FormFacebook3();//object

        private void textBox1_Click(object sender, EventArgs e)
        {
            PicUsername.BackgroundImage = Properties.Resources.login_profile; //image location
            TxtUsername.Clear();                                              //click event triggers clearing of the text box
        }
Esempio n. 24
0
 private void BtnReset_Click(object sender, EventArgs e)
 {
     TxtUsername.Clear();
     TxtPassword.Clear();
 }
Esempio n. 25
0
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            //MessageBox.Show(rezult);
            if (TxtPassword.Text == "")
            {
                MessageBox.Show("Please enter password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TxtPassword.Focus();
                return;
            }
            try
            {
                SqlConnection myConnection = default(SqlConnection);
                myConnection = new SqlConnection(@"Data Source=DESKTOP-NP1RDM2\BAZALUIMARIAN;Initial Catalog=task;Persist Security Info=True;User ID=sa; Password = 0299");

                SqlCommand myCommand = default(SqlCommand);

                myCommand = new SqlCommand("SELECT NameUser,PasswordUser FROM Users WHERE NameUser = @NameUser AND PasswordUser = @PasswordUser", myConnection);

                SqlParameter uName     = new SqlParameter("@NameUser", SqlDbType.VarChar);
                SqlParameter uPassword = new SqlParameter("@PasswordUser", SqlDbType.VarChar);


                uName.Value     = TxtUsername.Text;
                uPassword.Value = TxtPassword.Text;

                myCommand.Parameters.Add(uName);
                myCommand.Parameters.Add(uPassword);

                myCommand.Connection.Open();

                SqlDataReader myReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection);

                if (myReader.Read() == true)
                {
                    string rezult   = "";
                    string NameUser = "******";
                    rezult = setValue(NameUser, rezult, TxtUsername.Text);
                    if (rezult == "0")
                    {
                        Clients newForm = new Clients();
                        newForm.ShowDialog(this);
                    }
                    else
                    {
                        Admins newForm = new Admins();
                        newForm.ShowDialog(this);
                    }

                    con.Close();
                }


                else
                {
                    MessageBox.Show("Login Failed...Try again !", "Login Denied", MessageBoxButtons.OK, MessageBoxIcon.Error);

                    TxtUsername.Clear();
                    TxtPassword.Clear();
                    TxtUsername.Focus();
                }
                if (myConnection.State == ConnectionState.Open)
                {
                    myConnection.Dispose();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }