Example #1
0
        private void btnDK_Click(object sender, EventArgs e)
        {
            DTO_Users dto_user    = new DTO_Users();
            BLL_Users bll_user    = new BLL_Users();
            BLL_Per   b_per       = new BLL_Per();
            string    temp_urname = bll_user.Call_Get_Username_User(txtUsername.Text);

            if (txtname.Text == "" || txtpassword.Text == "" || txtemail.Text == "" || txtUsername.Text == "")
            {
                MessageBox.Show("Không được để trống bất cứ ô nào", "Thông báo", MessageBoxButtons.OK);
            }
            else if (temp_urname == txtUsername.Text)
            {
                MessageBox.Show("Tên Đăng nhập đã tồn tại, vui lòng nhập vào tên đăng nhập khác", "Thông báo", MessageBoxButtons.OK);
                txtUsername.Focus();
            }
            else
            {
                try
                {
                    dto_user.F_Username = txtUsername.Text;
                    dto_user.F_Password = txtpassword.Text;
                    dto_user.F_Name     = txtname.Text;
                    dto_user.F_DOB      = DateTime.Parse(dtdbo.Text);
                    dto_user.F_Email    = txtemail.Text;
                    bll_user.Call_Insert_User(dto_user);
                    //
                    int id = bll_user.Call_Get_ID_User(txtUsername.Text);
                    b_per.Call_Insert_per(id);
                    MessageBox.Show("successful");
                    this.Close();
                }
                catch (Exception ee)
                {
                    MessageBox.Show(ee.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }