コード例 #1
0
        private void Edit_Menu_Click(object sender, RoutedEventArgs e)
        {
            Button b      = sender as Button;
            var    foodDB = new FoodDBTestWindow();

            foodDB.Closed += Window_Closed;
            foodDB.Show();
            this.Hide();
        }
コード例 #2
0
        private void Enter_Click(object sender, RoutedEventArgs e)
        {
            dbConnection     conn   = new dbConnection();
            Button           b      = sender as Button;
            SQLiteDataReader reader = conn.ViewTable("Employee");
            bool             key    = false;
            bool             admin  = false;

            while (reader.Read())
            {
                ADMINID   = reader["ID"].ToString();
                ADMINNAME = ((string)reader["name"]);
                if (EmployeeID.Password.Equals(ADMINID) && EmployeeName.Text.Equals(ADMINNAME))
                {
                    key   = true;
                    admin = ((bool)reader["privilege"]);
                    break;
                }
            }
            conn.Close();
            if (key)
            {
                if (admin)
                {
                    var manOption = new ManagerOptions();
                    manOption.Closed += Window_Closed;
                    manOption.Show();
                    this.Hide();
                }
                else
                {
                    var foodDB = new FoodDBTestWindow();
                    foodDB.Closed += Window_Closed;
                    foodDB.Show();
                    this.Hide();
                }
            }
            else
            {
                MessageBox.Show("Invalid ID or Name. Try again.");
            }
            ClearFields();
        }