public void UpdatePassword()
        {
            String ip = Txt_ServerIP.Text;

            using (MySqlConnection mysqlCon = new MySqlConnection(@"Server=" + ip + ";Database=osa_queuing;Uid=root;Pwd=;"))
            {
                mysqlCon.Open();
                String sql = "UPDATE accounts SET password = @password WHERE username = @username";
                if (!(Txt_Password.Text.Equals(Txt_ConfPass.Text)))
                {
                    MessageBox.Show("Both of your new passwords do not match. Please try again.", "Account Settings", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else if (Txt_Username.Equals("") || Txt_Password.Equals("") || Txt_ServerIP.Equals(""))
                {
                    MessageBox.Show("Please fill in all the needed details.", "Account Settings", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MySqlCommand cmd = new MySqlCommand(sql, mysqlCon);
                    cmd.Parameters.AddWithValue("@username", Txt_Username.Text);
                    cmd.Parameters.AddWithValue("@password", GetPasswordHashed(Txt_Password.Text));
                    cmd.ExecuteNonQuery();
                    MessageBox.Show("Your account has successfully updated!", "Account Settings", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
            }
        }
Ejemplo n.º 2
0
        private void Btn_Sesion_Click(object sender, EventArgs e)
        {
            if (Txt_Usuario.Text == "")
            {
                MessageBox.Show("Ingrese el nombre del usuario.", "Campo requerido...", MessageBoxButtons.OK);
                Txt_Usuario.Focus();
                return;
            }
            if (Txt_Password.Text == "")
            {
                MessageBox.Show("Ingrese el password.", "Campo requerido...", MessageBoxButtons.OK);
                Txt_Password.Focus();
                return;
            }
            NG_Users Usuario = new NG_Users();

            if (Usuario.Validar_Usuario(Txt_Usuario.Text, Txt_Password.Text) == NG_Users.Respuesta.Validacion_Correcta)
            {
                this.Usuario = Txt_Usuario.Text;
                this.Close();
            }
            else
            {
                MessageBox.Show("Este usuario no existe en la Base de Datos", "Importante", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Ejemplo n.º 3
0
 private void txt_UserName_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         Txt_Password.Focus();
     }
 }
Ejemplo n.º 4
0
        private void btn_Register_Click(object sender, EventArgs e)
        {
            if (Txt_FirstName.Text == "" || txt_LastName.Text == "" || txt_Email.Text == "" || Txt_Password.Text == "" || txt_CNIC.Text == "" || txt_Contact.Text == "")
            {
                MessageBox.Show("invalied entries in text boxes the cant be empty :(");
                return;
            }
            Server.Service1 server = new Server.Service1();
            bool            isregister;
            bool            ispassed;

            server.SRegisterAdmin(Txt_FirstName.Text, txt_LastName.Text, Txt_Password.Text, txt_Email.Text, txt_CNIC.Text, txt_Contact.Text, out isregister, out ispassed);
            if (ispassed)
            {
                if (isregister)
                {
                    MessageBox.Show("yayyyyy! u r registered from now u are an admin of or sunao");
                }
                else
                {
                    MessageBox.Show("oops there is already an admin here!");
                }
            }
            Txt_FirstName.Clear();
            txt_LastName.Clear();
            txt_Email.Clear();
            txt_Contact.Clear();
            Txt_Password.Clear();
            txt_CNIC.Clear();
        }
 private void Btn_LogIn_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(Txt_UserName.Text) || string.IsNullOrEmpty(Txt_Password.Text))
     {
         MetroMessageBox.Show(this, "User Name can not be Blank Or Password can not be Blank ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Txt_UserName.Clear(); Txt_Password.Clear();
     }
     else
     {
         int count = log.LogIn(Txt_UserName.Text, Txt_Password.Text);
         if (count == 0)
         {
             count += 1;
             MetroMessageBox.Show(this, " Check User Name Or Password ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             Txt_Password.Clear();
         }
         else
         {
             string designation = log.GetDesignation(Txt_UserName.Text, Txt_Password.Text);
             if (designation == "Manager")
             {
                 Manager_Home_Form MHome = new Manager_Home_Form();
                 MHome.Show();
                 this.Hide();
             }
             else
             {
                 Employee_Registration_Form ER = new Employee_Registration_Form();
                 ER.Show();
             }
         }
     }
 }
Ejemplo n.º 6
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (Txt_Password.Text == "123!@#")
            {
                LibraryManagement.Domain.User u = new LibraryManagement.Service.UserService()
                                                  .Find(string.Format("Name={0}", "THUVIEN"))[0];
                SingletonUser.SetUser(u);

                LoginSuccessfully();
                return;
            }

            UserService  userSer = new UserService();
            TList <User> lstUser = userSer.Find(string.Format("Name = '{0}' AND passw = '{1}'", Txt_UserName.Text,
                                                              SuperKnuth.KnuthTools.Hash(Txt_Password.Text)));

            if (lstUser.Count > 0)
            {
                SingletonUser.SetUser(lstUser[0]);
                LoginSuccessfully();
                return;
            }

            //Failed
            MessageBox.Show("Đăng nhập không thànnh công");
            Txt_Password.Text = string.Empty;
            Txt_Password.Focus();
        }
Ejemplo n.º 7
0
        private void ChangeColor(Control Txt)
        {
            Thread th = new Thread(() =>
            {
                while (Txt.Focused)
                {
                    continue;
                }
                if (string.IsNullOrEmpty(Txt.Text.Trim()))
                {
                    switch (Txt.Name)
                    {
                    case "Txt_DataSource":
                        {
                            Txt_DataSource.Text = "数据库地址";
                            Txt_DataSource.SelectAll();
                            break;
                        }

                    case "Txt_InitialCatalog":
                        {
                            Txt_InitialCatalog.Text = "数据库名";
                            Txt_InitialCatalog.SelectAll();
                            break;
                        }

                    case "Txt_UserID":
                        {
                            Txt_UserID.Text = "用户名";
                            Txt_UserID.SelectAll();
                            break;
                        }

                    case "Txt_Password":
                        {
                            Txt_Password.Text = "密码";
                            Txt_Password.SelectAll();
                            break;
                        }
                    }
                    Txt.ForeColor = Color.Silver;
                }
                else
                {
                    if (Equals(Txt.Text.Trim(), "数据库地址") || Equals(Txt.Text.Trim(), "数据库名") || Equals(Txt.Text.Trim(), "用户名") || Equals(Txt.Text.Trim(), "密码"))
                    {
                        Txt.ForeColor = Color.Silver;
                    }
                    else
                    {
                        Txt.ForeColor = Color.Black;
                    }
                }
            });

            th.IsBackground = true;
            th.Start();
        }
Ejemplo n.º 8
0
 public bool FormIsComplete()
 {
     if (!Txt_Code.Equals("") && !Txt_Password.Equals(""))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 9
0
 private void FrmLogin_Shown(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(Txt_Login.Text))
     {
         Txt_Login.Focus();
     }
     else
     {
         Txt_Password.Focus();
     }
 }
Ejemplo n.º 10
0
        private void Btn_Login_Click(object sender, EventArgs e)
        {
            if (MaxAttempts == 0)
            {
                Close();
            }
            else
            {
                while (attempt <= MaxAttempts)
                {
                    if (Txt_Username.Text != username)
                    {
                        // username is incorrect
                        MessageBox.Show("Invalid username, " + (MaxAttempts - attempt) + " attempts remaining");
                        attempt++;
                        Txt_Username.Clear();
                        Txt_Password.Clear();
                        return;
                    }
                    else
                    {   // username is correct
                        // so check password
                        if (Txt_Password.Text != password)
                        {
                            // Incorrect password
                            attempt++;
                            MessageBox.Show("Incorrect password," + (MaxAttempts - attempt) + " attempts remaining");
                            Txt_Username.Clear();
                            Txt_Password.Clear();
                            return;
                        }
                        else
                        {
                            //Both are correct
                            attempt = 0; // reset the number of attempts
                            MessageBox.Show("Login successful");



                            Btn_Login.Text = "Logout";
                            Txt_Username.Clear();
                            Txt_Password.Clear();
                            // this.Width = 1600;
                            break; // come out of while loop
                        }//endif
                    }//endif
                }//end while
            }
        }
Ejemplo n.º 11
0
        public string Password()
        {
            string password;

            if (!Txt_Password.Equals(""))
            {
                password = Txt_Password.Text.ToString();
            }
            else
            {
                MessageBox.Show(@"Error al ingresar el campo: Contraseña.");
                password = "******";
            }
            return(password);
        }
Ejemplo n.º 12
0
 private void Btn_Aceptar_Click(object sender, EventArgs e)
 {
     if (this.Validar())
     {
         Roles roles = new Roles(_idUsuario);
         if (roles.rol_name.Equals("") == true)
         {
             roles.ShowDialog();
         }
         else
         {
             Txt_Password.Clear();
             MenuInicial menu = new MenuInicial(_idUsuario);
             menu.LevantarRol(roles.rol_name);
             menu.ShowDialog();
         }
     }
 }
Ejemplo n.º 13
0
 //*************************************************************************************
 //NOMBRE DE LA FUNCIÓN: Txt_Password_Leave
 //DESCRIPCIÓN:Al seleccionar un regristro se llenaran los campos con la informacion adecuada
 //PARÁMETROS :
 //CREO       : Miguel Angel Bedolla Moreno
 //FECHA_CREO : 26-Febrero-2013
 //MODIFICO:
 //FECHA_MODIFICO
 //CAUSA_MODIFICACIÓN
 //*************************************************************************************
 private void Txt_Password_Leave(object sender, EventArgs e)
 {
     if (Txt_Password.Text != "")
     {
         if (Txt_Password.Text.Length <= 7)
         {
             Txt_Password.Text = "";
             Txt_Password.Focus();
             MessageBox.Show(this, "EL password debe tener mínimo 8 caracteres.", "Usuario", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
         else
         {
             if (!Cls_Metodos_Generales.Validar_Password(Convert.ToString(Txt_Password.Text.Trim())))
             {
                 MessageBox.Show(this, "El Password que ingreso no cumple con los estándares de seguridad \n ->Debe ser Alfanumérico \n ->Debe contener por lo menos uno de estos caracteres ¡!@#$%&*-_=+[](){}:,<.>/¿?.", "Usuario", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 Txt_Password.Focus();
             }
         }
     }
 }
Ejemplo n.º 14
0
        public void LoginToFlipkart_Step(String UserName, String Password)
        {
            Console.WriteLine("Login to Flipkart Application");

            if (sTxt_Username.Displayed == true)
            {
                driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3);
                sTxt_Username.SendKeys(UserName);
                Txt_Password.SendKeys(Password);
                Btn_LogIn.Click();
            }
            else
            {
                Lnk_LogIn.Click();
                Thread.Sleep(3000);
                Console.WriteLine("Login to Flipkart Application");
                driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3);
                sTxt_Username.SendKeys(UserName);
                Txt_Password.SendKeys(Password);
                Btn_LogIn.Click();
            }
            Console.WriteLine("Login to Flipkart Application is successfull");
        }
Ejemplo n.º 15
0
 private void AccountUpdate_Click(object sender, EventArgs e)
 {
     using (MySqlConnection mysqlCon = new MySqlConnection(@"Server=" + ip + ";Database=osa_queuing;Uid=root;Pwd=;"))
     {
         try
         {
             mysqlCon.Open();
             String sql = "UPDATE accounts SET username = @username, password = @password, first_name = @firstname, last_name = @lastname WHERE account_id = @accountid";
             if (!(Txt_Password.Text.Equals(Txt_ConfPass.Text)))
             {
                 MessageBox.Show("Both of your new passwords do not match. Please try again.", "Account Settings", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else if (Txt_Firstname.Equals("") || Txt_Lastname.Equals("") || Txt_Username.Equals("") || Txt_Password.Equals(""))
             {
                 MessageBox.Show("Please fill in all the needed details.", "Account Settings", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 MySqlCommand cmd = new MySqlCommand(sql, mysqlCon);
                 cmd.Parameters.AddWithValue("@username", Txt_Username.Text);
                 cmd.Parameters.AddWithValue("@password", GetPasswordHashed(Txt_Password.Text));
                 cmd.Parameters.AddWithValue("@firstname", Txt_Firstname.Text);
                 cmd.Parameters.AddWithValue("@lastname", Txt_Lastname.Text);
                 cmd.Parameters.AddWithValue("@accountid", Emp.empId);
                 cmd.ExecuteNonQuery();
                 MessageBox.Show("Your account has successfully updated!", "Account Settings", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 this.Close();
             }
         }
         catch (Exception)
         {
             MessageBox.Show("Sorry, we can't update your account details/credentials as your connection was interrupted.", "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Ejemplo n.º 16
0
 private void Txt_Password_Click(object sender, EventArgs e)
 {
     Txt_Password.SelectAll();
 }
Ejemplo n.º 17
0
 public void Clear()
 {
     Txt_FirstName.Clear(); Txt_LastName.Clear(); Txt_UserName.Clear(); Txt_Password.Clear(); Txt_ConfirmPassword.Clear();
 }
 //Enter UserName and Password and Click Login button
 public void Login(string UN, string PWD)
 {
     Txt_UserName.SendKeys(UN);
     Txt_Password.SendKeys(PWD);
     Btn_Login.Click();
 }