Beispiel #1
0
        private void Supervisor_Button_Click(object sender, RoutedEventArgs e)
        {
            Supervisor_Window supervisor_window = new Supervisor_Window(sqlconnection, true);

            supervisor_window.Show();
            this.Close();
        }
Beispiel #2
0
        private void Login_Button_Click(object sender, RoutedEventArgs e)
        {
            if (Login_TextBox.Text == "")
            {
                MessageBox.Show("Введите логин");
                return;
            }
            if (Password_TextBox.Password == "")
            {
                MessageBox.Show("Введите пароль");
                return;
            }
            string connection = String.Format("Persist Security Info=False;Data Source=.\\SQLEXPRESS;Initial Catalog=\"Gym Staff DataBase\";User ID={0};Password={1}", Login_TextBox.Text, Password_TextBox.Password);
            //string connection = String.Format("Data Source=.\\SQLEXPRESS;Initial Catalog=\"Gym Staff DataBase\";Integrated Security=True;User ID={0};Password={1}", Login_TextBox.Text, Password_TextBox.Password);
            SqlConnection sqlconnection = new SqlConnection(connection);

            try
            {
                sqlconnection.Open();
            }
            catch
            {
                MessageBox.Show("Неверный логин или пароль");
                return;
            }

            DataTable Table_Role_Check = new DataTable();

            SqlCommand     sqlcommmand = new SqlCommand(String.Format("SELECT * FROM Role_Check('{0}','{1}')", "Manager", Login_TextBox.Text), sqlconnection);
            SqlDataAdapter adapter     = new SqlDataAdapter(sqlcommmand);

            adapter.Fill(Table_Role_Check);
            if (Convert.ToInt32(Table_Role_Check.Rows[0][0].ToString()) == 1)
            {
                Manager_Window manager_window = new Manager_Window(sqlconnection, false);
                manager_window.Show();
            }
            Table_Role_Check.Clear();
            sqlcommmand = new SqlCommand(String.Format("SELECT * FROM Role_Check('{0}','{1}')", "Supervisor", Login_TextBox.Text), sqlconnection);
            adapter     = new SqlDataAdapter(sqlcommmand);
            adapter.Fill(Table_Role_Check);
            if (Convert.ToInt32(Table_Role_Check.Rows[0][0].ToString()) == 1)
            {
                Supervisor_Window supervisor_window = new Supervisor_Window(sqlconnection, false);
                supervisor_window.Show();
            }
            Table_Role_Check.Clear();
            sqlcommmand = new SqlCommand(String.Format("SELECT * FROM Role_Check('{0}','{1}')", "Administrator", Login_TextBox.Text), sqlconnection);
            adapter     = new SqlDataAdapter(sqlcommmand);
            adapter.Fill(Table_Role_Check);
            if (Convert.ToInt32(Table_Role_Check.Rows[0][0].ToString()) == 1)
            {
                Administrator_Window administrator_window = new Administrator_Window(sqlconnection);
                administrator_window.Show();
            }
            Table_Role_Check.Clear();
            this.Close();
        }
Beispiel #3
0
 private void Output_Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (control_mode == "Менеджер")
     {
         Manager_Window manager_window = new Manager_Window(sqlconnection, administrator_mode);
         manager_window.Show();
     }
     if (control_mode == "Супервайзер")
     {
         Supervisor_Window supervisor_window = new Supervisor_Window(sqlconnection, administrator_mode);
         supervisor_window.Show();
     }
     if (control_mode == "Администратор")
     {
         Administrator_Window administrator_window = new Administrator_Window(sqlconnection);
         administrator_window.Show();
     }
 }
        private void Additing_Post_Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            Supervisor_Window supervisor_window = new Supervisor_Window(sqlconnection, administrator_mode);

            supervisor_window.Show();
        }