Example #1
0
 public win_pos(window_userLogin frmLogin)
 {
     InitializeComponent();
     auth = new Authentication("", "");
     lgn  = frmLogin;
     entrySearch.Focus();
     accNumberGen();
 }
Example #2
0
        // Logout Button
        private void logoutButton_Click(object sender, RoutedEventArgs e)
        {
            bool hasProducts = false;

            try
            {
                DataTable table = new DataTable();

                MySqlDataAdapter adapter = conn.adapter();

                string query = "SELECT * FROM datasalesinventory WHERE salesTransNo = '" + orderNo.Text + "' AND salesStatus = 'Pending'";
                conn.query(query);
                adapter.SelectCommand = conn.cmd();

                adapter.Fill(table);

                if (table.Rows.Count > 0) // Found
                {
                    hasProducts = true;
                }
                else
                { // No Users Found
                    hasProducts = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Logout Failed, " + ex.Message, "Logout", MessageBoxButton.OK, MessageBoxImage.Warning);
            }

            if (hasProducts)
            {
                MessageBox.Show("Unable to proceed, please clear your transaction", "Logout", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            else
            {
                var ans = MessageBox.Show("Are you sure you want to logout?", "Logout", MessageBoxButton.YesNo, MessageBoxImage.Question);
                if (ans == MessageBoxResult.Yes)
                {
                    MessageBox.Show("Logout Success!", "Logout", MessageBoxButton.OK, MessageBoxImage.Information);
                    window_userLogin userLogin = new window_userLogin();
                    userLogin.Show(); // Show Login After Logout
                    this.Close();     // Close this window
                    //auth.addTimeInOut(DateTime.Parse(timeIn.Text) , accNo.Text);
                }
            }
        }