Ejemplo n.º 1
0
        //Loads the top 3 entrees to the form.
        private void Load_Top_Entrees()
        {
            NSADatabase db = new NSADatabase();

            db.OpenConnection();

            string[] Top3 = db.getTop3Entrees();

            for (int counter = 0; counter < Top3.Count(); counter++)
            {
                switch (counter)
                {
                case 0:
                    this.lblSandwich1.Visible = true;
                    this.lblSandwich1.Text    = Top3[counter];
                    break;

                case 1:
                    this.lblSandwich2.Visible = true;
                    this.lblSandwich2.Text    = Top3[counter];
                    break;

                case 2:
                    this.lblSandwich3.Visible = true;
                    this.lblSandwich3.Text    = Top3[counter];
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        //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();
            }
        }
Ejemplo n.º 3
0
        //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";
                }
            }
        }
Ejemplo n.º 4
0
        //constructor called when logging in as guest
        public KioskWindow(CultureInfo language)
        {
            ci = language;                           //set the language
            a  = Assembly.Load("CustomerInterface"); //load the assembly and resourcemanager
            rm = new ResourceManager("CustomerInterface.Lang.lang", a);

            InitializeComponent();
            db = new NSADatabase();
            db.OpenConnection();
            componentsList = db.getComponents();
            menu           = db.getMenu();

            updateMenu();
            currentOrder = new NSAOrder();
            setLang(ci);
        }
Ejemplo n.º 5
0
        //constructor called when logging in with a loyalty account
        public KioskWindow(CultureInfo language, List <string>[] accountNumber)
        {
            ci = language;                           //set the language
            a  = Assembly.Load("CustomerInterface"); //load the assembly and resourcemanager
            rm = new ResourceManager("CustomerInterface.Lang.lang", a);


            account = new NSALoyaltyAccount(accountNumber[0][0], accountNumber[1][0], accountNumber[2][0], accountNumber[3][0]);


            InitializeComponent();

            db = new NSADatabase();
            db.OpenConnection();
            componentsList = db.getComponents();
            menu           = db.getMenu();

            account.FavoriteItems = db.getFavoriteItems(account.getAccountNumber().ToString());
            foreach (NSAFavoriteItem it in account.FavoriteItems)
            {
                ListViewItem lvi = new ListViewItem(it.Name);
                lvi.Tag = it;
                favItemsListView.Items.Add(lvi);
            }

            account.FavoriteOrders = db.getFavoriteOrders(account.getAccountNumber());

            foreach (NSAOrder order in account.FavoriteOrders)
            {
                ListViewItem lvi = new ListViewItem(order.Id.ToString());
                lvi.Tag = order;
                FavOrdersView.Items.Add(lvi);
            }
            setAccountTab();
            updateMenu();
            currentOrder = new NSAOrder();
            setLang(ci);
        }