public StatisticalViewModel()
 {
     WindowLoadedCommand = new RelayCommand <Window>(
         x =>
     {
         if (x == null)
         {
             return(false);
         }
         return(true);
     },
         x =>
     {
         StatisticalWindow statisticalWindow = x as StatisticalWindow;
         statisticalWindow.Grid_Parrent.Children.Clear();
         statisticalWindow.Grid_Parrent.Children.Add(new InputUC());
     });
     SelectedItemChanged = new RelayCommand <TreeView>(
         x =>
     {
         if (x == null)
         {
             return(false);
         }
         return(true);
     },
         x =>
     {
         TreeView treeView                   = x as TreeView;
         TreeViewItem treeViewItem           = x.SelectedItem as TreeViewItem;
         StatisticalWindow statisticalWindow = GetParrent(x) as StatisticalWindow;
         statisticalWindow.Grid_Parrent.Children.Clear();
         if (treeViewItem.Header.ToString().Contains("Nhập kho") || treeViewItem.Header.ToString().Contains("Phiếu nhập"))
         {
             statisticalWindow.Grid_Parrent.Children.Add(new InputUC());
         }
         else if (treeViewItem.Header.ToString().Contains("Hàng nhập"))
         {
             statisticalWindow.Grid_Parrent.Children.Add(new InputDetailUC());
         }
         else if (treeViewItem.Header.ToString().Contains("Xuất kho") || treeViewItem.Header.ToString().Contains("Phiếu xuất"))
         {
             //Some code
         }
         else if (treeViewItem.Header.ToString().Contains("Xuất hàng"))
         {
             //Some code
         }
         else if (treeViewItem.Header.ToString().Contains("Tồn kho"))
         {
             //Some code
         }
         else if (treeViewItem.Header.ToString().Contains("Nhà cung cấp"))
         {
             //Some code
         }
         else if (treeViewItem.Header.ToString().Contains("Khách hàng"))
         {
             //Some code
         }
         else
         {
             statisticalWindow.Grid_Parrent.Children.Add(new InputUC());
         }
     });
 }
        public MainViewModel()
        {
            ImportWindow = new RelayCommand <Window>((p) => { return(true); }, (p) =>
            {
                if (_UserIDRole != 1)
                {
                    LoadDialogErrorNotPermission();
                    return;
                }
                ImportWindow wd = new ImportWindow();
                wd.ShowDialog();
            });
            SellWindow     = new RelayCommand <Window>((p) => { return(true); }, (p) => { SellWindow wd = new SellWindow(); wd.ShowDialog(); });
            CustomerWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1)
                                                                                          {
                                                                                              LoadDialogErrorNotPermission(); return;
                                                                                          }
                                                                                          CustomerWindow wd = new CustomerWindow(); wd.ShowDialog(); });
            ProductWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1)
                                                                                         {
                                                                                             LoadDialogErrorNotPermission(); return;
                                                                                         }
                                                                                         ProductWindow wd = new ProductWindow(); wd.ShowDialog(); });
            SupplierWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1)
                                                                                          {
                                                                                              LoadDialogErrorNotPermission(); return;
                                                                                          }
                                                                                          SupplierWindow wd = new SupplierWindow(); wd.ShowDialog(); });
            StatisticalWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1)
                                                                                             {
                                                                                                 LoadDialogErrorNotPermission(); return;
                                                                                             }
                                                                                             StatisticalWindow wd = new StatisticalWindow(); wd.ShowDialog(); });
            UnitWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1)
                                                                                      {
                                                                                          LoadDialogErrorNotPermission(); return;
                                                                                      }
                                                                                      UnitWindow wd = new UnitWindow(); wd.ShowDialog(); });
            UserListWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1)
                                                                                          {
                                                                                              LoadDialogErrorNotPermission(); return;
                                                                                          }
                                                                                          UserListWindow wd = new UserListWindow(); wd.ShowDialog(); });
            AccountCreateWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1)
                                                                                               {
                                                                                                   LoadDialogErrorNotPermission(); return;
                                                                                               }
                                                                                               AccountCreateWindow wd = new AccountCreateWindow(); wd.ShowDialog(); });
            BillWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1)
                                                                                      {
                                                                                          LoadDialogErrorNotPermission(); return;
                                                                                      }
                                                                                      BillWindow wd = new BillWindow(); wd.ShowDialog(); });
            LoadMainWindow = new RelayCommand <Window>((p) => { return(true); }, (p) =>
            {
                if (!isLoaded)
                {
                    isLoaded = true;
                    if (p == null)
                    {
                        return;
                    }

                    p.Hide();
                    LoginWindow wd = new LoginWindow();
                    wd.ShowDialog();
                    var loginViewModel = wd.DataContext as LoginViewModel;
                    if (loginViewModel == null)
                    {
                        return;
                    }
                    if (loginViewModel.isLogin)
                    {
                        loadUserCurrentLogin();
                        p.Show();
                    }
                    else
                    {
                        p.Close();
                    }
                }
            });

            LoadEditCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { LoadDialogAccountEdit(); });
        }