Exemple #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string userLogin    = loginField.Text;
            string userPassword = passwordField.Password.ToString();

            string myConnectionString = @"Data Source=(local)\SQLEXPRESS; Initial Catalog=StockRoom; Integrated Security=True";
            string mySelectQuery      = "SELECT * FROM Users WHERE [UserLogin] = '" + userLogin + "'and [UserPassword]='" + userPassword + "' and [AdministratorState] = 'true'";

            using (SqlDataAdapter dataAdapter = new SqlDataAdapter(mySelectQuery, myConnectionString)) // проверка введенных данных
            {
                DataTable table = new DataTable();
                dataAdapter.Fill(table);
                if (table.Rows.Count > 0)
                {
                    FileStream   fs        = new FileStream("UserLogin.txt", FileMode.Create);
                    StreamWriter loginFile = new StreamWriter(fs);
                    loginFile.Close();
                    Mainmenu mainmenu = new Mainmenu();
                    mainmenu.Show();
                    this.Close();
                }
                else if (table.Rows.Count == 0)
                {
                    MessageBox.Show("Неверный логин или пароль");
                    return;
                }
            }
        }
Exemple #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Mainmenu mainmenu = new Mainmenu();

            mainmenu.Show();
            this.Close();
        }
Exemple #3
0
        private void BackToMenu(object sender, RoutedEventArgs e)
        {
            Mainmenu mainmenu = new Mainmenu();

            mainmenu.Show();
            this.Close();
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            StreamReader file  = new StreamReader("UserLogin.txt");
            string       login = file.ReadLine();

            file.Close();
            if (login == null)
            {
                Mainmenu mainmenu = new Mainmenu();
                mainmenu.Show();
                this.Close();
            }
            else
            {
                MainMenuUser mainMenuUser = new MainMenuUser();
                mainMenuUser.Show();
                this.Close();
            }
        }
        private void Info_Click(object sender, RoutedEventArgs e)
        {
            StreamReader file  = new StreamReader("UserLogin.txt");
            string       login = file.ReadLine();

            file.Close();
            if (login == null)
            {
                Mainmenu mainmenu = new Mainmenu();
                mainmenu.Show();
                this.Close();
                System.Windows.Forms.HelpNavigator navigator = System.Windows.Forms.HelpNavigator.Topic;
                System.Windows.Forms.Help.ShowHelp(null, "help.chm", navigator, "vyvod_informatsii_ob_avtozapchastyakh_2.htm");
            }
            else
            {
                MainMenuUser mainMenuUser = new MainMenuUser();
                mainMenuUser.Show();
                this.Close();
                System.Windows.Forms.HelpNavigator navigator = System.Windows.Forms.HelpNavigator.Topic;
                System.Windows.Forms.Help.ShowHelp(null, "help.chm", navigator, "vyvod_informatsii_ob_avtozapchastyakh_1.htm");
            }
        }