private void BillDone(int flags) { if (flags == 1) { MessageBoxResult result = MessageBox.Show("Thanh toán thành công. Bạn có muốn tiếp tục mua sắm???", "Confirmation", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { CakeShop_dbEntities db = new CakeShop_dbEntities(); Bill bill = new Bill(); bill.Date = DateTime.Now; bill.Payed = false; InitializeComponent(); db.Bills.Add(bill); db.SaveChanges(); GridMain.Children.Clear(); TitleFunction.Text = "Trang chủ"; var screen = new UserControlTypes(); screen.Handler += Categories; GridMain.Children.Add(screen); } else { this.Close(); } } }
private void Window_Loaded(object sender, RoutedEventArgs e) { GridMain.Children.Clear(); TitleFunction.Text = "TCH's Shop"; var screen = new UserControlTypes(); screen.Handler += Categories; GridMain.Children.Add(screen); }
private void ListViewMenu_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { UserControl usc = null; GridMain.Children.Clear(); switch (((ListViewItem)((ListView)sender).SelectedItem).Name) { case "ItemHome": TitleFunction.Text = "TCH's Shop"; var screen = new UserControlTypes(); screen.Handler += Categories; GridMain.Children.Add(screen); break; case "ItemProduct": TitleFunction.Text = "Các sản phẩm"; usc = new UserControlHomeScreen(); GridMain.Children.Add(usc); break; //case "ItemBill": // CakeShop_dbEntities db = new CakeShop_dbEntities(); // TitleFunction.Text = "Thanh toán"; // var data = db.BillDetails.ToList(); // usc = new UserControlCreateCakeBill(GridMain,data); // GridMain.Children.Add(usc); // break; case "ItemStatistical": TitleFunction.Text = "Thống kê"; usc = new UserControlCharts(); GridMain.Children.Add(usc); break; default: break; } }