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.
105 lines
3.2 KiB
105 lines
3.2 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> |
|
/// XGGZYSVIPWindow.xaml 的交互逻辑 |
|
/// </summary> |
|
public partial class XGGZYSVIPWindow : Window |
|
{ |
|
public XGGZYSVIPWindow(int ysvipqzid) |
|
{ |
|
InitializeComponent(); |
|
id = ysvipqzid; |
|
} |
|
SurgerySchedulingEntities myModel = new SurgerySchedulingEntities(); |
|
int id; |
|
string strysbm = string.Empty; |
|
private void Window_Loaded(object sender, RoutedEventArgs e) |
|
{ |
|
var listysvip = (from tbysvip in myModel.SYS_YSVIPB |
|
where tbysvip.ID == id |
|
select new Cus_YsvipQz |
|
{ |
|
ID = tbysvip.ID, |
|
YSXM = tbysvip.YSXM, |
|
YSBM = tbysvip.YSBM, |
|
QZ = tbysvip.QZ, |
|
}).Single(); |
|
ysxm.Text = listysvip.YSXM; |
|
ysbm.Text = listysvip.YSBM; |
|
strysbm = listysvip.YSBM; |
|
qz.Text = listysvip.QZ.ToString(); |
|
} |
|
|
|
private void btn_bc_Click(object sender, RoutedEventArgs e) |
|
{ |
|
int intqz; |
|
if (ysxm == null || ysxm.Text == string.Empty) |
|
{ |
|
MessageBox.Show("请填写医生姓名"); |
|
return; |
|
} |
|
if (ysbm == null || ysbm.Text == string.Empty) |
|
{ |
|
MessageBox.Show("请填写医生编码"); |
|
return; |
|
} |
|
try |
|
{ |
|
intqz = Convert.ToInt32(qz.Text); |
|
} |
|
catch (Exception) |
|
{ |
|
MessageBox.Show("请输入正确的权重格式"); |
|
return; |
|
} |
|
if (ysbm.Text != strysbm) |
|
{ |
|
var listysvip = (from tbysvip in myModel.SYS_YSVIPB |
|
where tbysvip.YSBM == ysbm.Text |
|
select new |
|
{ |
|
tbysvip |
|
|
|
}).ToList(); |
|
if (listysvip.Count > 0) |
|
{ |
|
MessageBox.Show("医生编码不能重复"); |
|
return; |
|
} |
|
} |
|
|
|
SYS_YSVIPB ysvipqz = new SYS_YSVIPB(); |
|
ysvipqz.ID = id; |
|
ysvipqz.YSXM = ysxm.Text; |
|
ysvipqz.YSBM = ysbm.Text; |
|
ysvipqz.QZ = intqz; |
|
try |
|
{ |
|
myModel.Entry(ysvipqz).State = System.Data.Entity.EntityState.Modified; |
|
myModel.SaveChanges(); |
|
MessageBox.Show("修改成功"); |
|
this.Close(); |
|
} |
|
catch (Exception) |
|
{ |
|
MessageBox.Show("修改失败"); |
|
} |
|
|
|
} |
|
} |
|
}
|
|
|