private void btnSave_Click(object sender, RoutedEventArgs e) { int userType = 0; if (txbPidNo.Text == "" || txbUserName.Text == "" || cmbLicenseTypeCd.SelectedValue == null) { System.Windows.MessageBox.Show("带*项不能为空,请检查后重新保存"); return; } byte[] UserPhoto = null; try { if (_photo == null) { BitmapImage bmp = myImage.Source as BitmapImage; if (bmp != null) { UserPhoto = addDsrsrc.PhotoSave(bmp); } //用户类型 if (this.rdbVip.IsChecked == true) { userType = 1; } } DBAccessHelper.SaveTraStudInfo(txbPidNo.Text.Trim(), txbUserName.Text.Trim(), UserPhoto, this.rdbMan.IsChecked == true ? "男" : "女", this.dpBirthDay.SelectedDate.Value, _sFingerPrint, cmbDrivingSchool.SelectedValue == null ? -1 : Convert.ToInt32(cmbDrivingSchool.SelectedValue.ToString()), this.txbPhoneNo.Text.Trim(), ".", dpRegDate.SelectedDate.Value.ToString("yyyy-MM-dd"), "", "", cmbLicenseTypeCd.SelectedValue.ToString(), "", "", "", "", Convert.ToDouble("0"), txbAddress.Text.Trim(), userType); addDsrsrc.MainBarText = "学员:" + txbUserName.Text.Trim() + ",注册信息成功,可以进行预约"; tblSaveSta.Text = "保存成功"; txbPidNo.Text = ""; txbUserName.Text = ""; txbPhoneNo.Text = ""; txbAddress.Text = ""; } catch (Exception ex) { System.Windows.MessageBox.Show("保存学员信息失败,错误信息:" + ex.Message.ToString() + ""); tblSaveSta.Text = "保存失败"; return; } }