# GUI
void btn_AddEmployee() => BUS_ql.GetInstance().Them_nhan_vien(tbName, tbEmail,tbPassword,tbAddress,tbnumber);
# BUS
public void Them_nhan_vien(string name, string email, string password, string diachi, int dienthoai) {
// Validate data
if(!ValidateTelephoneNumber(dienthoai) || !Validate(email)) return;
// replace space symbol
name = name.Trim()
diachi = diachi.Trim()
// call DTO
NhanVien nv = new NhanVien(name,email,password,diachi,dienthoai);
// call DAL
DAL_ql.GetInstance().Them_nhan_vien(nv);
}
# DAL
public void Them_nhan_vien(NhanVien nv){
MoKetNoi();
SqlCommand cm = new SqlCommand("insert into users(nv.name,nv.email,nv.password,nv.dia_chi,nv.dien_thoai,quyen) values(@name,@email,@password,@dia_chi,@dien_thoai,0)", cnn);
cm.Parameters.AddWithValue("@name", nv.name);
cm.Parameters.AddWithValue("@email", nv.email);
cm.Parameters.AddWithValue("@password", BCrypt.Net.BCrypt.HashString(nv.password));
cm.Parameters.AddWithValue("@dia_chi", nv.diachi);
cm.Parameters.AddWithValue("@dien_thoai", nv.dienthoai);
cm.ExecuteNonQuery();
DongKetNoi();
}
buckblack/TestGH
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
test thử github
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published