public bool ThemVTTD(clsViTriTuyenDung uvAdd) { System.Data.Common.DbTransaction suaTran = db.Connection.BeginTransaction(); try { db.Transaction = suaTran; src.DAOs.DB_QLTD.tblVITRI_TD vt = new DAOs.DB_QLTD.tblVITRI_TD(); //vt.MaVT = 12; vt.TenVT = uvAdd._StrTenViTri; vt.SoLuong = uvAdd._SoLuong; vt.DiaDiemLV = uvAdd._StrDiaDiemLV; vt.Luong = uvAdd._MucLuong; vt.NgayHetHan = uvAdd._NgayHetHan; vt.MoTa = uvAdd._StrMoTa; vt.YeuCau = uvAdd._StrYeuCau; vt.QuyenLoi = uvAdd._StrQuyenLoi; db.tblVITRI_TDs.InsertOnSubmit(vt); db.SubmitChanges(); db.Transaction.Commit(); return(true); } catch { db.Transaction.Rollback(); return(false); } }
public List <clsViTriTuyenDung> GetVitriTuyenDung() { var query = (from VT in db.tblVITRI_TDs select VT).ToList(); List <clsViTriTuyenDung> lst_Vttd = new List <clsViTriTuyenDung>(); foreach (var item in query) { clsViTriTuyenDung vt = new clsViTriTuyenDung((int)item.MaVT, item.TenVT, (int)item.SoLuong, item.DiaDiemLV, (DateTime)item.NgayHetHan, item.MoTa, item.YeuCau, item.QuyenLoi, item.Luong); lst_Vttd.Add(vt); } return(lst_Vttd); }