コード例 #1
0
ファイル: LogIn.cs プロジェクト: bmsmith/NSA-Sandwich
        //called when user tries to log in
        private void button1_Click(object sender, EventArgs e)
        {
            accountNumber = accountNumberBox.Text.ToString();
            if (String.IsNullOrEmpty(accountNumber))
            {
                errorLabel.Text = "Enter your account number!";
            }

            int recordCount = 0;         //the number of accounts found

            List <string>[] loyaltyData; //the loyalty account data to be found

            //connect to DB if it is not connected
            if (!db.Connected())
            {
                db.OpenConnection();
            }

            //Get the loyalty account data from the database and save amount found in record count
            recordCount = db.getLoyaltyAccountInfo(out loyaltyData, accountNumber);

            if (recordCount <= 0) //if 0 or less are found, loyalty account was not found or function failed
            {
                errorLabel.Text = "Loyalty account not found!";
            }

            else
            {
                NSAKidsMeal mainForm = new NSAKidsMeal(ci, loyaltyData);
                mainForm.FormClosed += new FormClosedEventHandler(LogIn_FormClosed);
                mainForm.Show();
                Hide();
            }
        }
コード例 #2
0
ファイル: LogInOrGuest.cs プロジェクト: bmsmith/NSA-Sandwich
        //called when user clicks to order as a guest
        private void guestButton_Click(object sender, EventArgs e)
        {
            // KioskWindow mainForm = new KioskWindow(ci);
            NSAKidsMeal mainForm = new NSAKidsMeal(ci);

            mainForm.FormClosed += new FormClosedEventHandler(LoginorGuest_FormClosed);
            mainForm.Show();
            Hide(); //hides form until needed again
        }
コード例 #3
0
ファイル: createLoyalty.cs プロジェクト: bmsmith/NSA-Sandwich
        //called when user tries to create an account
        private void createLoyaltyBut_Click(object sender, EventArgs e)
        {
            //get text box text
            name  = nameTextBox.Text.ToString();
            email = emailTextBox.Text;
            if (String.IsNullOrEmpty(name))
            {
                errorLabel.Text = "Enter your name!";
            }

            else if (String.IsNullOrEmpty(email))
            {
                errorLabel.Text = "Enter your email!";
            }

            else
            {
                if (!db.Connected())
                {
                    db.OpenConnection();
                }

                //create the loyalty account and save the account number
                string accountNumber = db.createLoyaltyAccount(name, email);

                if (accountNumber != "FAIL")
                {
                    List <string>[] accountInfo = new List <string> [4];
                    accountInfo[0] = new List <string>();
                    accountInfo[1] = new List <string>();
                    accountInfo[2] = new List <string>();
                    accountInfo[3] = new List <string>();

                    accountInfo[0].Add(name);
                    accountInfo[1].Add(email);
                    accountInfo[2].Add("0");
                    accountInfo[3].Add(accountNumber);
                    NSAKidsMeal form = new NSAKidsMeal(ci, accountInfo); //send info to KioskWindow
                    form.Show();
                    form.FormClosed += new FormClosedEventHandler(CreateLoyalty_FormClosed);
                    Hide();
                }

                else
                {
                    errorLabel.Text = "SYSTEM IS DOWN";
                }
            }
        }