Ejemplo n.º 1
0
        private bool CheckLogin()
        {
            bool isTrue = false;

            var userLogin = loginRepository.GetAllUser();

            foreach (var item in userLogin)
            {
                isTrue = TxtEmail.Text == item.TenDangNhap && TxtPassword.Text == item.MatKhau;
                if (isTrue)
                {
                    isTrue = true;
                    break;
                }
            }

            if (isTrue == true)
            {
                return(true);
            }
            else
            {
                lblError.Text = "Thông tin đăng nhập bị sai. Vui lòng kiểm tra lại.";
                TxtEmail.SelectAll();
                TxtEmail.Focus();

                return(false);
            }
        }
Ejemplo n.º 2
0
 private void BtnRemoveNode_Click(object sender, EventArgs e)
 {
     try
     {
         CheckTxtBox(TxtEmail.Text, TxtEmail);
         aNode.Remove(TxtEmail.Text);
         RefreshListbox();
         ClearInputFields();
     }
     catch (FormatException ex)
     {
         MessageBox.Show($"{ex.Message.ToString()}", "Indtastnings fejl", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     catch (NullReferenceException ex)
     {
         MessageBox.Show(ex.Message, "Prøv igen", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         TxtEmail.SelectAll();
         TxtEmail.Focus();
     }
 }
Ejemplo n.º 3
0
 private void BtnFindNode_Click(object sender, EventArgs e)
 {
     try
     {
         CheckTxtBox(TxtEmail.Text, TxtEmail);
         string email = TxtEmail.Text;
         RefreshListbox();
         TxtEmail.Focus();
         string nodeLocated = aNode.Find(email).Data.Email.ToString();
         int    index       = ListBoxOutput.FindString($"{nodeLocated}");
         ListBoxOutput.SetSelected(index, true);
         MessageBox.Show($"Bruger med email: [{nodeLocated}] er blevet fundet!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     catch (FormatException ex)
     {
         MessageBox.Show($"{ex.Message.ToString()}", "Indtastnings fejl", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     catch (NullReferenceException)
     {
         MessageBox.Show($"Brugeren med email: {TxtEmail.Text} findes ikke", "Prøv igen", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         TxtEmail.SelectAll();
         TxtEmail.Focus();
     }
 }
Ejemplo n.º 4
0
 private void TxtEmail_GotFocus(object sender, RoutedEventArgs e)
 {
     TxtEmail.SelectAll();
 }
Ejemplo n.º 5
0
        private bool ValidarCampos()
        {
            //if (string.IsNullOrEmpty(TxtNomina.Text))
            //{
            //    Soporte.MsgInformacion("Ingrese el Numero de Nomina");
            //    return false;
            //}

            if (string.IsNullOrEmpty(TxtNombres.Text))
            {
                Soporte.MsgInformacion("Ingrese un Nombre del Empleado");
                return(false);
            }
            if (string.IsNullOrEmpty(TxtApPaterno.Text))
            {
                Soporte.MsgInformacion("Ingrese el Apellido Paterno del Empleado");
                return(false);
            }
            if (string.IsNullOrEmpty(TxtApMaterno.Text))
            {
                Soporte.MsgInformacion("Ingrese el Apellido Materno del Empleado");
                return(false);
            }
            if (string.IsNullOrEmpty(TxtCURP.Text))
            {
                TxtCURP.Text = "Sin Registro";
            }
            if (string.IsNullOrEmpty(TxtRFC.Text))
            {
                TxtRFC.Text = "Sin Registro";
            }
            if (string.IsNullOrEmpty(TxtTelefono.Text))
            {
                TxtTelefono.Text = "0";
            }
            if (string.IsNullOrEmpty(TxtCelular.Text))
            {
                TxtCelular.Text = "0";
            }
            if (string.IsNullOrEmpty(TxtEmail.Text))
            {
                TxtEmail.Text = "*****@*****.**";
            }

            if (CmbAreas.SelectedIndex == 0)
            {
                Soporte.MsgInformacion("Seleccione un Area");
                return(false);
            }

            if (string.IsNullOrEmpty(CmbPuesto.Text))
            {
                Soporte.MsgInformacion("Seleccione un Puesto para el Empleado");
                return(false);
            }

            if (CmbPuesto.SelectedIndex == 0)
            {
                Soporte.MsgInformacion("Seleccione un Puesto para el Empleado");
                return(false);
            }

            if (string.IsNullOrEmpty(CmbEstatus.Text))
            {
                Soporte.MsgInformacion("Seleccione el estatus del Empleado");
                return(false);
            }

            if (CmbEstatus.SelectedIndex == 0)
            {
                Soporte.MsgInformacion("Seleccione el estatus del Empleado");
                return(false);
            }

            if (string.IsNullOrEmpty(TxtCalle.Text))
            {
                TxtCalle.Text = "Registro Pendiente";
            }

            if (string.IsNullOrEmpty(TxtNumInterno.Text))
            {
                TxtNumInterno.Text = "0";
            }
            if (string.IsNullOrEmpty(TxtNumExterno.Text))
            {
                TxtNumExterno.Text = "0";
            }

            if (string.IsNullOrEmpty(TxtEntreCalles.Text))
            {
                TxtEntreCalles.Text = "Registro Pendiente";
            }


            if (CmbxPais.SelectedIndex == 0)
            {
                Soporte.MsgError("Seleccione el Pais.");
                return(false);
            }

            if (CmbxEstado.SelectedIndex == 0)
            {
                Soporte.MsgError("Seleccione un Estado");
                return(false);
            }
            if (CmbxMunicipio.SelectedIndex == 0)
            {
                Soporte.MsgError("Seleccione un Municipio");
                return(false);
            }

            if (CmbColonias.SelectedIndex == 0)
            {
                Soporte.MsgError("Seleccione una Colonia");
                return(false);
            }

            if (string.IsNullOrEmpty(TxtCodigoPostal.Text))
            {
                TxtCodigoPostal.Text = "0";
            }



            if (Soporte.ValidarMail(TxtEmail.Text) == false)
            {
                Soporte.MsgInformacion("Correo no valido");
                TxtEmail.Focus();
                TxtEmail.SelectAll();
                return(false);
            }

            if (CmbEmpresa.SelectedIndex == 0)
            {
                Soporte.MsgError("Seleccione una Empresa");
                return(false);
            }

            if (CmbSucursal.SelectedIndex == 0)
            {
                Soporte.MsgError("Seleccione una Sucursal.");
                return(false);
            }


            return(true);
        }