private void passingData() { tempHDBanLe = new HoaDonBanLe(); tempHDBanLe.SoHoaDon = txtmahdbanle.Text; tempHDBanLe.MaKH = txtmakh.Text; tempHDBanLe.MaNV = txtmanv.Text; tempHDBanLe.TongTien = Convert.ToDecimal(txttongtien.Text); tempHDBanLe.NgayBan = DTNgayBanHDBL.Value; }
public bool Update(HoaDonBanLe hdbl) { try { Tbl_HDBanLe update = DB.Tbl_HDBanLes.Single(tmp => tmp.soHoaDon == hdbl.SoHoaDon); update.soHoaDon = hdbl.SoHoaDon; update.maKH = hdbl.MaKH; update.maNV = hdbl.MaNV; update.ghiChu = hdbl.GhiChu; update.ngayBan = hdbl.NgayBan; DB.SubmitChanges(); return(true); } catch { return(false); } }
public int XoaHDBanLe(HoaDonBanLe hdbl) { Tbl_HDBanLe tbhdbl = new Tbl_HDBanLe(); tbhdbl = DB.Tbl_HDBanLes.Where(x => x.soHoaDon == hdbl.SoHoaDon).FirstOrDefault(); if (tbhdbl != null) { return(0); } tbhdbl.soHoaDon = hdbl.SoHoaDon; tbhdbl.maKH = hdbl.MaKH; tbhdbl.maNV = hdbl.MaNV; tbhdbl.ghiChu = hdbl.GhiChu; tbhdbl.ngayBan = hdbl.NgayBan; DB.Tbl_HDBanLes.DeleteOnSubmit(tbhdbl); DB.SubmitChanges(); return(1); }
public int ThemHDBanLe(HoaDonBanLe hdbl) { var hdbanle = DB.Tbl_HDBanLes.Where(x => x.soHoaDon == hdbl.SoHoaDon).FirstOrDefault(); if (hdbanle != null) { return(0); } Tbl_HDBanLe hd = new Tbl_HDBanLe(); hd.soHoaDon = hdbl.SoHoaDon; hd.maKH = hdbl.MaKH; hd.maNV = hdbl.MaNV; hd.ghiChu = hdbl.GhiChu; hd.ngayBan = hdbl.NgayBan; DB.Tbl_HDBanLes.InsertOnSubmit(hd); DB.SubmitChanges(); return(1); }
private void btnluu_Click(object sender, EventArgs e) { passingData(); HoaDonBanLe hdbl = new HoaDonBanLe(); hdbl.SoHoaDon = txtmahdbanle.Text; hdbl.MaKH = txtmakh.Text; hdbl.MaNV = txtmanv.Text; hdbl.NgayBan = DTNgayBanHDBL.Value; hdbl.TongTien = Convert.ToDecimal(txttongtien.Text); int kq = hdblbll.ThemHDBanLe(hdbl); if (kq == 0) { MessageBox.Show("Trùng mã hóa đơn !", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } else if (kq == 1) { MessageBox.Show("Thêm thành công !", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } }
//Cập nhật hóa đơn bán lẻ public static bool Update_HoaDonBanLe(HoaDonBanLe hdbl) { return(false); }
//Thêm mới hóa đơn bán lẻ public static bool Add_HoaDonBanLe(HoaDonBanLe hdbl) { return(false); }