internal void EnableForm() { BrushConverter brush = new BrushConverter(); this.BorderBrush = (Brush)brush.ConvertFrom("#518f64"); TextBlock_AddItemHeader.Opacity = 1; Rectangle1.Opacity = 1; Rectangle2.Opacity = 1; Rectangle3.Opacity = 1; TextBlock_FoodHeader.Opacity = 1; TextBlock_BeverageHeader.Opacity = 1; EnableAllCategoryButton(true); TextBlock_ItemListHeader.Text = "SELECT A CATEGORY"; TextBlock_ItemListHeader.Opacity = 1; TableAddItem.ResetTable(); TableAddItem.IsHitTestVisible = true; TableAddItem.Opacity = 1; TextBlock_ItemName.Text = "SELECT AN ITEM"; TextBlock_ItemName.Opacity = 1; Button_DecreaseQty.IsEnabled = false; Button_IncreaseQty.IsEnabled = false; TextBlock_ItemQuantity.Text = "0"; TextBlock_ItemQuantity.Opacity = 1; Button_AddItem.IsEnabled = false; }
// // VINCENT - START // // IMPORTANT! NEED TO DOWNLOAD: "Microsoft Access Database Engine 2010" // GOOGLE IT AND DOWNLOAD THE x86 or x64 depending on YOUR system // // private void ButtonCategory_Click(Object sender, RoutedEventArgs e) { EnableAllCategoryButton(true); //disable this button Button btn = (Button)sender; btn.IsEnabled = false; OleDbConnection cn = new OleDbConnection(); OleDbCommand cmd = new OleDbCommand(); OleDbDataReader dr; //open connection String path = Assembly.GetExecutingAssembly().Location; path = path.Replace("bin\\Debug\\ICTProjectPOS.exe", "RestaurantDB.accdb"); String connectionString = String.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0}", path); cn.ConnectionString = @connectionString; cmd.Connection = cn; TableAddItem.ResetTable(); try { cmd = GenerateQueryFromSender(sender, cmd); cn.Open(); dr = cmd.ExecuteReader(); //add data to table if (dr.HasRows) { int i = 1; while (dr.Read()) { //dr[0] = Item.ItemID dr[1] = Item.ItemName, dr[2] = Item.Price string commaSeparatedString = String.Format("{0},{1},{2}", i, dr[1].ToString(), dr[2].ToString()).ToUpper(); TableAddItem.SetTableRowText(i, commaSeparatedString); i++; } TableAddItem.UpdateUIElement(); } //close connection dr.Close(); cn.Close(); } catch { cn.Close(); System.Diagnostics.Debug.WriteLine("!!!ERROR IN RETREIVING DATA!!!"); } }