コード例 #1
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;
                }
            }
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(idUser.Text) && !string.IsNullOrWhiteSpace(pswUser.Text) && !idUser.Text.All(char.IsLetter))
            {
                bool clientExist = DbConnect.DblsCLient(Convert.ToInt32(idUser.Text), pswUser.Text);

                if (clientExist)
                {
                    order.CurrentClient = DbConnect.DbConnectClient(Convert.ToInt32(idUser.Text), pswUser.Text);

                    panel3.Visible   = true;
                    panel1.Visible   = false;
                    errorID.Visible  = false;
                    errorPsw.Visible = false;

                    clientFName.Text = order.CurrentClient.FirstName;
                    clientLName.Text = order.CurrentClient.LastName;
                    newClientId.Text = order.CurrentClient.Id.ToString();
                }
                else if (clientExist == false)
                {
                    errorID.Text    = "L'id ou le mot de passe est incorrect ";
                    errorID.Visible = true;
                }
            }
            else if (string.IsNullOrWhiteSpace(idUser.Text) || idUser.Text.All(char.IsLetter))
            {
                errorID.Visible = true;
            }
            else if (string.IsNullOrWhiteSpace(pswUser.Text))
            {
                errorPsw.Visible = true;
            }
            else
            {
            }
        }