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.
95 lines
2.9 KiB
95 lines
2.9 KiB
using SchedulingSystem.EntityClass; |
|
using SchedulingSystemClient.EntityClass; |
|
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 SchedulingSystemClient.UpdateWindow |
|
{ |
|
/// <summary> |
|
/// XGRYWindow.xaml 的交互逻辑 |
|
/// </summary> |
|
public partial class XGRYWindow : Window |
|
{ |
|
public XGRYWindow(Cus_User row) |
|
{ |
|
InitializeComponent(); |
|
ryrow = row; |
|
} |
|
Cus_User ryrow = new Cus_User(); |
|
|
|
SurgerySchedulingEntities myModel = new SurgerySchedulingEntities(); |
|
private void Window_Loaded(object sender, RoutedEventArgs e) |
|
{ |
|
List<ComboBoxBinding> listjs = new List<ComboBoxBinding>(); |
|
listjs = (from tbjs in myModel.SYS_JSB |
|
where tbjs.SFQY == true |
|
select new ComboBoxBinding |
|
{ |
|
ID = tbjs.ID, |
|
Name = tbjs.JSMC, |
|
}).ToList(); |
|
|
|
js.ItemsSource = listjs; |
|
js.SelectedValuePath = "ID"; |
|
js.DisplayMemberPath = "Name"; |
|
js.SelectedValue = ryrow.JSID; |
|
xm.Text = ryrow.Name; |
|
gh.Text = ryrow.GH; |
|
} |
|
|
|
private void btn_bc_Click(object sender, RoutedEventArgs e) |
|
{ |
|
if (xm.Text == null || xm.Text == string.Empty) |
|
{ |
|
MessageBox.Show("请填写姓名"); |
|
return; |
|
} |
|
if (gh.Text == null || gh.Text == string.Empty) |
|
{ |
|
MessageBox.Show("请填写工号"); |
|
return; |
|
} |
|
if (js.SelectedValue == null) |
|
{ |
|
MessageBox.Show("请选择角色"); |
|
return; |
|
} |
|
if (gh.Text!=ryrow.GH) |
|
{ |
|
var listyh = (from tbyh in myModel.SYS_YHB where tbyh.GH == gh.Text select new { tbyh }).ToList(); |
|
if (listyh.Count > 0) |
|
{ |
|
MessageBox.Show("工号不能重复"); |
|
return; |
|
} |
|
} |
|
SYS_YHB yh = new SYS_YHB(); |
|
yh.ID = ryrow.ID; |
|
yh.GH = gh.Text; |
|
yh.YHM = xm.Text; |
|
yh.MM = "123"; |
|
yh.JSID = Convert.ToInt32(js.SelectedValue); |
|
try |
|
{ |
|
myModel.Entry(yh).State = System.Data.Entity.EntityState.Modified; |
|
myModel.SaveChanges(); |
|
MessageBox.Show("修改成功"); |
|
this.Close(); |
|
} |
|
catch (Exception) |
|
{ |
|
MessageBox.Show("修改失败"); |
|
} |
|
} |
|
} |
|
}
|
|
|