Пример #1
0
        // <summary>
        /// Confirms and ends the registration phase
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">E.</param>/
        private void button3_Click(object sender, EventArgs e)
        {
            /******** Verifying the inputs of the registration phase *********/
            if (!string.IsNullOrWhiteSpace(newUsLastName.Text) || !string.IsNullOrWhiteSpace(newUsFirstName.Text) || !string.IsNullOrWhiteSpace(newUsPhone.Text) || !string.IsNullOrWhiteSpace(newUsMail.Text) || !string.IsNullOrWhiteSpace(newUsPsw.Text))
            {
                panel2.Visible = false;
                panel3.Visible = true;
                try
                {
                    Person person = new Person();

                    person.LastName                 = newUsLastName.Text;
                    person.FirstName                = newUsFirstName.Text;
                    person.PhoneNumber              = Convert.ToInt32(newUsPhone.Text);
                    person.Email                    = newUsMail.Text;
                    person.Password                 = newUsPsw.Text;
                    person.Address["Street"]        = newUsStreet.Text;
                    person.Address["Street number"] = newUsStNum.Text;
                    person.Address["Postal code"]   = newUsPostal.Text;


                    DbConnect.DbAddClient(person);
                    clientFName.Text = newUsFirstName.Text;
                    clientLName.Text = newUsLastName.Text;
                    newClientId.Text = DbConnect.searchId(person.PhoneNumber).ToString();
                }
                catch (Exception errorSignIn)
                {
                    panel2.Visible = true;
                    panel1.Visible = false;
                    panel3.Visible = false;
                }
            }
        }
Пример #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            /*
             * (Faut ajouter Client à la classe Order?)
             * Person newUser = new Person();
             * newUser.Last,ame = newUsLastName.Text;
             * newUser.tFirstname = newUsFirstName.Text;
             * newUser.Phone_Number = newUsPhone.Text;
             * newUser.Id = newUsID.Text;
             * newUser.Password = newUsPsw.Text;
             * DbAddClient(newUser);
             */
            // clientPrenom.Text = order.GetCurrentClient.GetLastName; Il faut créer auparavant l'objet Order ayant un Objet Client

            if (!string.IsNullOrWhiteSpace(newUsLastName.Text) || !string.IsNullOrWhiteSpace(newUsFirstName.Text) || !string.IsNullOrWhiteSpace(newUsPhone.Text) || !string.IsNullOrWhiteSpace(newUsMail.Text) || !string.IsNullOrWhiteSpace(newUsPsw.Text))
            {
                panel2.Visible = false;
                panel3.Visible = true;
                try
                {
                    Person person = new Person();

                    // DTB s'en occupe automatiquement normallement person.Id = ;
                    person.LastName                 = newUsLastName.Text;
                    person.FirstName                = newUsFirstName.Text;
                    person.PhoneNumber              = Convert.ToInt32(newUsPhone.Text);
                    person.Email                    = newUsMail.Text;
                    person.Password                 = newUsPsw.Text;
                    person.Address["Street"]        = newUsStreet.Text;
                    person.Address["Street number"] = newUsStNum.Text;
                    person.Address["Postal code"]   = newUsPostal.Text;


                    DbConnect.DbAddClient(person);
                    clientFName.Text = newUsFirstName.Text;
                    clientLName.Text = newUsLastName.Text;
                    newClientId.Text = DbConnect.searchId(person.PhoneNumber).ToString();

                    order.CurrentClient = DbConnect.DbConnectClient(Convert.ToInt32(newClientId.Text), person.Password);
                }
                catch (Exception errorSignIn)
                {
                    panel2.Visible = true;
                    panel1.Visible = false;
                    panel3.Visible = false;
                }
            }
        }