//không cần tạo mã //insert public bool Insert(string MaDS, string MaDL, int SoPhieuX, int TongTG, int TyLe) { DOANHSO_DAILY temp = new DOANHSO_DAILY(); temp.MaBaoCaoDoanhSo = MaDS; temp.MaDaiLy = MaDL; temp.SoPhieuXuat = SoPhieuX; temp.TongTriGia = TongTG; temp.TyLe = TyLe; return(DoanhSo_DaiLyDAO.Instance.Insert(temp)); }
//không phải Create Code //insert public bool Insert(DOANHSO_DAILY ds) { using (QLDLDataContext db = new QLDLDataContext()) { try { db.DOANHSO_DAILies.InsertOnSubmit(ds); db.SubmitChanges(); return(true); } catch { return(false); } } }
//update public bool Update(string MaDS, string MaDL, DOANHSO_DAILY ds) { using (QLDLDataContext db = new QLDLDataContext()) { DOANHSO_DAILY temp = db.DOANHSO_DAILies.Where(p => p.MaBaoCaoDoanhSo == MaDS && p.MaDaiLy == MaDL).FirstOrDefault(); temp.SoPhieuXuat = ds.SoPhieuXuat; temp.TongTriGia = ds.TongTriGia; temp.TyLe = ds.TyLe; try { db.SubmitChanges(); return(true); } catch { return(false); } } }
//Updadte public bool Update(string MaDS, string MaDL, DOANHSO_DAILY ds) { return(DoanhSo_DaiLyDAO.Instance.Update(MaDS, MaDL, ds)); }