private void TabSelector1_SelectedTabChanged(object sender, EventArgs e) { if (tabSelector1.SelectedTabKey == "btnCashier") { if (cashierView == null) { cashierView = new StoreAssistant_CashierView.CashierView(); } cashierView.LoadTheme(); cashierView.LoadDataFromDB(); SelectTab(cashierView); } else if (tabSelector1.SelectedTabKey == "btnManager") { if (managerModifyView == null) { managerModifyView = new ManagerModifyView(); } managerModifyView.LoadTheme(); managerModifyView.LoadDataFromDB(); SelectTab(managerModifyView); } else if (tabSelector1.SelectedTabKey == "btnHistory") { if (historyView == null) { historyView = new StoreAssistant_HistoryView.HistoryView(); } historyView.LoadTheme(); historyView.GetData(); SelectTab(historyView); } else if (tabSelector1.SelectedTabKey == "btnStatistic") { if (statiticsView == null) { statiticsView = new StoreAssistant_StatiticsView.StatiticsView2(); } statiticsView.LoadTheme(); SelectTab(statiticsView); } else if (tabSelector1.SelectedTabKey == "btnVoucher") { if (voucherView == null) { voucherView = new VoucherView(); } voucherView.LoadTheme(); voucherView.LoadDataFromDB(); SelectTab(voucherView); } else { //something wrong here } }
void CreateView() { cashierView = new StoreAssistant_CashierView.CashierView(); if (Authenticator.CurrentUser.Role == UserInfo.UserRole.Manager) { managerModifyView = new ManagerModifyView(); historyView = new StoreAssistant_HistoryView.HistoryView(); statiticsView = new StoreAssistant_StatiticsView.StatiticsView2(); voucherView = new VoucherView(); } }
private void KryptonNavigator1_SelectedPageChanged(object sender, EventArgs e) { if (kryptonNavigator1.SelectedPage.Name == krPage_Cashier.Name) { if (cashierView == null) { cashierView = new StoreAssistant_CashierView.CashierView(); } cashierView.LoadDataFromDB(); SelectTab(cashierView); } else if (kryptonNavigator1.SelectedPage.Name == krPage_Account.Name) { if (accountView == null) { accountView = new StoreAssistant_AccountView.AccountView(); accountView.ClickSignOut += AccountView1_ClickSignOut; } accountView.SetData(); SelectTab(accountView); } else if (kryptonNavigator1.SelectedPage.Name == krPage_Manager.Name) { if (managerModifyView == null) { managerModifyView = new ManagerModifyView(); } managerModifyView.LoadDataFromDB(); SelectTab(managerModifyView); } else if (kryptonNavigator1.SelectedPage.Name == krPage_History.Name) { if (historyView == null) { historyView = new StoreAssistant_HistoryView.HistoryView(); } historyView.GetData(); SelectTab(historyView); } else if (kryptonNavigator1.SelectedPage.Name == krPage_Setting.Name) { MessageBox.Show("Tính năng đang phát triển", "Công trình đang thi công", MessageBoxButtons.OK, MessageBoxIcon.Information); panel1.Controls.Clear(); } else if (kryptonNavigator1.SelectedPage.Name == krPage_Statistic.Name) { if (statiticsView == null) { statiticsView = new StoreAssistant_StatiticsView.StatiticsView2(); } SelectTab(statiticsView); } else if (kryptonNavigator1.SelectedPage.Name == krPage_Voucher.Name) { //something wrong here if (voucherView == null) { voucherView = new VoucherView(); } voucherView.LoadDataFromDB(); SelectTab(voucherView); } else { } }