Пример #1
0
        private void mButton_Click(object sender, RoutedEventArgs e)
        {
            Eater     match = eaters[comboBox.SelectedIndex];
            CookerHub ch    = new CookerHub(c, mw, match);

            mw.Content = ch;
        }
Пример #2
0
        public CookerHub(Cook cookAccount, MainWindow mw_in, Eater m)
        {
            InitializeComponent();
            c     = cookAccount;
            mw    = mw_in;
            match = m;


            //simulate eater accepting
            MessageBox.Show("The User has accepted your match request.\nYOu are now matched with " + match + ".");
            //show who is matched
            label2.Content += match.Name;


            //if hygiene test expires at a date later than current date PVG is true
            if (DateTime.Compare(c.H_Date, DateTime.Now.Date) >= 0)
            {
                c.HygieneCert = "OK";
            }
            else
            {
                c.HygieneCert = "EXPIRED";
            }


            //Print current approval status and activate or deactivate button to find a match
            if (c.HygieneCert == "OK" && c.Pvg == "OK")
            {
                c.CookApproved        = true;
                statusLabel.Content  += "APPROVED";
                matchButton.IsEnabled = true;
            }
            else
            {
                c.CookApproved        = false;
                statusLabel.Content  += "NOT APPROVED";
                matchButton.IsEnabled = false;
            }

            if (c.HygieneCert == "OK")
            {
                statusLabel.Content += "\nHygiene Certified: Yes\nExpires on: " + c.H_Date.ToString("yyyy-MM-dd");
            }
            else
            {
                statusLabel.Content += "\nHygiene Certified: No";
            }

            if (c.Pvg == "OK")
            {
                statusLabel.Content += "\nPVG OK";
            }
            else if (c.Pvg == "AWAITING RESULT")
            {
                statusLabel.Content += "\nPVG AWAITING APPROVAL";
            }
            else
            {
                statusLabel.Content += "\nPVG REJECTED";
            }
        }