Advertisement
Guest User

Untitled

a guest
Nov 6th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.91 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using System.Data.SqlClient;
  11.  
  12. namespace kursach
  13. {
  14.     public partial class log_in_userF : Form
  15.     {
  16.         Form mainFForm;
  17.         public log_in_userF(mainF form)
  18.         {
  19.             InitializeComponent();
  20.             mainFForm = form;
  21.             textPassword.UseSystemPasswordChar = true;
  22.             this.ControlBox = false;
  23.         }
  24.  
  25.         public bool BoolProperty { get; set; }
  26.  
  27.         private void come_inB_Click(object sender, EventArgs e)
  28.         {
  29.             con.Open();
  30.             string query = "Select * from Arendator Where Login = '" + textLogin.Text.Trim() + "' and Password = '" + textPassword.Text.Trim() + "'";
  31.             SqlDataAdapter sda = new SqlDataAdapter(query, con);
  32.             DataTable dtl = new DataTable();
  33.             sda.Fill(dtl);
  34.             if (textLogin.Text == "" || textPassword.Text == "")
  35.             {
  36.                 MessageBox.Show("Не все поля заполнены");
  37.             }
  38.             else if (dtl.Rows.Count == 1)
  39.             {
  40.                 GlobalVars.Login_user = textLogin.Text.Trim();
  41.                 mainFForm.Show();
  42.                 textLogin.Clear();
  43.                 textPassword.Clear();
  44.                 BoolProperty = true;
  45.                 this.Close();
  46.             }
  47.             else
  48.             {
  49.                 MessageBox.Show("Логин или пароль введены неправильно");
  50.             }
  51.             con.Close();
  52.         }
  53.  
  54.         private void backB_Click(object sender, EventArgs e)
  55.         {
  56.             mainFForm.Show();
  57.             BoolProperty = false;
  58.             this.Close();
  59.             textLogin.Clear();
  60.             textPassword.Clear();
  61.         }
  62.     }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement