//public static DieuPhoi TraCuuDieuPhoiTheoTen(string sTen) //{ // try // { // VNSCDataContext VNSC = SQL_Connection.CreateSQlConnection(); // DieuPhoi sk = VNSC.DieuPhois.Single(P => P.Ten == sTen); // return sk; // } // catch (System.Exception ex) // { // return null; // } //} public static bool Insert(DieuPhoi dto) { try { VNSCDataContext VNSC = SQL_Connection.CreateSQlConnection(); VNSC.DieuPhois.InsertOnSubmit(dto); VNSC.SubmitChanges(); return true; } catch (System.Exception ex) { return false; } }
private void pbTransfer_Click(object sender, EventArgs e) { if (lvThongTin_HSTD.Focused) { for (int i = 0; i < lvThongTin_HSTD.SelectedItems.Count; i++) { if (!KiemTraHoThamDuBiTrungHoSoDieuPhoi(lvThongTin_HSTD.SelectedItems[i].SubItems[0].Text)) { DieuPhoi dto_DP = new DieuPhoi(); dto_DP.MaDonViHanhChanh = list_DonViHanhChanh[cbDonViHanhChanh.SelectedIndex]; dto_DP.MaTrachVuSuKien = list_TrachVuSuKien[cbTrachVuSuKien.SelectedIndex]; dto_DP.MaSuKien_HoSo = lvThongTin_HSTD.SelectedItems[i].SubItems[0].Text; if (DieuPhoi_BUS.Insert(dto_DP)) { SuKien_DieuPhoi dto_Temp = new SuKien_DieuPhoi(); dto_Temp.MaSuKien = iMaSuKien; dto_Temp.MaDieuPhoi = dto_DP.Ma; if (SuKien_DieuPhoi_BUS.Insert(dto_Temp)) { cbTrachVuSuKien_SelectedIndexChanged(sender, e); } else { Form_Notice frm = new Form_Notice("Không thể tạo Hồ sơ điều phối!", false); } } else { Form_Notice frm = new Form_Notice("Không thể tạo Hồ sơ điều phối!", false); } } } } }
public static bool UpdateDieuPhoiInfo(DieuPhoi dto) { //try //{ // VNSCDataContext VNSC = SQL_Connection.CreateSQlConnection(); // DieuPhoi sk = VNSC.DieuPhois.Single(P => P.Ma == dto.Ma); // sk.Ten = dto.Ten; // sk.MaDonViHanhChanh = dto.MaDonViHanhChanh; // sk.MoTa = dto.MoTa; // VNSC.SubmitChanges(); // return true; //} //catch (System.Exception ex) //{ // return false; //} return true; //Khong co update }
public static bool UpdateDieuPhoiInfo(DieuPhoi dto) { return DieuPhoi_DAO.UpdateDieuPhoiInfo(dto); }
public static List<DieuPhoi> TraCuuDSDieuPhoiTheoMaSuKien_HoSo(int iMaSuKien, string sMaSuKien_HoSo) { try { VNSCDataContext VNSC = SQL_Connection.CreateSQlConnection(); List<DieuPhoi> list = new List<DieuPhoi>(); var q = from p in VNSC.SuKien_DieuPhois where p.MaSuKien == iMaSuKien select p; DieuPhoi dto_Temp = new DieuPhoi(); foreach (SuKien_DieuPhoi k in q) { dto_Temp = VNSC.DieuPhois.Single(P => P.Ma == k.MaDieuPhoi); if (dto_Temp.MaSuKien_HoSo == sMaSuKien_HoSo) { list.Add(dto_Temp); } } return list; } catch (System.Exception ex) { return null; } }
private void detach_DieuPhois(DieuPhoi entity) { this.SendPropertyChanging(); entity.TrachVuSuKien = null; }
//public static DieuPhoi TraCuuDieuPhoiTheoTen(string sTen) //{ // return DieuPhoi_DAO.TraCuuDieuPhoiTheoTen(sTen); //} public static bool Insert(DieuPhoi dto) { return DieuPhoi_DAO.Insert(dto); }
private void detach_DieuPhois(DieuPhoi entity) { this.SendPropertyChanging(); entity.SuKien_HoSo = null; }
partial void DeleteDieuPhoi(DieuPhoi instance);
partial void UpdateDieuPhoi(DieuPhoi instance);
partial void InsertDieuPhoi(DieuPhoi instance);
private void detach_DieuPhois(DieuPhoi entity) { this.SendPropertyChanging(); entity.DonViHanhChanh = null; }