Exemplo n.º 1
0
        private void btnLogeo_Click(object sender, RoutedEventArgs e)
        {
            if (UserText.Text != "")
            {
                if (PassText.Password != "")
                {
                    UserModel user            = new UserModel();
                    var       validacionLogin = user.LoginUser(UserText.Text, encrypt.md5(PassText.Password));
                    if (validacionLogin == true)
                    {
                        FormularioPrincipal frmP = new FormularioPrincipal();
                        frmP.Show();
                        frmP.Closing += frmP_Closing;
                        this.Hide();
                    }
                    else
                    {
                        MessageError("Contraseña o nombre de usuario incorrecto\n Intenta de nuevo");

                        PassText.Clear();
                        UserText.Focus();
                    }
                }
                else
                {
                    MessageError("Introduce una contraseña");
                }
            }
            else
            {
                MessageError("Introduce un nombre de usuario");
            }
        }
Exemplo n.º 2
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (this.NavigationContext.QueryString.ContainsKey("user"))
            {
                string title = this.NavigationContext.QueryString["title"];
                if (title.Length > 3 && title.Substring(0, 3) == "Re:")
                {
                    TitleText.Text = title;
                }
                else
                {
                    TitleText.Text = "Re: " + title;
                }

                UserText.Text = this.NavigationContext.QueryString["user"];
                reid          = int.Parse(this.NavigationContext.QueryString["reid"]);

                ContentText.Focus();
            }
            else
            {
                UserText.Focus();
            }
        }
        /// <summary>
        /// Validating user inputs
        /// </summary>
        private bool ValidateParameters()
        {
            if (string.IsNullOrWhiteSpace(UrlText.Text))
            {
                MessageBox.Show("Please enter SharePoint Url value.");
                UrlText.Focus();
                return(false);
            }

            if (string.IsNullOrWhiteSpace(UserText.Text))
            {
                MessageBox.Show("Please enter User value.");
                UserText.Focus();
                return(false);
            }

            if (string.IsNullOrWhiteSpace(PasswordText.Text))
            {
                MessageBox.Show("Please enter Password.");
                PasswordText.Focus();
                return(false);
            }

            return(true);
        }
Exemplo n.º 4
0
 private void frmP_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     PassText.Clear();
     UserText.Clear();
     errorlabel.IsEnabled = false;
     this.Show();
     UserText.Focus();
 }