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.
86 lines
2.6 KiB
86 lines
2.6 KiB
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> |
|
/// XGMMWindow.xaml 的交互逻辑 |
|
/// </summary> |
|
public partial class XGMMWindow : Window |
|
{ |
|
public XGMMWindow() |
|
{ |
|
InitializeComponent(); |
|
} |
|
SurgerySchedulingEntities myModel = new SurgerySchedulingEntities(); |
|
private void Button_Click(object sender, RoutedEventArgs e) |
|
{ |
|
if (gh.Text==string.Empty) |
|
{ |
|
MessageBox.Show("请输入工号"); |
|
return; |
|
} |
|
if (jmm.Password == string.Empty) |
|
{ |
|
MessageBox.Show("请输入旧密码"); |
|
return; |
|
} |
|
if (xmm.Password == string.Empty) |
|
{ |
|
MessageBox.Show("请输入新密码"); |
|
return; |
|
} |
|
if (xmm.Password != qrmm.Password) |
|
{ |
|
MessageBox.Show("输入两次密码不一致"); |
|
return; |
|
} |
|
var yh = (from tbyh in myModel.SYS_YHB |
|
where tbyh.GH == gh.Text && tbyh.MM == jmm.Password |
|
select new Cus_User |
|
{ |
|
ID = tbyh.ID, |
|
GH = tbyh.GH, |
|
Name = tbyh.YHM, |
|
JSID = tbyh.JSID, |
|
Password = tbyh.MM, |
|
}).ToList(); |
|
if (yh.Count>0) |
|
{ |
|
SYS_YHB user = new SYS_YHB(); |
|
user.ID = yh[0].ID; |
|
user.GH = yh[0].GH; |
|
user.YHM = yh[0].Name; |
|
user.JSID = yh[0].JSID; |
|
user.MM =xmm.Password; |
|
try |
|
{ |
|
myModel.Entry(user).State = System.Data.Entity.EntityState.Modified; |
|
myModel.SaveChanges(); |
|
MessageBox.Show("修改成功"); |
|
this.Close(); |
|
} |
|
catch (Exception ex) |
|
{ |
|
MessageBox.Show("修改失败"+ex.ToString()); |
|
} |
|
} |
|
else |
|
{ |
|
MessageBox.Show("账号或密码错误"); |
|
return; |
|
} |
|
} |
|
} |
|
}
|
|
|