Exemple #1
0
        async void enter()
        {
            database_connection dc = new database_connection();
            DataSet             ds;

            string query;

            try
            {
                query = $@"select Id,Pass from AdminLogin where Id='" + TextBox_IdNo.Text + "'and Pass='******'";

                Loading_User.Visibility = Visibility.Visible;
                ds = await dc.Connection1Async(query);

                Loading_User.Visibility = Visibility.Hidden;

                int count;
                count = ds.Tables[0].Rows.Count;
                if (count > 0)
                {
                    MainWindow mw = new MainWindow();

                    success s = new success();

                    this.Visibility = Visibility.Hidden;

                    AdminContent   ac = new AdminContent();
                    admin_drawhost ad = new admin_drawhost();

                    foreach (Window window in Application.Current.Windows)
                    {
                        if (window.GetType() == typeof(MainWindow))
                        {
                            (window as MainWindow).Rectangle_MainContent.Visibility = Visibility.Hidden;
                            (window as MainWindow).Rectangle_MainWindow.Visibility  = Visibility.Hidden;
                            (window as MainWindow).Drawer_HostContent.Content       = ad;
                            (window as MainWindow).UserContent.Content = ac;
                        }
                    }
                }
                else
                {
                    Loading_UserInform.Visibility = Visibility.Visible;
                    Icon2.Kind = MahApps.Metro.IconPacks.PackIconMaterialKind.MessageAlert;
                    TextBlock_Message2.Text = "The ID No. and Password you've \n entered doesn't match".ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #2
0
        private void Button_ItemDetails_Click(object sender, RoutedEventArgs e)
        {
            AdminContent adc = new AdminContent();

            foreach (Window window in Application.Current.Windows)
            {
                if (window.GetType() == typeof(MainWindow))
                {
                    (window as MainWindow).UserContent.Content          = adc;
                    (window as MainWindow).DrawerHost1.IsLeftDrawerOpen = false;
                }
            }
        }