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.

78 lines
2.2 KiB

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>
/// XZGZBRVIPWindow.xaml 的交互逻辑
/// </summary>
public partial class XZGZBRVIPWindow : Window
{
public XZGZBRVIPWindow()
{
InitializeComponent();
}
SurgerySchedulingEntities myModel = new SurgerySchedulingEntities();
private void btn_bc_Click(object sender, RoutedEventArgs e)
{
int intqz;
if (brxm == null|| brxm.Text == string.Empty)
{
MessageBox.Show("请填写病人姓名");
return;
}
if (zlkh == null || zlkh.Text == string.Empty)
{
MessageBox.Show("请填诊疗卡号");
return;
}
try
{
intqz = Convert.ToInt32(qz.Text);
}
catch (Exception)
{
MessageBox.Show("请输入正确的权重格式");
return;
}
var listbrvip = (from tbbrvip in myModel.SYS_HZVIPB
where tbbrvip.ZLKH == zlkh.Text
select new
{
tbbrvip
}).ToList();
if (listbrvip.Count > 0)
{
MessageBox.Show("诊疗卡号不能重复");
return;
}
SYS_HZVIPB brvipqz = new SYS_HZVIPB();
brvipqz.HZXM = brxm.Text;
brvipqz.ZLKH = zlkh.Text;
brvipqz.QZ = intqz;
try
{
myModel.SYS_HZVIPB.Add(brvipqz);
myModel.SaveChanges();
MessageBox.Show("新增成功");
this.Close();
}
catch (Exception)
{
MessageBox.Show("新增失败");
}
}
}
}