private void tsbluu_Click(object sender, EventArgs e) { if (txtmadt.Text == "") { MessageBox.Show("Chưa chọn thông tin"); return; } daotao dt = new daotao(); dt.madt = txtmadt.Text; dt.tendt = txttendt.Text; dt.diachi = txtdiachi.Text; dt.soluongnv = txtsonv.Text; dt.tungay = datetungay.Value; dt.denngay = datedenngay.Value; dt.ghichu = txtghichu.Text; if (MessageBox.Show(string.Format("Thêm đào tạo"), "", MessageBoxButtons.OKCancel) == DialogResult.OK) { if (Bus.InsertProfile(dt) > 0) { MessageBox.Show("Đã thêm"); Daotao_Load(sender, e); } else { MessageBox.Show("Mã đào tạo đã tồn tại"); } } }
public static int InsertProfile(daotao dt) { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@madt", dt.madt), new SqlParameter("@tendt", dt.tendt), new SqlParameter("@tungay", dt.tungay), new SqlParameter("@denngay", dt.denngay), new SqlParameter("@diachi", dt.diachi), new SqlParameter("@soluongnv", dt.soluongnv), new SqlParameter("@ghichu", dt.ghichu), }; return(DataProvider.ExcuteNonQuerry("themdt", para)); }
public static int InsertProfile(daotao dt) { return(Dao.InsertProfile(dt)); }