private void btnReg_Click(object sender, EventArgs e) { foreach (var item in Controls) { errorReg.SetError((Control)item, ""); } sstReg.Text = ""; if (!validate()) { return; } else { string SQLComm = "SELECT * FROM TbQuanLyNhanSu"; string[] DTReg = DataAccess.ExeReader(SQLComm, txtTDN.Text, 0); if (txtTDN.Text == DTReg[0]) { errorReg.SetError(txtTDN, "Error"); sstReg.Text = "Email đã tồn tại"; txtTDN.Focus(); return; } else { DataAccess.NonQuery(string.Format("INSERT TbQuanLyNhanSu VALUES(N'{0}',N'{1}','User','Blocked')", txtTDN.Text, txtMK.Text)); string ImageIN = string.Format("INSERT ThongTinCaNhan VALUES(N'{0}',N'{1}',N'{2}',N'{3}',{4},{5},'{6}',@ImageB)", txtTDN.Text, txtTen.Text, dateNgaySinh.Value, txtDiachi.Text, Convert.ToInt32(txtCMND.Text), Convert.ToInt32(txtDT.Text), txtEmail.Text); ClassImage.ImageIN(ImageIN); MessageBox.Show("Đăng ký thành công", "Thông Báo"); resetForm(); } } }
private void pictureBoxRegister_Click(object sender, EventArgs e) { ClassImage.browse(); if (ClassImage.fileImage != "") { pictureBoxRegister.BackgroundImage = null; pictureBoxRegister.Load(ClassImage.fileImage); } }