public static bool Insert(TrachVu dto) { try { VNSCDataContext VNSC = SQL_Connection.CreateSQlConnection(); VNSC.TrachVus.InsertOnSubmit(dto); VNSC.SubmitChanges(); return true; } catch (System.Exception ex) { return false; } }
public static bool UpdateTrachVuInfo(TrachVu dto) { return TrachVu_DAO.UpdateTrachVuInfo(dto); }
public static bool UpdateTrachVuInfo(TrachVu dto) { try { VNSCDataContext VNSC = SQL_Connection.CreateSQlConnection(); TrachVu sk = VNSC.TrachVus.Single(P => P.Ma == dto.Ma); sk.MaNhomTrachVu = dto.MaNhomTrachVu; sk.Ten = dto.Ten; sk.MoTa = dto.MoTa; VNSC.SubmitChanges(); return true; } catch (System.Exception ex) { return false; } }
partial void DeleteTrachVu(TrachVu instance);
public static bool Insert(TrachVu dto) { return TrachVu_DAO.Insert(dto); }
partial void UpdateTrachVu(TrachVu instance);
partial void InsertTrachVu(TrachVu instance);
private void detach_TrachVus(TrachVu entity) { this.SendPropertyChanging(); entity.NhomTrachVu = null; }
private void attach_TrachVus(TrachVu entity) { this.SendPropertyChanging(); entity.NhomTrachVu = this; }
private void pbHoanTat_Click(object sender, EventArgs e) { if (lbSelect.Text == "THÊM") { TrachVu dto = new TrachVu(); dto.Ma = tbMa.Text; dto.MaNhomTrachVu = list_NhomTrachVu[cbNhomTrachVu.SelectedIndex]; //dto.MaNhomTrachVu = NhomTrachVu_BUS.TraCuuNhomTrachVuTheoTen(cbNhomTrachVu.Text).Ma; dto.Ten = tbTen.Text; dto.MoTa = tbMoTa.Text; if (TrachVu_BUS.Insert(dto)) { pnQuanLy.Visible = true; pnSelect.Visible = true; pnInfo.Visible = false; NewInfo(); lbTitle.Text = "TRÁCH VỤ"; lbSelect.Text = ""; refreshListView(); lvThongTin.SelectedItems.Clear(); } else { Form_Notice frm = new Form_Notice("Không thể tạo Trách Vụ!", false); } } if (lbSelect.Text == "SỬA") { TrachVu dto = TrachVu_BUS.TraCuuTrachVuTheoMa(tbMa.Text); dto.MaNhomTrachVu = list_NhomTrachVu[cbNhomTrachVu.SelectedIndex]; //dto.MaNhomTrachVu = NhomTrachVu_BUS.TraCuuNhomTrachVuTheoTen(cbNhomTrachVu.Text).Ma; dto.Ten = tbTen.Text; dto.MoTa = tbMoTa.Text; if (TrachVu_BUS.UpdateTrachVuInfo(dto)) { pnQuanLy.Visible = true; pnSelect.Visible = true; pnInfo.Visible = false; NewInfo(); lbTitle.Text = "TRÁCH VỤ"; lbSelect.Text = ""; refreshListView(); } else { Form_Notice frm = new Form_Notice("Không thể cập nhật Trách Vụ!", false); } } }