Exemple #1
0
        private void BtnAuth_Click(object sender, RoutedEventArgs e)
        {
            //Console.WriteLine($"{TxbPass.Password} {TxbLogin.Text}");

            var user = ClsFrame.Ent.Police.FirstOrDefault(x => x.Password == TxbPass.Password && x.Login == TxbLogin.Text);

            if (TxbLogin.Text == "Инспектор" /*|| TxbPass.Text == "Пароль"*/)
            {
                BdLogin.Visibility = Visibility.Visible;
                BdPass.Visibility  = Visibility.Visible;
                CountTry++;
                if (CountTry == 3)
                {
                    ClsFiltr.FuncError("Вы не ввели данные!");
                    ClsFiltr.TxbClear(TxbLogin, "Инспектор");
                    //ClsFiltr.TxbClear(TxbPass, "Пароль");
                    CountTry = 0;
                }
            }

            else if (user == null)
            {
                BdLogin.Visibility = Visibility.Visible;
                BdPass.Visibility  = Visibility.Visible;
                CountTry++;

                if (CountTry == 3)
                {
                    Properties.Settings.Default.SaveData += 1;
                    WinBlock block = new WinBlock();
                    block.ShowDialog();
                    CountTry = 0;
                }
            }
            else
            {
                ClsFrame.FrmBody.Navigate(new Sucsess());
                BdLogin.Visibility = Visibility.Hidden;
                BdPass.Visibility  = Visibility.Hidden;
                CountTry           = 0;
            }

            ClsFiltr.TxbClear(TxbLogin, "Инспектор");
            TxbPass.Clear();
            //ClsFiltr.TxbClear(TxbPass, "Пароль");
        }
Exemple #2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            User   = new UsuarioAdmin();
            u.Nick = txbNick.Text;
            DialogResult dialogResult = MessageBox.Show("Realmente desea borrar a '" + u.Nick + "'?",
                                                        "CERRARA LA VENTANA", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (dialogResult == DialogResult.OK)
            {
                User.Delete(u.Nick);
                DatagridDatos();
            }
            txbNick.Clear(); txbName.Clear(); txbTel.Clear(); txbApP.Clear(); txbCorreo.Clear(); TxbPass.Clear(); txbApM.Clear();
            cbDepa.Text         = null; cbExt.Text = null; cbStatus.Text = null; cbNivel.Text = null;
            pbUser.Image        = BackgroundImage;
            txbNick.Enabled     = false; txbName.Enabled = false; txbTel.Enabled = false; txbApP.Enabled = false;
            txbCorreo.Enabled   = false; cbDepa.Enabled = false;
            cbExt.Enabled       = false; cbStatus.Enabled = false; cbNivel.Enabled = false;
            dgvUsuarios.Enabled = true; pbUser.Enabled = false;
        }
Exemple #3
0
        private void Botones(Control ctrl, bool dgv, bool estado, bool estado2)
        {
            //botones ejecutar accion
            btnAdd1.Visible = estado; btnUpdate1.Visible = estado; btnDelete1.Visible = estado; btnCancel.Visible = estado2;

            txbNick.Clear(); txbName.Clear(); txbTel.Clear(); txbApP.Clear(); txbCorreo.Clear(); TxbPass.Clear(); txbApM.Clear();
            cbDepa.Text = null; cbExt.Text = null; cbStatus.Text = null; cbNivel.SelectedIndex = 2;

            txbNick.Enabled   = estado2; txbName.Enabled = estado2; txbTel.Enabled = estado2; txbApP.Enabled = estado2;
            txbCorreo.Enabled = estado2; cbDepa.Enabled = estado2; cbExt.Enabled = estado2;
            cbStatus.Enabled  = estado2; cbNivel.Enabled = estado2; dgvUsuarios.Enabled = estado2; pbUser.Enabled = estado2;

            ctrl.Visible        = true;
            dgvUsuarios.Enabled = dgv;
        }
Exemple #4
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     User = new UsuarioAdmin();
     ActualizarDatos();
     datos = u.LlenadoDatos();
     User.Crear(datos);
     img.Registrar_foto(pbUser, txbNick.Text);
     DatagridDatos();
     MessageBox.Show("Usuario creado correctamente.",
                     "AGREGADO", MessageBoxButtons.OK, MessageBoxIcon.Information);//ventana de error con diseño
     txbNick.Clear(); txbName.Clear(); txbTel.Clear(); txbApP.Clear(); txbCorreo.Clear(); TxbPass.Clear(); txbApM.Clear();
     cbDepa.Text       = null; cbExt.Text = null; cbStatus.Text = null; cbNivel.Text = null;
     pbUser.Image      = BackgroundImage;
     txbNick.Enabled   = false; txbName.Enabled = false; txbTel.Enabled = false; txbApP.Enabled = false;
     txbCorreo.Enabled = false; cbDepa.Enabled = false;
     cbExt.Enabled     = false; cbStatus.Enabled = false; cbNivel.Enabled = false; dgvUsuarios.Enabled = true;
     pbUser.Enabled    = false;
 }