Exemple #1
0
        private void BtnAgregarUsaurio_Click(object sender, EventArgs e)
        {
            if (Is_validate_agregar_usuario())
            {
                ErrorAgregarUsuario.Clear();

                if (ID == null)
                {
                    Usuario U = new Usuario
                    {
                        ID_Usuario = Guid.NewGuid().ToString(),
                        Nombre     = txtNombreUsuario.Text,
                        Apellido   = txtApellidoUsuario.Text,
                        Correo     = txtCorreoUsuario.Text,
                        Area       = cbArea.Text,
                        Categoria  = cbCategoria.Text,
                        Telefono   = txtTelefonoUsuario.Text,
                        User       = txtUsuarioUsuario.Text,
                        Contraseña = txtContraseñaUsuario.Text
                    };

                    parent.AgregarUsuario(U);
                }
                else
                {
                    Usuario U = new Usuario
                    {
                        ID_Usuario = ID,
                        Nombre     = txtNombreUsuario.Text,
                        Apellido   = txtApellidoUsuario.Text,
                        Correo     = txtCorreoUsuario.Text,
                        Area       = cbArea.Text,
                        Categoria  = cbCategoria.Text,
                        Telefono   = txtTelefonoUsuario.Text,
                        User       = txtUsuarioUsuario.Text,
                        Contraseña = txtContraseñaUsuario.Text
                    };

                    parent.EditarUsuario(U);
                }
                this.Close();
            }
        }
Exemple #2
0
        private bool Is_validate_agregar_usuario()
        {
            bool no_error = true;

            if (txtNombreUsuario.Text == string.Empty)
            {
                ErrorAgregarUsuario.SetError(txtNombreUsuario, "Ingrese el Titulo");
                no_error = false;
            }

            if (txtApellidoUsuario.Text == string.Empty)
            {
                ErrorAgregarUsuario.SetError(txtApellidoUsuario, "Ingrese la Descripcion");
                no_error = false;
            }

            if (cbArea.Text == string.Empty)
            {
                ErrorAgregarUsuario.SetError(cbArea, "Ingrese el Area");
                no_error = false;
            }

            if (cbCategoria.Text == string.Empty)
            {
                ErrorAgregarUsuario.SetError(cbCategoria, "Ingrese el Area");
                no_error = false;
            }

            if (txtUsuarioUsuario.Text == string.Empty)
            {
                ErrorAgregarUsuario.SetError(txtUsuarioUsuario, "Ingrese el Area");
                no_error = false;
            }

            if (txtContraseñaUsuario.Text == string.Empty)
            {
                ErrorAgregarUsuario.SetError(txtContraseñaUsuario, "Ingrese el Area");
                no_error = false;
            }

            if (txtCorreoUsuario.Text == string.Empty)
            {
                ErrorAgregarUsuario.SetError(txtCorreoUsuario, "ingrese el correo");
                no_error = false;
            }
            else
            {
                if (Email_bien_escrito(txtCorreoUsuario.Text) == false)
                {
                    ErrorAgregarUsuario.SetError(txtCorreoUsuario, "El correo no es valido");
                    no_error = false;
                }
            }

            if (txtTelefonoUsuario.Text == string.Empty)
            {
                ErrorAgregarUsuario.SetError(txtTelefonoUsuario, "Ingrese el Telefono");
                no_error = false;
            }
            return(no_error);
        }