private void BtnGuardar_Click(object sender, EventArgs e)
        {
            if (TxtPassword.Text == TxtPassword2.Text)
            {
                if (TxtUsuario.Text != "" || TxtPassword.Text != "" || TxtPassword2.Text != "")
                {
                    Usuarios n    = new Usuarios(TxtUsuario.Text, TxtPassword.Text, TxtNombre.Text, TxtEmail.Text, "11", Convert.ToInt32(CmbTipoCuenta.SelectedValue));
                    Boolean  resp = n.Guardar();

                    if (resp)
                    {
                        MessageBox.Show("Se ha guardado el usuario con exito", "Guardado con exito", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        TxtEmail.Clear();
                        TxtNombre.Clear();
                        TxtPassword.Clear();
                        TxtPassword2.Clear();
                        TxtUsuario.Clear();
                    }
                    else
                    {
                        MessageBox.Show("Error al guardar", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("No se permiten campos vacios", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Las contraseñas no coinciden", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 private void TxtUserName_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == Convert.ToChar(Keys.Enter))
     {
         TxtPassword.Focus();
     }
 }
 private void TxtUserId_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         TxtPassword.Focus();
     }
 }
 private void TxtName_OnKeyDown(object sender, KeyRoutedEventArgs e)
 {
     if (e.Key == Windows.System.VirtualKey.Enter || e.Key == Windows.System.VirtualKey.Accept)
     {
         TxtPassword.Focus(FocusState.Pointer);
     }
 }
 private void TxtUserEmail_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         TxtPassword.Focus();        // 이메일치고 엔터누르면 포커스가 패스워드창으로 감
     }
 }
示例#6
0
        void ReleaseDesignerOutlets()
        {
            if (LoginButton != null)
            {
                LoginButton.Dispose();
                LoginButton = null;
            }

            if (SignupButton != null)
            {
                SignupButton.Dispose();
                SignupButton = null;
            }

            if (TxtPassword != null)
            {
                TxtPassword.Dispose();
                TxtPassword = null;
            }

            if (TxtUserName != null)
            {
                TxtUserName.Dispose();
                TxtUserName = null;
            }
        }
        private void DgvManagers_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)//select the manager to updating or deactiving
        {
            BtnAdd.Hide();
            BtnUpdate.Show();
            BtnDeactive.Show();
            BtnCancel.Show();
            TxtPassword.Hide();
            LblPassword.Text = "New Password";
            LblComment.Show();
            TxtNewPassword.Show();
            int Id = Convert.ToInt32(DgvManagers.Rows[e.RowIndex].Cells[0].Value);

            _selectedManager = _managerService.Find(Id);

            //index of selected manager on datagridview
            _selectedIndex = e.RowIndex;
            //fill the selected manager information to the textboxes
            TxtName.Text     = _selectedManager.Name;
            TxtSurname.Text  = _selectedManager.Surname;
            TxtPhone.Text    = _selectedManager.Phone;
            TxtUsername.Text = _selectedManager.Username;
            if (_selectedManager.IsAdmin == true)
            {
                CmbPosition.SelectedIndex = 0;
                return;
            }
            CmbPosition.SelectedIndex = 1;
        }
示例#8
0
    protected void BtnLogin_Click(object sender, EventArgs e)
    {
        string Username = TxtUsername.Text;
        string Password = TxtPassword.Text;

        if (string.IsNullOrEmpty(Username))
        {
            Config.MsgBoxAjax("İstifadəçi adı daxil edin.");
            TxtUsername.Focus();
            return;
        }

        if (string.IsNullOrEmpty(Password))
        {
            Config.MsgBoxAjax("Şifrə daxil edni.");
            TxtPassword.Focus();
            return;
        }

        DataTable Dt = DALC.GetDataTable("*", "Users", "Username,Password,IsActive", new object[] { Username, Password.Sha1(), true });

        if (Dt == null)
        {
            Config.MsgBoxAjax(Config._DefaultErrorMessages);
            return;
        }

        if (Dt.Rows.Count != 1)
        {
            Config.MsgBoxAjax("Giriş baş tutmadı!");
            return;
        }

        var Dictionary = new Dictionary <string, string>();

        //Success
        DALC.AdministratorClass AdminLoginInformation = new DALC.AdministratorClass();
        AdminLoginInformation.ID            = Dt._RowsObject("ID")._ToInt16();
        AdminLoginInformation.Fullname      = Dt._Rows("Fullname");
        AdminLoginInformation.UsersStatusID = Dt._Rows("UsersStatusID")._ToInt16();
        Session["AdminLogin"] = AdminLoginInformation;


        string ReturnResult = Config._GetQueryString("return");

        if (ReturnResult == "close-page")
        {
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "JsWindowClose", "this.close();", true);
            return;
        }

        if (ReturnResult.Length > 0)
        {
            Config.Rd(ReturnResult);
        }
        else
        {
            Config.Rd("/tools/main");
        }
    }
