コード例 #1
0
        private void btn_Lapphieutra_Click(object sender, EventArgs e)
        {
            DonTraHangCC a = new DonTraHangCC()
            {
                NgayLap  = DateTime.Now,
                Nguoilap = this.NhanVien.ID,
                NhaCC    = ((NhaCungCap)comb_NCC.SelectedItem).ID,
                LyDo     = txt_lyDo.Text
            };
            DonTraHangCC rs = DonTraHangCC_BUL.Them(a);

            if (rs != null)
            {
                if (ChiTietDonTraHang_BUL.ThemList(rs.ID, this.ListCTTH))
                {
                    MessageSucess();
                }
                else
                {
                    MesageFaild();
                }
            }
            else
            {
                MesageFaild();
            }
        }
コード例 #2
0
        public static DonTraHangCC Them(DonTraHangCC param)
        {
            DonTraHangCC dth = null;

            using (PTTKHTEntities context = new PTTKHTEntities())
            {
                context.DonTraHangCCs.Add(param);
                context.SaveChanges();
                dth = param;
            }
            return(dth);
        }
コード例 #3
0
        public static bool XacNhanDonTraHang(int IDDonTra, int IDNguoiXacNhan)
        {
            bool rs = false;

            using (PTTKHTEntities context = new PTTKHTEntities())
            {
                DonTraHangCC abc = context.DonTraHangCCs.SingleOrDefault(b => b.ID == IDDonTra);
                abc.NguoiXacNhap = IDNguoiXacNhan;
                abc.NgayXacNhan  = DateTime.Now;
                foreach (ChiTietDonTraHangNCC ct in abc.ChiTietDonTraHangNCCs)
                {
                    ct.HangHoa.SoLuongTra -= ct.SoLuong;
                }
                int index = context.SaveChanges();
                rs = true;
            }
            return(rs);
        }