public static bool Insert(NhomTrachVu dto) { try { VNSCDataContext VNSC = SQL_Connection.CreateSQlConnection(); VNSC.NhomTrachVus.InsertOnSubmit(dto); VNSC.SubmitChanges(); return true; } catch (System.Exception ex) { return false; } }
private void pbHoanTat_Click(object sender, EventArgs e) { if (lbSelect.Text == "THÊM") { NhomTrachVu dto = new NhomTrachVu(); dto.Ma = tbMa.Text; dto.Ten = tbTen.Text; dto.MoTa = tbMoTa.Text; if (NhomTrachVu_BUS.Insert(dto)) { pnQuanLy.Visible = true; pnSelect.Visible = true; pnInfo.Visible = false; NewInfo(); lbTitle.Text = "NHÓM TRÁCH VỤ"; lbSelect.Text = ""; refreshListView(); lvThongTin.SelectedItems.Clear(); } else { Form_Notice frm = new Form_Notice("Không thể tạo Nhóm trách vụ!", false); } } if (lbSelect.Text == "SỬA") { NhomTrachVu dto = NhomTrachVu_BUS.TraCuuNhomTrachVuTheoMa(tbMa.Text); dto.Ten = tbTen.Text; dto.MoTa = tbMoTa.Text; if (NhomTrachVu_BUS.UpdateNhomTrachVuInfo(dto)) { pnQuanLy.Visible = true; pnSelect.Visible = true; pnInfo.Visible = false; NewInfo(); lbTitle.Text = "NHÓM TRÁCH VỤ"; lbSelect.Text = ""; refreshListView(); } else { Form_Notice frm = new Form_Notice("Không thể cập nhật Nhóm trách vụ!", false); } } }
partial void DeleteNhomTrachVu(NhomTrachVu instance);
partial void UpdateNhomTrachVu(NhomTrachVu instance);
partial void InsertNhomTrachVu(NhomTrachVu instance);
public static bool UpdateNhomTrachVuInfo(NhomTrachVu dto) { try { VNSCDataContext VNSC = SQL_Connection.CreateSQlConnection(); NhomTrachVu sk = VNSC.NhomTrachVus.Single(P => P.Ma == dto.Ma); sk.Ten = dto.Ten; sk.MoTa = dto.MoTa; VNSC.SubmitChanges(); return true; } catch (System.Exception ex) { return false; } }
public static bool UpdateNhomTrachVuInfo(NhomTrachVu dto) { return NhomTrachVu_DAO.UpdateNhomTrachVuInfo(dto); }
public static bool Insert(NhomTrachVu dto) { return NhomTrachVu_DAO.Insert(dto); }