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.
109 lines
4.0 KiB
109 lines
4.0 KiB
using SchedulingSystem.EntityClass; |
|
using SchedulingSystemClient; |
|
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 SchedulingSystem |
|
{ |
|
/// <summary> |
|
/// XGSSSWindow.xaml 的交互逻辑 |
|
/// </summary> |
|
public partial class XGSSSWindow : Window |
|
{ |
|
SurgerySchedulingEntities myModel = new SurgerySchedulingEntities(); |
|
public XGSSSWindow(int sssid ) |
|
{ |
|
InitializeComponent(); |
|
id = sssid; |
|
} |
|
int id = 0; |
|
private void Window_Loaded(object sender, RoutedEventArgs e) |
|
{ |
|
Cus_SssLb sss = new Cus_SssLb(); |
|
sss = (from tbsssb in myModel.SYS_SSSB |
|
where tbsssb.ID == id |
|
select new Cus_SssLb |
|
{ |
|
ID = tbsssb.ID, |
|
SSSBM = tbsssb.SSSBM, |
|
SSSMC = tbsssb.SSSMC, |
|
bitSFQY = tbsssb.SFKQ, |
|
bitRJSSS = tbsssb.SFRJ, |
|
}).FirstOrDefault(); |
|
sssbm.Text = sss.SSSBM; |
|
sssmc.Text = sss.SSSMC; |
|
List<ComboBoxBinding> listsfqy = new List<ComboBoxBinding>(); |
|
listsfqy.Add(new ComboBoxBinding() { ID = 0, Name = "是" }); |
|
listsfqy.Add(new ComboBoxBinding() { ID = 1, Name = "否" }); |
|
List<ComboBoxBinding> listrjsss = new List<ComboBoxBinding>(); |
|
listrjsss.Add(new ComboBoxBinding() { ID = 0, Name = "是" }); |
|
listrjsss.Add(new ComboBoxBinding() { ID = 1, Name = "否" }); |
|
rjsss.ItemsSource = listrjsss; |
|
rjsss.SelectedValuePath = "ID"; |
|
rjsss.DisplayMemberPath = "Name"; |
|
rjsss.SelectedIndex = sss.bitRJSSS == true ? 0 : 1; |
|
sfqy.ItemsSource = listsfqy; |
|
sfqy.SelectedValuePath = "ID"; |
|
sfqy.DisplayMemberPath = "Name"; |
|
sfqy.SelectedIndex = sss.bitSFQY == true ? 0 : 1; |
|
} |
|
|
|
private void btn_bc_Click(object sender, RoutedEventArgs e) |
|
{ |
|
if (sssmc.Text == null || sssmc.Text == string.Empty) |
|
{ |
|
MessageBox.Show("请填写手术室名称"); |
|
return; |
|
} |
|
if (sssbm.Text == null || sssbm.Text == string.Empty) |
|
{ |
|
MessageBox.Show("请填写手术编码"); |
|
return; |
|
} |
|
//List<Cus_SssLb> listsss = (from tbsss in myModel.SYS_SSSB |
|
// select new Cus_SssLb |
|
// { |
|
// SSSBM = tbsss.SSSBM, |
|
// SSSMC = tbsss.SSSMC, |
|
// }).ToList(); |
|
|
|
//if (listsss.Where(a => a.SSSMC == sssmc.Text).Count() > 0) |
|
//{ |
|
// MessageBox.Show("该手术室名称已存在"); |
|
// return; |
|
//} |
|
//if (listsss.Where(a => a.SSSBM == sssbm.Text).Count() > 0) |
|
//{ |
|
// MessageBox.Show("该手术室名称已存在"); |
|
// return; |
|
//} |
|
SYS_SSSB sssb = new SYS_SSSB(); |
|
sssb.ID = id; |
|
sssb.SSSMC = sssmc.Text; |
|
sssb.SSSBM = sssbm.Text; |
|
sssb.SFKQ = sfqy.SelectedValue.ToString() == "0" ? true : false; |
|
sssb.SFRJ = rjsss.SelectedValue.ToString() == "0" ? true : false; |
|
try |
|
{ |
|
myModel.Entry(sssb).State = System.Data.Entity.EntityState.Modified; |
|
myModel.SaveChanges(); |
|
MessageBox.Show("修改成功"); |
|
this.Close(); |
|
} |
|
catch (Exception) |
|
{ |
|
MessageBox.Show("修改失败"); |
|
} |
|
} |
|
} |
|
}
|
|
|