You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
164 lines
5.8 KiB
164 lines
5.8 KiB
using SchedulingSystem.EntityClass; |
|
using System; |
|
using System.Collections.Generic; |
|
using System.Linq; |
|
using System.Text; |
|
using System.Windows; |
|
using System.Windows.Controls; |
|
using System.Windows.Data; |
|
using System.Windows.Documents; |
|
using System.Windows.Input; |
|
using System.Windows.Media; |
|
using System.Windows.Media.Imaging; |
|
using System.Windows.Shapes; |
|
|
|
namespace SchedulingSystemClient.InsertWindow |
|
{ |
|
/// <summary> |
|
/// XZMZYSWindow.xaml 的交互逻辑 |
|
/// </summary> |
|
public partial class XZMZYSWindow : Window |
|
{ |
|
public XZMZYSWindow() |
|
{ |
|
InitializeComponent(); |
|
} |
|
SurgerySchedulingEntities myModel = new SurgerySchedulingEntities(); |
|
private void Window_Loaded(object sender, RoutedEventArgs e) |
|
{ |
|
List<ComboBoxBinding> listsfqy = new List<ComboBoxBinding>(); |
|
listsfqy.Add(new ComboBoxBinding() { ID = 0, Name = "是" }); |
|
listsfqy.Add(new ComboBoxBinding() { ID = 1, Name = "否" }); |
|
sfqy.ItemsSource = listsfqy; |
|
sfqy.SelectedValuePath = "ID"; |
|
sfqy.DisplayMemberPath = "Name"; |
|
sfqy.SelectedIndex = 0; |
|
|
|
List<ComboBoxBinding> listyszc = new List<ComboBoxBinding>(); |
|
listyszc = (from tbssjb in myModel.SYS_YSZCB |
|
select new ComboBoxBinding |
|
{ |
|
ID = tbssjb.ID, |
|
Name = tbssjb.Name, |
|
}).ToList(); |
|
yszc.ItemsSource = listyszc; |
|
yszc.SelectedValuePath = "ID"; |
|
yszc.DisplayMemberPath = "Name"; |
|
List<ComboBoxBinding> listsslb1 = new List<ComboBoxBinding>(); |
|
listsslb1 = (from tbsslx in myModel.SYS_SSLXB |
|
select new ComboBoxBinding |
|
{ |
|
ID = tbsslx.ID, |
|
Name = tbsslx.SSLX, |
|
}).ToList(); |
|
scss1.ItemsSource = listsslb1; |
|
scss1.SelectedValuePath = "ID"; |
|
scss1.DisplayMemberPath = "Name"; |
|
List<ComboBoxBinding> listsslb2 = new List<ComboBoxBinding>(); |
|
listsslb2 = (from tbsslx in myModel.SYS_SSLXB |
|
select new ComboBoxBinding |
|
{ |
|
ID = tbsslx.ID, |
|
Name = tbsslx.SSLX, |
|
}).ToList(); |
|
scss2.ItemsSource = listsslb2; |
|
scss2.SelectedValuePath = "ID"; |
|
scss2.DisplayMemberPath = "Name"; |
|
List<ComboBoxBinding> listsslb3 = new List<ComboBoxBinding>(); |
|
listsslb3 = (from tbsslx in myModel.SYS_SSLXB |
|
select new ComboBoxBinding |
|
{ |
|
ID = tbsslx.ID, |
|
Name = tbsslx.SSLX, |
|
}).ToList(); |
|
scss3.ItemsSource = listsslb3; |
|
scss3.SelectedValuePath = "ID"; |
|
scss3.DisplayMemberPath = "Name"; |
|
} |
|
|
|
private void btn_bc_Click(object sender, RoutedEventArgs e) |
|
{ |
|
int? intscss1; |
|
int? intscss2; |
|
int? intscss3; |
|
if (ysxm.Text==string.Empty) |
|
{ |
|
MessageBox.Show("请填写医生姓名"); |
|
return; |
|
} |
|
if (ysgh.Text == string.Empty) |
|
{ |
|
MessageBox.Show("请填写医生姓名"); |
|
return; |
|
} |
|
if (yszc.SelectedValue == null) |
|
{ |
|
MessageBox.Show("请选择职称"); |
|
return; |
|
} |
|
if (scss1.SelectedValue == null) |
|
{ |
|
MessageBox.Show("请选择手擅长手术类型"); |
|
return; |
|
} |
|
if (scss1.SelectedValue == null) |
|
{ |
|
MessageBox.Show("请选择手擅长手术类型"); |
|
return; |
|
} |
|
if (scss1.SelectedValue == null) |
|
{ |
|
MessageBox.Show("请选择手擅长手术类型"); |
|
return; |
|
} |
|
else |
|
{ |
|
intscss1 = Convert.ToInt32(scss1.SelectedValue); |
|
} |
|
if (scss2.SelectedValue == null) |
|
{ |
|
intscss2 = null; |
|
} |
|
else |
|
{ |
|
intscss2 = Convert.ToInt32(scss2.SelectedValue); |
|
} |
|
if (scss3.SelectedValue == null) |
|
{ |
|
intscss3 = null; |
|
} |
|
else |
|
{ |
|
intscss3 = Convert.ToInt32(scss3.SelectedValue); |
|
} |
|
try |
|
{ |
|
var listmzys = (from ybmzys in myModel.SYS_MZYSB |
|
where ybmzys.YSBM == ysgh.Text && ybmzys.YSMC == ysxm.Text |
|
select new { ybmzys }).ToList(); |
|
if (listmzys.Count>0) |
|
{ |
|
MessageBox.Show("医生姓名和编码重复!"); |
|
return; |
|
} |
|
SYS_MZYSB mzys = new SYS_MZYSB(); |
|
mzys.SFQY = sfqy.SelectedValue.ToString() == "0" ? true : false; |
|
mzys.SCSS1 = intscss1; |
|
mzys.SCSS2 = intscss2; |
|
mzys.SCSS3 = intscss3; |
|
// mzys.SSSID = Convert.ToInt32(sss.SelectedValue); |
|
mzys.YSBM = ysgh.Text; |
|
mzys.YSMC = ysxm.Text; |
|
mzys.YSZCID = Convert.ToInt32(yszc.SelectedValue); |
|
myModel.SYS_MZYSB.Add(mzys); |
|
myModel.SaveChanges(); |
|
MessageBox.Show("新增成功"); |
|
this.Close(); |
|
} |
|
catch (Exception) |
|
{ |
|
MessageBox.Show("新增失败"); |
|
} |
|
} |
|
} |
|
}
|
|
|