示例#1
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))
                {
                    //var foodDB = new FoodDBTestWindow();
                    //foodDB.Closed += Window_Closed;
                    //foodDB.Show();
                    key   = true;
                    admin = ((bool)reader["privilege"]);
                    break;
                }
            }
            conn.Close();
            if (key)
            {
                if (admin)
                {
                    this.NavigationService.Navigate(new ManagerOptions_Page());
                }
                else
                {
                    this.NavigationService.Navigate(new FoodDBWindow_Page());
                }
            }
        }
示例#2
0
        public OrderPage_Page()
        {
            InitializeComponent();
            List <Food>  categories = new List <Food>();
            dbConnection conn       = new dbConnection();

            itemCart.ItemsSource = items;

            categories.Add(new Food()
            {
                SubCtgr = Sub_Category.Drink
            });
            categories.Add(new Food()
            {
                SubCtgr = Sub_Category.Appetizer
            });
            categories.Add(new Food()
            {
                SubCtgr = Sub_Category.Main
            });
            categories.Add(new Food()
            {
                SubCtgr = Sub_Category.Dessert
            });

            SQLiteDataReader reader = conn.ViewTable("Food");

            while (reader.Read())
            {
                foods.Add(new Food()
                {
                    Name        = ((string)reader["name"]),
                    Price       = ((double)reader["price"]),
                    Description = ((string)reader["desc"]),
                    Img         = ((string)reader["img"]),
                    SubCtgr     = categories[int.Parse(reader["subctgr"].ToString())].SubCtgr
                });
            }

            this.totalTBox.Text    = total.ToString();
            this.taxTBox.Text      = string.Format("{0:F2}", total * tax);
            this.subtotalTBox.Text = string.Format("{0:F2}", (total + Double.Parse(taxTBox.Text)));

            foreach (Food f in foods)
            {
                ChangeMenu(f);
            }

            conn.Close();
        }
示例#3
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();
        }
示例#4
0
 private void Window_Closed(object sender, EventArgs e)
 {
     this.Close();
     conn.Close();
 }