コード例 #1
0
        public void initializeUser(DataSetEatFast.EATFAST_PERSONRow personRow)
        {
            this.personRow = personRow;
            //On demande d'insérer une adresse de livraison si non connue
            if (personRow.IsPER_ADDRESSNull())
            {
                NewUser newUser = new NewUser(personRow.PER_ID);
                newUser.ShowDialog();
            }

            // TODO: This line of code loads data into the 'dataSetOrders.EATFAST_ORDER' table. You can move, or remove it, as needed.
            this.eATFAST_ORDERTableAdapter.FillByClient(this.dataSetOrders.EATFAST_ORDER, personRow.PER_ID);
        }
コード例 #2
0
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            if (textBoxLoginEmail.Text == "" || textBoxLoginPassword.Text == "")
            {
                MessageBox.Show("The username or password is incorrect", "Information");
            }
            else
            {
                //Accès à la table eatfast_person dans la bdd
                DataSetEatFast personDataSet = new DataSetEatFast();
                DataSetEatFastTableAdapters.EATFAST_PERSONTableAdapter listePerson = new DataSetEatFastTableAdapters.EATFAST_PERSONTableAdapter();
                listePerson.Fill(personDataSet.EATFAST_PERSON);

                try
                {
                    //Récupération de l'utilisateur
                    int id = (int)listePerson.FillByEmail(textBoxLoginEmail.Text);
                    DataSetEatFast.EATFAST_PERSONRow personRow = personDataSet.EATFAST_PERSON.FindByPER_ID(id);

                    if (personRow.PER_PASSWORD.Equals(HashCode(textBoxLoginPassword.Text)))
                    {
                        if (personRow.PER_ACCOUNTTYPE == "Client")
                        { //Si compte client
                            this.Hide();
                            Homepage homePage = Homepage.getInstance();
                            homePage.Show();
                            homePage.initializeUser(personRow);
                        }
                        else
                        { //Si compte administrateur
                            this.Hide();
                            AdminHomepage adminHomepage = AdminHomepage.getInstance();
                            adminHomepage.Show();
                            adminHomepage.initializeUser(personRow);
                        }
                    }
                    else
                    {
                        MessageBox.Show("The username or password is incorrect", "Information");
                    }
                }
                catch (Exception o)
                {
                    MessageBox.Show("The username or password is incorrect", "Information");
                    Console.Write(o);
                }
            }
        }
コード例 #3
0
        public void InitializeNewUser(string email)
        {
            //Accès à la table eatfast_person dans la bdd
            DataSetEatFast personDataSet = new DataSetEatFast();

            DataSetEatFastTableAdapters.EATFAST_PERSONTableAdapter listePerson = new DataSetEatFastTableAdapters.EATFAST_PERSONTableAdapter();
            listePerson.Fill(personDataSet.EATFAST_PERSON);

            try
            {
                //Récupération du nouvel utilisateur
                int id = (int)listePerson.FillByEmail(email);
                DataSetEatFast.EATFAST_PERSONRow personRow = personDataSet.EATFAST_PERSON.FindByPER_ID(id);
                this.personRow = personRow;
                NewUser newUser = new NewUser(id);
                newUser.ShowDialog();
            }
            catch (Exception o)
            {
                MessageBox.Show("Something went wrong");
                Console.Write(o);
            }
        }
コード例 #4
0
 //Fonction pour initialiser l'utilisateur connecté
 public void initializeUser(DataSetEatFast.EATFAST_PERSONRow personRow)
 {
     this.personRow = personRow;
 }
コード例 #5
0
 private void Checkout_Load(object sender, EventArgs e)
 {
     this.total          = Homepage.getInstance().CalculateCartTotal();
     labelCartTotal.Text = "Total (CHF) : " + this.total;
     this.user           = Homepage.getInstance().GetUser();
 }