Beispiel #1
0
        private void btnTake_Click(object sender, EventArgs e)
        {
            string s   = txtAccNum.Text; //
            Login  frm = new Login(s);   //

            frm.chuan += frm_chuan;
            frm.Show();

            //if (Login.flag == "True")
            //{

            //    MessageBox.Show("Test");
            //    print();
            //
            //    Login.flag = "False";
            //}
            //else
            //{
            //    MessageBox.Show("Test");
            //}
        }
        private void выходИзСистемыToolStripMenuItem_Click(object sender, EventArgs e)
        {
            List <Form> openForms = new List <Form>();

            foreach (Form f in Application.OpenForms)
            {
                openForms.Add(f);
            }

            foreach (Form f in openForms)
            {
                if (!(String.Equals(f.Name, "Login") || String.Equals(f.Name, "Menu")))
                {
                    f.Close();
                }
            }

            Login tmp = new Login();

            tmp.Show();
            this.Hide();
        }
Beispiel #3
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            int count = 1;

            foreach (Form form in Application.OpenForms)
            {
                Console.Write(count);
                count++;
                Console.WriteLine(form.GetType().ToString() + ", ");
            }

            int index = 0;

            string[] transactions = System.IO.File.ReadAllLines(@"C:\app\transactions.txt");
            bool     usedCheck    = false;

            foreach (string transaction in transactions)
            {
                if (transaction.ToLower() == txtTransaction.Text.ToLower())
                {
                    foreach (DataGridViewRow row in listTransactions.Rows)
                    {
                        string usedTransaction = Convert.ToString(row.Cells[1].Value);
                        if (transaction == usedTransaction)
                        {
                            usedCheck = true;
                        }
                    }
                    if (usedCheck == false)
                    {
                        transactionNumber++;
                        listTransactions.Rows.Add(transactionNumber, transaction, transactions[index + 1]);
                        balance        += Convert.ToInt32(transactions[index + 1]);
                        lblBalance.Text = Convert.ToString(balance);
                        string file = @"C:\app\audio1.wav";
                        if (File.Exists(file))
                        {
                            PlaySound(file);
                        }
                    }
                }
                index++;
            }
            if (lblBalance.Text == "1000000")
            {
                Congratulations CongratulationsForm = new Congratulations();
                CongratulationsForm.Show();

                string file = @"C:\app\audio2.wav";
                if (File.Exists(file))
                {
                    PlaySound(file);
                }
            }
            lblBalance.Text = string.Format("£{0:#.00}", Convert.ToDecimal(balance));

            if (txtTransaction.Text == "resetmenow!")
            {
                if (CheckFormOpen("login"))
                {
                    Form login = Application.OpenForms["login"];
                    login.Show();
                    Cleanup();
                    this.Hide();
                }
                else
                {
                    Login login = new Login();
                    login.Show();
                }
            }
            txtTransaction.Text = "";
        }