Advertisement
Guest User

Form 4 - Авторизация

a guest
Dec 11th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Data.Linq;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11.  
  12. namespace laba8
  13. {
  14. public partial class Form4 : Form
  15. {
  16. Table<User> users;
  17. Table<Priv> privs;
  18. Table<UserPriv> userPrivs;
  19. DataContext context;
  20.  
  21. public Form4()
  22. {
  23. InitializeComponent();
  24. }
  25.  
  26. private void button1_Click(object sender, EventArgs e)
  27. {
  28. context = appcontext.GetDataContext();
  29. users = context.GetTable<User>();
  30. privs = context.GetTable<Priv>();
  31. userPrivs = context.GetTable<UserPriv>();
  32. var user = users.FirstOrDefault(v => v.UserName == textBox1.Text && v.Password == textBox2.Text);
  33. if (user != null)
  34. {
  35. Program.user = user;
  36. new Form1().Show();
  37. this.Hide();
  38. }
  39. else
  40. {
  41. MessageBox.Show("Неверный логин или пароль");
  42. }
  43.  
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement