コード例 #1
0
ファイル: LoginPage.cs プロジェクト: keerthivasanM7/TestGit
 private void OK_Click(object sender, EventArgs e)
 {
     username = Usernametxt.Text;
     if (username != "")
     {
         if (File.Exists(path + Usernametxt.Text + ".xml"))
         {
             bool isValidUser = PasswordValidation();
             if (isValidUser == false)
             {
                 MessageBox.Show("Invalid Password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 Passwordtxt.Clear();
             }
             else
             {
                 ValidationPage();
             }
         }
         else
         {
             MessageBox.Show("Invalid UserName", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             Usernametxt.Clear();
             Passwordtxt.Clear();
         }
     }
 }
コード例 #2
0
 private void UserNametxt_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         Verify_Account();
         Passwordtxt.Focus();
     }
 }
コード例 #3
0
 private void pictureBox2_Click(object sender, EventArgs e)
 {
     Emailtxt.Clear();
     Passwordtxt.Clear();
     EmailSendtxt.Clear();
     Objecttxt.Clear();
     bodytxt.Clear();
     Filettxt.Clear();
 }
コード例 #4
0
 /// <summary>
 /// Sets the focus on the first empty textbox
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     if (iptxt.Text == "")
     {
         iptxt.Focus();
     }
     else if (uNametxt.Text == "")
     {
         uNametxt.Focus();
     }
     else
     {
         Passwordtxt.Focus();
     }
 }
コード例 #5
0
        async void LoginAppAsync(object sender, EventArgs args)
        {
            if (string.IsNullOrEmpty(Useridtxt.Text))
            {
                await App.Current.MainPage.DisplayAlert("Empty Values", "Please enter User ID", "OK");

                Useridtxt.Focus();
            }
            else if (string.IsNullOrEmpty(Passwordtxt.Text))
            {
                await App.Current.MainPage.DisplayAlert("Empty Values", "Please enter Password", "OK");

                Passwordtxt.Focus();
            }
            else
            {
                WebClient client = new WebClient();

                string url = "http://192.168.182.122/WMS/login.php?user1=" + Useridtxt.Text + "&" + "pass1=" + Passwordtxt.Text;

                byte[] html = client.DownloadData(url);
                res = utf.GetString(html);

                if (res == "upX")
                {
                    await App.Current.MainPage.DisplayAlert("Login Error", "Please Check User ID and Password", "OK");
                }
                else
                {
                    string json     = res;
                    var    mydata   = JObject.Parse(json);
                    string Name     = mydata["Username"].ToString();
                    string Position = mydata["UserID"].ToString();
                    // await App.Current.MainPage.DisplayAlert("Info", Name, "OK");
                    // await App.Current.MainPage.DisplayAlert("Info", Position, "OK");

                    Application.Current.MainPage = new NavigationPage(new Gridview());
                }
            }
        }
コード例 #6
0
        public async void RegisterMethod()
        {
            if (string.IsNullOrWhiteSpace(this.Emailtxt))
            {
                await Application.Current.MainPage.DisplayAlert("Error", "You mus enter Email.", "Accept");

                return;
            }


            //Valida que el formato del correo sea valido
            bool isEmail = Regex.IsMatch(Emailtxt, @"\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z", RegexOptions.IgnoreCase);

            if (!isEmail)
            {
                await Application.Current.MainPage.DisplayAlert("Advertencia", "El formato del correo electrónico es incorrecto, revíselo e intente de nuevo.", "OK");

                return;
            }


            if (string.IsNullOrEmpty(this.Passwordtxt))
            {
                await Application.Current.MainPage.DisplayAlert("Error", "You mus enter Password.", "Accept");

                return;
            }

            if (string.IsNullOrEmpty(this.Nombretxt))
            {
                await Application.Current.MainPage.DisplayAlert("Error", "You mus enter nombre.", "Accept");

                return;
            }



            if (string.IsNullOrEmpty(this.Edadtxt))
            {
                await Application.Current.MainPage.DisplayAlert("Error", "You mus enter edad.", "Accept");

                return;
            }

            else
            {
                if (Edadtxt.Length != 2)
                {
                    await Application.Current.MainPage.DisplayAlert("Advertencia", "Solo permite 2 digitos .", "OK");

                    return;
                }
            }



            this.isVisible  = true;
            this.isRunning  = true;
            this.isEnabled  = true;
            this.isPassword = true;


            await Task.Delay(1000);

            // User Modelo

            var user = new User
            {
                Email         = Emailtxt.ToLower(),
                Password      = Passwordtxt.ToLower(),
                Nombre        = Nombretxt.ToLower(),
                Edad          = Edadtxt.ToLower(),
                Creation_Date = DateTime.UtcNow.Date
            };

            await App.Database.SaveUserAsync(user);



            await Application.Current.MainPage.DisplayAlert("Datos guardados", "Bienvenido" + nombre.ToString(), "Acectar");

            this.IsRunningTxt = false;
            this.IsVisibleTxt = false;
            this.IsEnabledTxt = true;


            await Application.Current.MainPage.Navigation.PushAsync(new LoginPage());
        }
コード例 #7
0
 // Password page methods.
 public void EnterPassword(string Password)
 {
     Passwordtxt.Clear();
     Passwordtxt.SendKeys(Password);
 }