示例#9
0
        private async void  login_button_click(object sender, RoutedEventArgs e)
        {
            if (TxtUsername.Text == "")
            {
                _message.Message.Text = "Please Enter Username";
                TxtUsername.Focus();
                await DialogHost.Show(_message, "RootDialog");

                return;
            }
            if (TxtPassword.Password == "")
            {
                _message.Message.Text = "Please Enter Password";
                TxtPassword.Focus();
                await DialogHost.Show(_message, "RootDialog");

                return;
            }
            UserDataManager userManager = new UserDataManager();
            User            user        = userManager.AuthenticateUser(TxtUsername.Text, TxtPassword.Password);

            if (user == null)
            {
                _message.Message.Text = "Wrong username or password";
                TxtUsername.Focus();
                await DialogHost.Show(_message, "RootDialog");

                return;
            }
            MainWindow window = new MainWindow();

            window.Show();
            Close();
        }
 private void TxtUserEmail_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         TxtPassword.Focus();
     }
 }
示例#11
0
 private void Txtusername_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         TxtPassword.Focus();
     }
 }
示例#12
0
        private void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            string email = TxtEmail.Text;
            string pass  = TxtPassword.Password;

            var data = myContext.User.Where(d => d.Email == email).SingleOrDefault();

            if (email == null)
            {
                TxtEmail.BorderBrush = Brushes.Red;
                TxtEmail.Focus();
            }
            if (pass == null)
            {
                TxtPassword.BorderBrush = Brushes.Red;
                TxtPassword.Focus();
            }
            if (data != null)
            {
                MessageBox.Show("Login Successful");
                MainWindow dboard = new MainWindow();
                dboard.Show();
                this.Close();
            }
            else
            {
                MessageBox.Show("Login Unsuccessful! Re-entry your input");
                TxtEmail.Text        = "";
                TxtPassword.Password = "";
            }
        }
示例#13
0
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            AuthBAL Auth = new AuthBAL();
            AuthDAL Ad   = new AuthDAL();

            if (TxtUseName.Text.Trim() != "" && TxtPasWord.Text.Trim() != "")
            {
                Auth.Username = TxtUseName.Text.Trim();
                Auth.Password = TxtPasWord.Text.Trim();
                bool result = Ad.Auth(Auth);
                if (result == true)
                {
                    TUnlock.Enabled = true;
                }
                else
                {
                    MessageBox.Show("Invalid Username and Password");
                }
            }
            else if (TxtUseName.Text.Trim() == "")
            {
                MessageBox.Show("Username Cannot be Empty");
                TxtUsername.Focus();
            }
            else if (TxtPasWord.Text.Trim() == "")
            {
                MessageBox.Show("Password Cannot be Empty");
                TxtPassword.Focus();
            }
            else
            {
                MessageBox.Show("Username and Password cannot be empty");
            }
        }
示例#14
0
        private void BtnAddUser_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(TxtFirstName.Text) && !string.IsNullOrEmpty(TxtLastName.Text) && !string.IsNullOrEmpty(TxtPassword.Text) && (dateEnrollmentDate.Checked || dateHireDate.Checked) && comboBoxDisc.Text != null)
            {
                using (var db = new SchoolEntities())
                {
                    DateTime?dt         = null;
                    var      hireDate   = (dateHireDate.Enabled == true) ? dateHireDate.Value : dt;
                    var      enrollDate = (dateEnrollmentDate.Enabled == true) ? dateEnrollmentDate.Value : dt;

                    var person = new Person()
                    {
                        LastName = TxtLastName.Text, FirstName = TxtFirstName.Text, HireDate = hireDate, EnrollmentDate = enrollDate, Discriminator = comboBoxDisc.SelectedItem.ToString(), Password = TxtPassword.Text
                    };

                    db.Person.Add(person);
                    db.SaveChanges();

                    dataGridView1.DataSource = db.Person.ToList();
                    dataGridView1.Rows[dataGridView1.Rows.Count - 1].Selected = true;
                    dataGridView1.FirstDisplayedCell = dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[0];
                }

                TxtFirstName.ResetText();
                TxtLastName.ResetText();
                TxtPassword.ResetText();
                dateHireDate.ResetText();
                dateEnrollmentDate.ResetText();
                comboBoxDisc.SelectedItem = null;
            }
            else
            {
                MessageBox.Show("You havent entered every needed information.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
示例#15
0
        void ReleaseDesignerOutlets()
        {
            if (BtnClose != null)
            {
                BtnClose.Dispose();
                BtnClose = null;
            }

            if (BtnLogin != null)
            {
                BtnLogin.Dispose();
                BtnLogin = null;
            }

            if (TxtPassword != null)
            {
                TxtPassword.Dispose();
                TxtPassword = null;
            }

            if (TxtUsername != null)
            {
                TxtUsername.Dispose();
                TxtUsername = null;
            }
        }
示例#16
0
文件: PageLogin.cs 项目: deedat/test
 public PagePrinciple Login(string username, string password)
 {
     TxtUserName.EnterText(username);
     TxtPassword.EnterText(password);
     this.BtnLogin.Submit();
     return(new PagePrinciple());
 }
示例#17
0
 private void TxtUsername_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Tab)
     {
         TxtPassword.Focus();
     }
 }
