Ejemplo n.º 1
0
        private void btnLogIn_Click(object sender, RoutedEventArgs e)
        {
            // check if given password and email match the ones saved in the lists
            for (var i = 0; i < cooksList.Count; i++)
            {
                if (cooksList[i].email == txtBoxEmail.Text && cooksList[i].password == passwordBox.Password.ToString())
                {
                    MainSystemScreen mainScrn = new MainSystemScreen();

                    // pass on the lists
                    mainScrn.cooksList  = cooksList;
                    mainScrn.eatersList = eatersList;

                    // pass loged in cook
                    mainScrn.passedCook = cooksList[i];
                    // mainScrn.passedCook.pvg = newPVG;

                    // initialise main screen elements
                    mainScrn.lblUsrName.Content             = cooksList[i].firstName + " " + cooksList[i].lastName;
                    mainScrn.btnFriendsAndFamily.Visibility = Visibility.Hidden;

                    // open next window
                    mainScrn.Show();
                    this.Close();
                    break;
                }
            }
            for (var i = 0; i < eatersList.Count; i++)
            {
                if (eatersList[i].email == txtBoxEmail.Text && eatersList[i].password == passwordBox.Password.ToString())
                {
                    MainSystemScreen mainScrn = new MainSystemScreen();

                    // pass on the lists
                    mainScrn.cooksList  = cooksList;
                    mainScrn.eatersList = eatersList;

                    // pass logged in eater
                    mainScrn.passedEater = eatersList[i];

                    // initialise main screen elements
                    mainScrn.lblUsrName.Content         = eatersList[i].firstName + " " + eatersList[i].lastName;
                    mainScrn.btnSecurityChks.Visibility = Visibility.Hidden;
                    mainScrn.btnViewEaters.Visibility   = Visibility.Hidden;
                    mainScrn.lblChckStatus.Visibility   = Visibility.Hidden;
                    mainScrn.lblCertStat.Visibility     = Visibility.Hidden;
                    mainScrn.lblPVGStat.Visibility      = Visibility.Hidden;

                    // open next window
                    mainScrn.Show();
                    this.Close();
                    break;
                }
            }
        }
        private void btnNext_Click(object sender, RoutedEventArgs e)
        {
            newFnF.name  = txtbxName.Text;
            newFnF.email = txtbxEmail.Text;
            newFnF.phone = txtbxPhone.Text;

            // add the new friends and family details to the Eater
            passedEater.friendsAndFamily = newFnF;

            // add the eater to the list and pass it on
            if (!eatersList.Contains(passedEater))
            {
                eatersList.Add(passedEater);
            }

            MainSystemScreen mainScrn = new MainSystemScreen();

            mainScrn.cooksList  = cooksList;
            mainScrn.eatersList = eatersList;

            // initialise main screen elements
            mainScrn.lblUsrName.Content         = passedEater.firstName + " " + passedEater.lastName;
            mainScrn.btnSecurityChks.Visibility = Visibility.Hidden;
            mainScrn.btnViewEaters.Visibility   = Visibility.Hidden;

            // if this window was opened by the main system screen
            // and not from the new user sign up then just close this
            // otherwise close this, the window that created it and
            // open a new main screen window
            if (App.Current.Windows[0].Title == "Meal Sharers")
            {
                this.Close();
            }
            else
            {
                mainScrn.passedEater = passedEater;
                mainScrn.Show();
                this.Close();
                App.Current.Windows[0].Close();
            }
        }
        private void btnNext_Click(object sender, RoutedEventArgs e)
        {
            // if this window was opened by the main system screen
            // and not from the new user sign up then just close this
            // otherwise close this, the window that created it and
            // open a new main screen window
            if (App.Current.Windows[0].Title == "Meal Sharers")
            {
                if (lblFileFoodCert.Content.ToString() == "")
                {
                    foodCertStatusStr = "Pending";
                }
                else
                {
                    foodCertStatusStr = "OK!";
                }

                if (string.IsNullOrEmpty(lblFilePVG.Content.ToString()))
                {
                    pvgStatusStr = "Pending";
                }
                else
                {
                    pvgStatusStr = "OK!";
                }

                this.Close();
            }
            else
            {
                MainSystemScreen mainScrn = new MainSystemScreen();

                mainScrn.lblUsrName.Content             = passedCook.firstName + " " + passedCook.lastName;
                mainScrn.btnFriendsAndFamily.Visibility = Visibility.Hidden;

                // pass the current cook
                mainScrn.passedCook = passedCook;

                // pass the current cooks and eaters lists
                mainScrn.cooksList  = cooksList;
                mainScrn.eatersList = eatersList;

                if (lblFileFoodCert.Content.ToString() == "")
                {
                    mainScrn.lblCertStat.Content = "Pending";
                }
                else
                {
                    mainScrn.lblCertStat.Content = "OK!";
                }

                if (string.IsNullOrEmpty(lblFilePVG.Content.ToString()))
                {
                    mainScrn.lblPVGStat.Content = "Pending";
                }
                else
                {
                    mainScrn.lblCertStat.Content = "OK!";
                }

                // add the current cook to the list if it's not already in it
                if (!cooksList.Contains(passedCook))
                {
                    cooksList.Add(passedCook);
                }

                mainScrn.Show();
                this.Close();
                App.Current.Windows[0].Close();
            }
        }