public Checkemil(string emil) { InitializeComponent(); Database1Entities c = new Database1Entities(); var q = from t in c.User where emil == t.email select t; foreach (var v in q) { v.userpwd = MD5Encrypt("123"); tb1.Text = "已经发送一封验证邮件到您的邮箱" + emil + "中,请注意查收"; } c.SaveChanges(); timer.Tick += Timer_Tick; timer.Interval = TimeSpan.FromSeconds(4); timer.Start(); }
public Userlogin(string a) { InitializeComponent(); lb2.Content = a; using (Database1Entities c = new Database1Entities()) { var q = from t1 in c.User where a == t1.userid select new { t1.balance }; foreach (var v in q) { lb1.Content = "尊敬的" + a + ",欢迎您,您的账户余额还有:" + v.balance + "个月"; } } }
private void Button_Click_2(object sender, RoutedEventArgs e) //充值 { using (Database1Entities c = new Database1Entities()) { var q = from t2 in c.User where lb2.Content == t2.userid select t2; foreach (var v in q) { int time; int.TryParse(cb1.Text, out time); v.balance += time; } c.SaveChanges(); Czpicture czpicture = new Czpicture(); czpicture.ShowDialog(); foreach (var v in q) { lb1.Content = "尊敬的" + lb2.Content + ",欢迎您,您的账户余额还有:" + v.balance + "个月"; } } }
private void Button_Click(object sender, RoutedEventArgs e) { Database1Entities c = new Database1Entities(); var q = from t in c.User where tb1.Text == t.userid select t; foreach (var v in q) { string a = MD5Encrypt(pb1.Password); string newa = MD5Encrypt(pb2.Password); if (v.userpwd == a) { v.userpwd = newa; MessageBox.Show("修改成功"); } else { MessageBox.Show("旧密码错误"); } } c.SaveChanges(); }
private void Button_Click_1(object sender, RoutedEventArgs e) //登录 { if (rb1.IsChecked == true) { using (Database1Entities context = new Database1Entities()) { var q = from t in context.User where tb1.Text == t.userid select new { t.userpwd }; foreach (var v in q) { string user = MD5Encrypt(pb1.Password); if (user == v.userpwd) { this.Hide(); user = tb1.Text; Userlogin userlogin = new Userlogin(user); userlogin.ShowDialog(); return; } } pb1.Clear(); MessageBox.Show("用户名或密码错误"); } } else if (rb2.IsChecked == true) { using (Database1Entities context = new Database1Entities()) { var q = from t in context.Manager where tb1.Text == t.managerid select new { t.managerpwd }; foreach (var v in q) { string user = MD5Encrypt(pb1.Password); if (user == v.managerpwd) { this.Hide(); user = tb1.Text; Managerlogin managerlogin = new Managerlogin(user); managerlogin.ShowDialog(); this.Show(); return; } } pb1.Clear(); MessageBox.Show("管理员用户名或密码错误"); } } else { MessageBox.Show("请先选择登陆身份"); } }