private void TextBoxRfid_KeyUp(object sender, KeyEventArgs e) { //چلوگیری از وارد شدن براکت if (e.Key == Key.Oem4) { // e.Key = Key.Back; TextBoxRfid.Undo(); } }
private void TextBoxRfid_KeyDown(object sender, KeyEventArgs e) { //چلوگیری از وارد شدن براکت if (e.Key == Key.Oem4) { // e.Key = Key.Back; TextBoxRfid.Undo(); } if (e.Key == Key.NumPad0) { e.Handled = true; } if (e.Key == Key.NumPad1) { e.Handled = true; } if (e.Key == Key.NumPad2) { e.Handled = true; } if (e.Key == Key.NumPad3) { e.Handled = true; } if (e.Key == Key.NumPad4) { e.Handled = true; } if (e.Key == Key.NumPad5) { e.Handled = true; } if (e.Key == Key.NumPad6) { e.Handled = true; } if (e.Key == Key.NumPad7) { e.Handled = true; } if (e.Key == Key.NumPad8) { e.Handled = true; } if (e.Key == Key.NumPad9) { e.Handled = true; } if (e.Key == Key.NumPad9) { e.Handled = true; } }
private void ButtonShowProperty_Click(object sender, RoutedEventArgs e) { if (TextBoxRfid.Text == string.Empty) { MessageBox.Show("ثبت کارت ناموفق بوده است لطفا دوباره کارت را روی دستگاه کارت خوان قرار دهید"); TextBoxRfid.Focus(); return; } try { // var entityConnectionString = Contex.BuildEntityConnection(@"Data Source=192.168.0.17\sql2014;Initial Catalog=Personel;User ID=sa;Password=@110;Connection Timeout=60;"); //string entityConnectionString="Data Source=192.168.0.17\\sql2014;Initial Catalog=Personel;User ID=sa;Password=@110;Connection Timeout=60;"; var setting = GetSetting(); var entityConnectionString = Contex.BuildEntityConnection(setting.DataSource, setting.Instance, setting.InitialCatalog, setting.UserId, setting.Password); using (var dbs = new WpfManage.DAL.Contex()) { var s = dbs.memberMap.Where(x => x.RfidCard == TextBoxRfid.Text).FirstOrDefault(); if (TextBoxRfid.Text == s.RfidCard) { TextBlockFullName.Text = s.FullName; TextBlockNCode.Text = s.NCode; TextBlockNameFather.Text = s.NameFather; TextBlockNoPersonel.Text = s.PersonelNumber; TextBlockTellephone.Text = s.Tellephone; TextBlockAddress.Text = s.Address; // TextBoxRfId.Text = s.Image; byte[] binaryData = Convert.FromBase64String(s.Image); BitmapImage bi = new BitmapImage(); bi.BeginInit(); bi.StreamSource = new MemoryStream(binaryData); bi.EndInit(); ImagePersonel.Source = bi; ImagePlay.Visibility = Visibility.Hidden; // TextBoxRfid.Focus(); // TextBoxRfid.Clear(); // dbs.ProjectmemberMap.Add(s); } } } catch (Exception exception) { // MessageBox.Show("خطا در ارتباط"); } // TextBoxRfid.Clear(); }
private void ButtonClear_Click(object sender, RoutedEventArgs e) { TextBlockFullName.Text = ""; TextBlockNCode.Text = ""; TextBlockNameFather.Text = ""; TextBlockNoPersonel.Text = ""; TextBlockTellephone.Text = ""; TextBlockAddress.Text = ""; //ImagePersonel.Source = null; TextBoxRfid.Text = string.Empty; TextBoxRfid.Focus(); ImagePlay.Visibility = Visibility.Visible; // TextBoxRfId.Text = s.Image; }
private void ButtonEdite_Click(object sender, RoutedEventArgs e) { // Validate(TextBoxNCode.Text); if (Error == 1) { TextBoxNCode.Focus(); MessageBox.Show("مقادیر کد ملی صحیح نمی باشد"); return; } // Validate(TextBoxNoPersonel.Text); if (Error == 1) { TextBoxNoPersonel.Focus(); MessageBox.Show("مقادیر کد پرسنلی صحیح نمی باشد"); return; } // Validate(TextBoxRfid.Text); if (Error == 1) { TextBoxRfid.Focus(); MessageBox.Show("مقادیر کد کارت صحیح نمی باشد"); return; } // Validate(TextBoxTellephone.Text); if (Error == 1) { TextBoxTellephone.Focus(); MessageBox.Show("مقادیر شماره تلفن نمی باشد"); return; } else { string FullName = TextBoxFullName.Text; if (FullName == "") { MessageBox.Show("پر کردن فیلد نام و نام خانوادگی الزامی است"); TextBoxFullName.Focus(); return; } if (TextBoxNCode.Text == "") { MessageBox.Show("پر کردن فیلد شماره ملی الزامی است"); TextBoxNCode.Focus(); return; } if (TextBoxNoPersonel.Text == string.Empty) { MessageBox.Show("پر کردن فیلدشماره پرسنلی الزامی است"); TextBoxNoPersonel.Focus(); return; } if (TextBoxNCode.Text.Trim().Length <= 9) { MessageBox.Show("شماره ملی می بایست ده رقم باشد"); TextBoxNCode.Focus(); return; } if (TextBoxNCode.Text.Length != 10) { MessageBox.Show("شماره ملی می بایست ده رقم باشد"); TextBoxNCode.Focus(); return; } //if (TextBoxRfid.Text.Length == 9 || TextBoxRfid.Text.Length == 8 || TextBoxRfid.Text.Length == 7 // || TextBoxRfid.Text.Length == 6 || TextBoxRfid.Text.Length == 5 || TextBoxRfid.Text.Length == 4 || TextBoxRfid.Text.Length == 3 || TextBoxRfid.Text.Length == 2 || TextBoxRfid.Text.Length == 1) //{ // MessageBox.Show("شماره کارت می بایست ده رقم باشد"); // TextBoxRfid.Focus(); // return; //} if (TextBoxRfid.Text.Length > 10) { MessageBox.Show("شماره کارت می بایست ده رقم باشد"); return; } if (TextBoxRfid.Text.Length == 9) { MessageBox.Show("شماره کارت می بایست ده رقم باشد"); return; } if (TextBoxRfid.Text.Length == 8) { MessageBox.Show("شماره کارت می بایست ده رقم باشد"); return; } if (TextBoxRfid.Text.Length == 7) { MessageBox.Show("شماره کارت می بایست ده رقم باشد"); return; } if (TextBoxRfid.Text.Length == 6) { MessageBox.Show("شماره کارت می بایست ده رقم باشد"); return; } if (TextBoxRfid.Text.Length == 5) { MessageBox.Show("شماره کارت می بایست ده رقم باشد"); return; } if (TextBoxRfid.Text.Length == 4) { MessageBox.Show("شماره کارت می بایست ده رقم باشد"); return; } if (TextBoxRfid.Text.Length == 3) { MessageBox.Show("شماره کارت می بایست ده رقم باشد"); return; } if (TextBoxRfid.Text.Length == 2) { MessageBox.Show("شماره کارت می بایست ده رقم باشد"); return; } if (TextBoxRfid.Text.Length == 1) { MessageBox.Show("شماره کارت می بایست ده رقم باشد"); return; } if (TextBoxRfid.Text.Length == 0 || TextBoxRfid.Text.Length == 10) { StatuseCode1 = 0; if (StatuseCode1 == 0) { MethodCheckData(StatuseCode1, TextBoxNCode.Text.Trim(), TextBoxRfid.Text.Trim(), TextBoxNoPersonel.Text.Trim()); } if (StatuseCode1 == 4) { return; } if (StatuseCode1 == 1) { return; // MethodCheckData(StatuseCode); } if (StatuseCode1 == 2) { MessageBox.Show("خطا در ارتباط"); return; // MethodCheckData(StatuseCode); } if (StatuseCode == 5) { if (StatuseCode1 == 0) { //عملیات ویرایش در دیتا بیس MethodEdit(); return; // MethodCheckData(StatuseCode); } // MethodCheckData(StatuseCode); } } if (TextBoxRfid.Text.Length != 10) { MessageBox.Show("شماره کارت می بایست ده رقم باشد"); TextBoxNCode.Focus(); return; } } //دکمه ویرایش }
public WinAccessMember() { InitializeComponent(); TextBoxRfid.Focus(); }