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.
141 lines
4.7 KiB
141 lines
4.7 KiB
using SchedulingSystem.EntityClass; |
|
using SchedulingSystemClient.EntityClass; |
|
using System; |
|
using System.Collections.Generic; |
|
using System.Linq; |
|
using System.Windows; |
|
namespace SchedulingSystemClient.UpdateWindow |
|
{ |
|
/// <summary> |
|
/// XGSBWindow.xaml 的交互逻辑 |
|
/// </summary> |
|
public partial class XGSBWindow : Window |
|
{ |
|
public XGSBWindow(Cus_SBB row) |
|
{ |
|
InitializeComponent(); |
|
selectedRow = row; |
|
} |
|
Cus_SBB selectedRow = new Cus_SBB(); |
|
SurgerySchedulingEntities myModel = new SurgerySchedulingEntities(); |
|
int sbid; |
|
private void Window_Loaded(object sender, RoutedEventArgs e) |
|
{ |
|
List<ComboBoxBinding> listsblx = new List<ComboBoxBinding>(); |
|
listsblx = (from tbsblxb in myModel.SYS_SBLXB |
|
select new ComboBoxBinding |
|
{ |
|
ID = tbsblxb.ID, |
|
Name = tbsblxb.Name, |
|
}).ToList(); |
|
sblx.ItemsSource = listsblx; |
|
sblx.SelectedValuePath = "ID"; |
|
sblx.DisplayMemberPath = "Name"; |
|
List<ComboBoxBinding> listsss = new List<ComboBoxBinding>(); |
|
listsss = (from tbsssb in myModel.SYS_SSSB |
|
select new ComboBoxBinding |
|
{ |
|
ID = tbsssb.ID, |
|
Name = tbsssb.SSSMC, |
|
}).ToList(); |
|
sss.ItemsSource = listsss; |
|
sss.SelectedValuePath = "ID"; |
|
sss.DisplayMemberPath = "Name"; |
|
List<ComboBoxBinding> listsbdj = new List<ComboBoxBinding>(); |
|
listsbdj = (from tbsbdj in myModel.SYS_SBDJB |
|
select new ComboBoxBinding |
|
{ |
|
ID = tbsbdj.ID, |
|
Name = tbsbdj.Name, |
|
}).ToList(); |
|
sbdj.ItemsSource = listsbdj; |
|
sbdj.SelectedValuePath = "ID"; |
|
sbdj.DisplayMemberPath = "Name"; |
|
if (selectedRow.SSSID !=null) |
|
{ |
|
sss.SelectedValue = Convert.ToInt32(selectedRow.SSSID); |
|
} |
|
if (selectedRow.SBLX != null) |
|
{ |
|
sblx.SelectedValue = Convert.ToInt32(selectedRow.SBLX); |
|
} |
|
if (selectedRow.SBDJ != null) |
|
{ |
|
sbdj.SelectedValue = Convert.ToInt32(selectedRow.SBDJ); |
|
} |
|
sbbm.Text = selectedRow.SBBM; |
|
sbmc.Text = selectedRow.SBMC ; |
|
sbjg.Text = selectedRow.SBJG.ToString(); |
|
sbid = selectedRow.ID; |
|
} |
|
|
|
private void btn_bc_Click(object sender, RoutedEventArgs e) |
|
{ |
|
if (sbbm.Text == string.Empty) |
|
{ |
|
MessageBox.Show("请填写 设备编码"); |
|
return; |
|
} |
|
if (sbmc.Text == string.Empty) |
|
{ |
|
MessageBox.Show("请填写设备名称"); |
|
return; |
|
} |
|
if (sss.SelectedValue == null) |
|
{ |
|
MessageBox.Show("请选择手术室"); |
|
return; |
|
} |
|
if (sblx.SelectedValue == null) |
|
{ |
|
MessageBox.Show("请选择设备类型"); |
|
return; |
|
} |
|
if (sbdj.SelectedValue == null) |
|
{ |
|
MessageBox.Show("请选择设备等级"); |
|
return; |
|
} |
|
decimal jg; |
|
try |
|
{ |
|
if (sbjg.Text != string.Empty) |
|
{ |
|
jg = Convert.ToDecimal(sbjg.Text); |
|
} |
|
else |
|
{ |
|
jg = 0; |
|
} |
|
} |
|
catch (Exception) |
|
{ |
|
MessageBox.Show("设备价格格式不正确"); |
|
return; |
|
} |
|
int sssid = Convert.ToInt32(sss.SelectedValue); |
|
int sblxid = Convert.ToInt32(sblx.SelectedValue); |
|
int sbjdid = Convert.ToInt32(sbdj.SelectedValue); |
|
Bus_SBB sbb = new Bus_SBB(); |
|
sbb.SBBM = sbbm.Text; |
|
sbb.SBDJ = sbjdid; |
|
sbb.SBJG = jg; |
|
sbb.SBLX = sblxid; |
|
sbb.SBMC = sbmc.Text; |
|
sbb.SSSID = sssid; |
|
sbb.ID = sbid; |
|
try |
|
{ |
|
myModel.Entry(sbb).State = System.Data.Entity.EntityState.Modified; |
|
myModel.SaveChanges(); |
|
MessageBox.Show("修改成功"); |
|
this.Close(); |
|
} |
|
catch (Exception ex) |
|
{ |
|
MessageBox.Show(ex.ToString()); |
|
} |
|
|
|
} |
|
} |
|
}
|
|
|