示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            foreach (Account a in Database.accountList)
            {
                if (a.checkLogin(textBox1.Text, textBox2.Text) == true)
                {
                    if (a.Privilege == "cashier")
                    {
                        logCheck = a.Username;
                        this.Hide();
                        FormProvider.Ps.Show();
                        return;
                    }
                    else if (a.Privilege == "manager")
                    {
                        logCheck = a.Username;
                        this.Hide();
                        Form form2 = new SystemSelection();
                        form2.Show();
                        return;
                    }
                }
            }

            System.Windows.Forms.MessageBox.Show("Wrong Username/Password");
        }
        private void button3_Click(object sender, EventArgs e)
        {
            //Product
            File.WriteAllText("DatabaseSys/ProductSys.txt", String.Empty);
            TextWriter tw2 = new StreamWriter("DatabaseSys/ProductSys.txt", true);

            foreach (Product p in Database.productList)
            {
                tw2.Write(p.ProductID);
                tw2.Write(' ');
                tw2.Write(p.Name);
                tw2.Write(' ');
                tw2.Write(p.Description);
                tw2.Write(' ');
                tw2.Write(p.Price);
                tw2.Write(' ');
                tw2.Write(p.Stock);
                tw2.WriteLine();
            }

            tw2.Close();

            this.Hide();
            SystemSelection sse = new SystemSelection();

            sse.Show();
        }
示例#3
0
        private void button3_Click(object sender, EventArgs e)
        {
            //Account
            File.WriteAllText("DatabaseSys/AccountSys.txt", String.Empty);
            TextWriter tw2 = new StreamWriter("DatabaseSys/AccountSys.txt", true);

            foreach (Account a in Database.accountList)
            {
                tw2.Write(a.Username);
                tw2.Write(' ');
                tw2.Write(a.Password);
                tw2.Write(' ');
                tw2.Write(a.Privilege);
                tw2.WriteLine();
            }

            tw2.Close();

            this.Hide();
            Form form2 = new SystemSelection();

            form2.Show();
        }