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.

83 lines
2.6 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>
/// XGSSLXWindow.xaml 的交互逻辑
/// </summary>
public partial class XGSSLXWindow : Window
{
SurgerySchedulingEntities myModel = new SurgerySchedulingEntities();
public XGSSLXWindow(int sslxid)
{
InitializeComponent();
id = sslxid;
}
int id = 0;
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Cus_Sslxb sslxlb = new Cus_Sslxb();
sslxlb = (from tbsslxb in myModel.SYS_SSDJB
where tbsslxb.ID == id
select new Cus_Sslxb
{
ID = tbsslxb.ID,
SSLX = tbsslxb.SSDJ,
}).FirstOrDefault();
sslx.Text = sslxlb.SSLX;
lxbm.Text = sslxlb.LXBM;
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 = sslxlb.bitSFQY == true ? 0 : 1;
}
private void btn_bc_Click(object sender, RoutedEventArgs e)
{
if (sslx.Text == null || sslx.Text == string.Empty)
{
MessageBox.Show("请填写手术类型");
return;
}
if (lxbm.Text == null || lxbm.Text == string.Empty)
{
MessageBox.Show("请填写类型编码");
return;
}
SYS_SSDJB sslxb = new SYS_SSDJB();
sslxb.ID = id;
sslxb.SSDJ = sslx.Text;
sslxb.DJMS = lxbm.Text;
try
{
myModel.Entry(sslxb).State = System.Data.Entity.EntityState.Modified;
myModel.SaveChanges();
MessageBox.Show("修改成功");
this.Close();
}
catch (Exception)
{
MessageBox.Show("修改失败");
}
}
}
}