예제 #1
0
        private void btnComplete_Click(object sender, EventArgs e)
        {
            lblIdError.Visible = false;
            if (txtName.Text == "" || txtSurname.Text == "" || txtId.Text == "" || txtEmail.Text == "" ||
                txtUserName.Text == "" || txtPassword.Text == "" || comboBox1.Text == "" ||
                comboBox2.Text == "" || comboBox3.Text == "" || comboBox4.Text == "")
            {
                lblFill1.Text = "Please fill in the blanks";
            }
            else if (checkBox1.Checked == false)
            {
                lblFill2.Text = "Please accept the Membership Agreement and Privacy Policy";
            }
            else if (txtId.Text.Length < 11 || txtId.Text.Length > 11)
            {
                lblIdError.Visible = true;
            }
            else
            {
                int    len1, len2;
                string a, b;
                len1 = txtName.Text.Length;
                len2 = txtSurname.Text.Length;
                a    = txtName.Text.Substring(0, 1);
                b    = txtSurname.Text.Substring(0, 1);

                Costumer costumer = new Costumer();
                costumer.Name     = a.ToUpper() + txtName.Text.Substring(1, len1 - 1);
                costumer.Surname  = b.ToUpper() + txtSurname.Text.Substring(1, len2 - 1);
                costumer.ID       = txtId.Text;
                costumer.Email    = txtEmail.Text;
                costumer.UserName = txtUserName.Text;
                costumer.Password = txtPassword.Text;
                costumer.Gender   = comboBox1.SelectedItem.ToString();
                costumer.BDD      = Convert.ToInt32(comboBox2.SelectedItem.ToString());
                costumer.BDM      = comboBox3.SelectedItem.ToString();
                costumer.BDY      = Convert.ToInt32(comboBox4.SelectedItem.ToString());
                CostumerProcess.AddCostumer(costumer);
                AddVehicle addVehicle = new AddVehicle();
                addVehicle.userName = costumer.UserName;
                addVehicle.password = costumer.Password;
                addVehicle.Show();
                this.Hide();
            }
        }