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.

106 lines
3.3 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>
/// XGGZBRVIPWindow.xaml 的交互逻辑
/// </summary>
public partial class XGGZBRVIPWindow : Window
{
public XGGZBRVIPWindow(int brvipqzid)
{
InitializeComponent();
id = brvipqzid;
}
SurgerySchedulingEntities myModel = new SurgerySchedulingEntities();
int id;
string strzlkh = string.Empty;
private void Window_Loaded(object sender, RoutedEventArgs e)
{
var listbrvip = (from tbbrvip in myModel.SYS_HZVIPB
where tbbrvip.ID == id
select new Cus_BrvipQz
{
ID = tbbrvip.ID,
BRXM = tbbrvip.HZXM,
ZLKH = tbbrvip.ZLKH,
QZ = tbbrvip.QZ,
}).Single();
brxm.Text = listbrvip.BRXM;
zlkh.Text = listbrvip.ZLKH;
strzlkh = listbrvip.ZLKH;
qz.Text = listbrvip.QZ.ToString();
}
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;
}
if (zlkh.Text != strzlkh)
{
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.ID = id;
brvipqz.HZXM = brxm.Text;
brvipqz.ZLKH = zlkh.Text;
brvipqz.QZ = intqz;
try
{
myModel.Entry(brvipqz).State = System.Data.Entity.EntityState.Modified;
myModel.SaveChanges();
MessageBox.Show("修改成功");
this.Close();
}
catch (Exception)
{
MessageBox.Show("修改失败");
}
}
}
}