private void Button_GotFocus(object sender, RoutedEventArgs e) { if (P == true) { } else { TXTPASSWORD.Focus(); } }
private void CONFIRM_Click(object sender, RoutedEventArgs e) { try { if (error != 0 || TXTFIRSTNAME.Text == "" || TXTLASTNAME.Text == "" || TXTUSER.Text == "" || TXTCONTACT.Text == "" || TXTPASSWORD.Password == "" || TXTREPASSWORD.Password == "") { // pop1.IsOpen = true; if (TXTFIRSTNAME.Text == "") { TXTFIRSTNAME.Text = ""; } if (TXTLASTNAME.Text == "") { TXTLASTNAME.Text = ""; } if (TXTUSER.Text == "") { TXTUSER.Text = ""; } if (TXTCONTACT.Text == "") { TXTCONTACT.Text = ""; } if (TXTPASSWORD.Password == "") { TXTPASSWORD.Password = ""; } if (TXTREPASSWORD.Password == "") { TXTREPASSWORD.Password = ""; } } else { if (rb.IsChecked == false && rb1.IsChecked == false) { MessageBox.Show("Please select Admin Or User"); } else { re.USERNAME = TXTUSER.Text; re.FIRSTNAME = TXTFIRSTNAME.Text; re.LASTNAME = TXTLASTNAME.Text; re.MOBILE_NO = TXTCONTACT.Text; re.EMAIL = TXTEMAIL.Text; re.PASSWORD = TXTPASSWORD.Password; re.RETYPEPASSWORD = TXTREPASSWORD.Password; re.Status = txtstatus.Text; if (rb.IsChecked == true) { re.DESGINATION = Convert.ToString(rb.Content); } else { re.DESGINATION = Convert.ToString(rb1.Content); } if (TXTPASSWORD.Password == "" || TXTREPASSWORD.Password == "") { MessageBox.Show("please enter the password"); TXTPASSWORD.Focus(); return; } else if (TXTPASSWORD.Password != TXTREPASSWORD.Password) { MessageBox.Show("password not matching"); TXTREPASSWORD.Focus(); return; } DataTable DT = re.username(); if (DT.Rows.Count == 0) { } else { string DESIGINATION = DT.Rows[0]["DESGINATION"].ToString(); if (DESIGINATION == "User") { re.MASTERPERMISSIONS(); re.OPERTIONPERMISSIONS(); re.REPORTPERMISSION(); } else { } } clear(); string a1 = "Save", b1 = Convert.ToString(CONFIRM.Content); if (b1 == a1) { re.INSERT(); DataTable dt = re.fill_reggrid(); dgreg.ItemsSource = dt.DefaultView; popupinsert.IsOpen = true; // MessageBox.Show("inserted sucessfully"); } string a = "Update", b = Convert.ToString(CONFIRM.Content); if (b == a) { re.UPDATE(); DataTable dt = re.fill_reggrid(); dgreg.ItemsSource = dt.DefaultView; popup1.IsOpen = true; //MessageBox.Show("updated sucessfully"); } this.NavigationService.Refresh(); } } } catch (Exception) { MessageBox.Show("please enter correct values"); } }