private void MenuItem_Click_1(object sender, RoutedEventArgs e) { crud_item pndh = new crud_item(); pndh.Show(); this.Hide(); }
private void Button_Click_1(object sender, RoutedEventArgs e) { try { if (tb_old.Password == "" || tb_new.Password == "") { MessageBox.Show("masukkan password"); //tb_old.Focus(); } else if (tb_new.Password != tb_conf.Password) { MessageBox.Show("Password tidak sesuai!"); } else { if (!myContext.Logins.Any(x => x.Password == tb_old.Password)) { MessageBox.Show("Password anda salah", "Caution!", MessageBoxButton.OK); tb_old.Clear(); tb_new.Focus(); } else { Login updatePassword = (from m in myContext.Logins where m.Password == tb_old.Password select m).FirstOrDefault(); updatePassword.Password = tb_new.Password; myContext.SaveChanges(); MessageBox.Show("Password Changed", "Succesfully", MessageBoxButton.OK); tb_new.Clear(); tb_old.Focus(); crud_item pndh = new crud_item(); pndh.Show(); this.Hide(); } } } catch (Exception) { } }
private void Button_Click(object sender, RoutedEventArgs e) { //int Id = (Table_Supplier.SelectedItem as Supplier).Id; //Supplier update = (from n in myContext.Suppliers where n.Id == Id select n).Single(); //update.Name = nama.Text; //myContext.SaveChanges(); //string guid = email.ToString(); if (string.IsNullOrEmpty(tb_email.Text)) { MessageBox.Show("Email kosong", "Warning!", MessageBoxButton.OK); } else { if (!myContext.Logins.Any(x => x.Email == tb_email.Text)) { MessageBox.Show("Email anda tidak terdaftar", "Caution!", MessageBoxButton.OK); tb_email.Clear(); tb_email.Focus(); } else { Login updatePassword = (from m in myContext.Logins where m.Email == tb_email.Text select m).FirstOrDefault(); updatePassword.Password = tb_pass.Password; myContext.SaveChanges(); MessageBox.Show("Password Changed", "Succesfully", MessageBoxButton.OK); tb_email.Clear(); tb_pass.Focus(); crud_item pndh = new crud_item(); pndh.Show(); this.Hide(); } } }
private void Button_Click(object sender, RoutedEventArgs e) { if (cb_remember.IsChecked == true) { Properties.Settings.Default.Username = tb_email.Text; Properties.Settings.Default.Password = tb_pass.Password; Properties.Settings.Default.Save(); } if (cb_remember.IsChecked == false) { Properties.Settings.Default.Username = ""; Properties.Settings.Default.Password = ""; Properties.Settings.Default.Save(); } try { if (tb_email.Text.Length == 0) { MessageBox.Show("Email kosong"); //errormessage.Text = "Masukkan Email"; tb_email.Focus(); } else if (!Regex.IsMatch(tb_email.Text, @"^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$")) { MessageBox.Show("Email tidak valid"); //errormessage.Text = "Email tidak valid"; tb_email.Select(0, tb_email.Text.Length); tb_email.Focus(); } else { var emailcek = myContext.Logins.FirstOrDefault(v => v.Email == tb_email.Text); var passcek = emailcek.Password; //var passcek = emailcek.Password; if (string.IsNullOrEmpty(emailcek.ToString())) { } else { if (passcek == tb_pass.Password) { crud_item mainPage = new crud_item(); mainPage.Show(); this.Close(); if (cb_remember.IsChecked == true) { } } else { MessageBox.Show("Email/Password salah", "Caution", MessageBoxButton.OK); tb_email.Clear(); tb_pass.Focus(); } } } } catch (Exception) { } //Login cek = (from n in myContext.Logins where n.Email = tb_email select n).Single(); //cek.Email = tb_email.Text;} //crud_item pndh = new crud_item(); //pndh.Show(); //this.Hide(); }