示例#18
0
        private void _ingresar()
        {
            if (!_validar())
            {
                return;
            }
            if (Usuario.Ingresar(ref _modelo))
            {
                ModuloGeneral.UsuarioActivo = _modelo;
                ModuloGeneral.FrmLogin      = this;

                TxtNombreUsuario.Focus();
                TxtNombreUsuario.Clear();
                TxtPassword.Clear();

                FrmMDI frmMDI = new FrmMDI();
                ModuloGeneral.FrmMDI = frmMDI;
                frmMDI.Show();

                Visible = false;
            }
            else
            {
                MessageBox.Show(BaseDeDatos.Core.ConexionBaseDeDatos.Error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#19
0
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            AuthBAL Auth = new AuthBAL();

            if (TxtUsername.Text.Trim() != "" && TxtPassword.Text.Trim() != "")
            {
                Auth.Username = TxtUsername.Text.Trim();
                Auth.Password = TxtPassword.Text.Trim();
                bool result = Ad.Auth(Auth);
                if (result == true)
                {
                    Home main = new Home();
                    main.Show();
                    Hide();
                }
                else
                {
                    MessageBox.Show("Invalid Username and Password");
                }
            }
            else if (TxtUsername.Text.Trim() == "")
            {
                MessageBox.Show("Username Cannot be Empty");
                TxtUsername.Focus();
            }
            else if (TxtPassword.Text.Trim() == "")
            {
                MessageBox.Show("Password Cannot be Empty");
                TxtPassword.Focus();
            }
            else
            {
                MessageBox.Show("Username and Password Invalid");
            }
        }
示例#20
0
        void ReleaseDesignerOutlets()
        {
            if (TxtUsername != null)
            {
                TxtUsername.Dispose();
                TxtUsername = null;
            }

            if (TxtPassword != null)
            {
                TxtPassword.Dispose();
                TxtPassword = null;
            }

            if (CboRemember != null)
            {
                CboRemember.Dispose();
                CboRemember = null;
            }

            if (CmdLogin != null)
            {
                CmdLogin.Dispose();
                CmdLogin = null;
            }

            if (CmdCancel != null)
            {
                CmdCancel.Dispose();
                CmdCancel = null;
            }
        }
示例#21
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();
            }
        }
示例#22
0
 private void TxtUserID_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == (char)Keys.Enter) //e.KeyChar == 13 -> Enter
     {
         TxtPassword.Focus();
     }
 }
示例#23
0
 private void textID_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == (char)13) // 엔터
     {
         TxtPassword.Focus();
     }
 }
示例#24
0
 private void TxtUsuario_KeyDown(object sender, KeyEventArgs e) //con enter hace foco en el campo password
 {
     if (e.KeyCode == Keys.Enter)
     {
         TxtPassword.Focus();
     }
 }
        private void InisiarSesion()
        {
            DataBaseControl DBControl = new DataBaseControl(DataBaseControl.cPath, "ProjectDataBase.mdf");

            string[] parameters = { "@id", "@pass" };
            string[] elements   = { TxtUserName.Text, TxtPassword.Text };
            TxtUserName.Clear();
            TxtPassword.Clear();
            List <string> admins = new List <string> {
                "Admin", "Develop"
            };

            if (DBControl.Buscar("select * from Users where [UserName]=@id and [KeyWord]=@pass", parameters, elements))
            {
                string       cat      = DBControl.BuscarElemento("select [Category] from Users where [UserName]=@id and [KeyWord]=@pass", parameters, elements);
                MainPageForm mainPage = new MainPageForm(cat);
                this.Hide();
                mainPage.ShowDialog();
                this.Show();
                TxtUserName.Focus();
            }
            else
            {
                MessageBox.Show("Usuario o contraseña inválidos");
                TxtUserName.Focus();
            }
        }
示例#26
0
 private void Clear()
 {
     TxtFullName.Clear();
     TxtPhone.Clear();
     TxtUserEmail.Clear();
     TxtPassword.Clear();
 }
 private void TxtUsername_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key.Equals(Key.Enter))
     {
         TxtPassword.Focus();
     }
 }
示例#28
0
 private void TxtUserId_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == '\r') // 엔터
     {
         TxtPassword.Focus();
     }
 }
示例#29
0
 private void TxtUserID_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == 13)
     {
         TxtPassword.Focus();
     }
 }
示例#30
0
 private void TxtUserID_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == (char)13)
     {
         TxtPassword.Focus();    // ID 입력후 엔터 하면 커서 위치가 PW로 이동
     }
 }