コード例 #1
0
 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;
 }
コード例 #2
0
        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); }
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
            }
        }
コード例 #6
0
 //Cập nhật hóa đơn bán lẻ
 public static bool Update_HoaDonBanLe(HoaDonBanLe hdbl)
 {
     return(false);
 }
コード例 #7
0
 //Thêm mới hóa đơn bán lẻ
 public static bool Add_HoaDonBanLe(HoaDonBanLe hdbl)
 {
     return(false);
 }