コード例 #1
0
        private void buttonRegistrate_Click(object sender, EventArgs e)
        {
            if (textBoxPassword.Text != textBoxPasswordR.Text)
            {
                MessageBox.Show("Пароль введен неправильно.");
                return;
            }

            var au = new Authorization()
            {
                Login    = textBoxLogin.Text,
                Password = textBoxPassword.Text,
                Role     = 1
            };

            var cust = new Customer()
            {
                FirstName = textBoxFName.Text,
                LastName  = textBoxLName.Text,
                Phone     = textBoxPhone.Text
            };

            if (Сlient.RegistrateCustomer(Parser.ParseCustomer(cust), Parser.ParseAuth(au)) == false)
            {
                MessageBox.Show("Такой логин уже используется");
            }
            else
            {
                Program.userID = Сlient.Authorize(Parser.ParseAuth(au));
                Program.formEnter.Show();
                Hide();
            }
        }
コード例 #2
0
        private void buttonReg_Click(object sender, EventArgs e)
        {
            var au = new Authorization()
            {
                Login    = "******",
                Password = "******",
                Role     = 2
            };

            var cust = new Customer()
            {
                FirstName = "Оля",
                LastName  = "Петрова",
                Phone     = "123123"
            };

            Сlient.RegistrateCustomer(Parser.ParseCustomer(cust), Parser.ParseAuth(au));
        }