コード例 #1
0
        protected void btnRegister_OnClick(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                var a = dataProvider.GetCustomerByLogon(txtUsername.Text);
                if (a.Customer.Count > 0)
                {
                    usernaemUnav.Visible = true;
                    return;
                }

                var customer = new CustomerDataSet();
                customer.Customer.AddCustomerRow(txtFName.Text, txtLName.Text, txtEmail.Text, txtPassword.Text, txtUsername.Text, 0, "", false);

                int result = dataProvider.AddCustomer(customer, int.Parse(cbSecurityQuestions.SelectedValue), txtAnswer.Text);

                if (result != -1)
                {
                    Message.Visible      = true;
                    success.Visible      = true;
                    registration.Visible = false;
                }
                else
                {
                    Message.Visible      = false;
                    fail.Visible         = true;
                    registration.Visible = false;
                }
            }
        }
コード例 #2
0
        private void btnRegister_Click_1(object sender, EventArgs e)
        {
            customer = new Customer();
            Contract contract = new Contract();

            string   name     = txtName.Text;
            string   surname  = txtSurname.Text;
            string   password = txtPassword.Text;
            string   email    = txtEmail.Text;
            DateTime date     = dtpBirthday.Value.Date;

            if (String.IsNullOrEmpty(name) || String.IsNullOrEmpty(surname) || String.IsNullOrEmpty(email) && String.IsNullOrEmpty(password))
            {
                MessageBox.Show("All inputs must be filled", "Error registering",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
            }
            else
            {
                foreach (RadioButton r in buttons)
                {
                    if (r.Checked == true)
                    {
                        Audioplatform p     = DataProvider.GetPlatform(r.Name);
                        DateTime      dtend = DateTime.Now;
                        DateTime      end   = new DateTime(2020, dtend.Month, dtend.Day);
                        DataProvider.AddContract(DateTime.Now.ToString("yyyy-MM-dd"), end.ToString("yyyy-MM-dd"), r.Name, name, surname);
                        DataProvider.AddCustomer(name, surname, email, date.ToString("yyyy-MM-dd"), password, r.Name, p.price, DateTime.Now.ToString("yyyy-MM-dd"), end.ToString("yyyy-MM-dd"));
                        MessageBox.Show("You have successfully registred on audio platform " + p.name + " which costs" + p.price, "Wellcome!",
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Information);
                    }
                }
            }
            this.Close();
        }
コード例 #3
0
        public int Add(Customers customer)
        {
            int result = dp.AddCustomer(customer);

            return(result);
        }