private void readerstable_Click(object sender, RoutedEventArgs e)
        {
            TicketSale a = new TicketSale();

            a.Show();
            this.Close();
        }
 private void BtnLogin_Click(object sender, RoutedEventArgs e)
 {
     if ((_q1.Text != "") && (_q2.Password != ""))
     {
         Account account = Account.GetInstance(null, null, null, null, null, _q1.Text, _q2.Password);
         account.NickName = _q1.Text;
         account.Password = _q2.Password;
         using (SqlConnection connection = new SqlConnection(@"Data Source=VIKTOR_BRAUS\SQLEXPRESS01;Initial Catalog=Library;Integrated Security=True"))
         {
             connection.Open();
             SqlCommand    CheckInBase = new SqlCommand("SELECT НікНейм FROM Читачі WHERE НікНейм = 'admin'", connection);
             SqlDataReader reader      = CheckInBase.ExecuteReader();
             if (reader.Read() && (_q1.Text == "admin") && (_q2.Password == "1234"))
             {
                 MessageBox.Show("Admin");
                 TicketSale a1 = new TicketSale();
                 a1.Show();
                 this.Close();
             }
             else
             {
                 reader.Close();
                 SqlDataAdapter sda = new SqlDataAdapter("Select Count (*) From Читачі where НікНейм = '" + _q1.Text + "' and Пароль = '" + _q2.Password + "'", connection);
                 DataTable      dt  = new DataTable();
                 sda.Fill(dt);
                 if (dt.Rows[0][0].ToString() == "1")
                 {
                     Database_Authorization start = new Database_Authorization(account.NickName, account.Password);
                     UserTicket             a     = new UserTicket();
                     a.Show();
                     this.Close();
                 }
                 else
                 {
                     MessageBox.Show("Невірні Дані. Будь Ласка, пробуйте ще.");
                     MessageBox.Show("Invalid Data. please Retry.");
                     _q1.Text     = null;
                     _q2.Password = null;
                 }
             }
             connection.Close();
         }
     }
     else
     {
         MessageBox.Show("There is no data. please, write down your username and password.");
         MessageBox.Show("Дані не введені. Увведіть дані.");
         _q1.Text     = null;
         _q2.Password = null;
     }
 }