示例#1
0
 public void DeleteNX(string ma)
 {
     try {
         using (QLCuaHangDataContext cuahang = new QLCuaHangDataContext()) {
             NhapXuat nx = cuahang.NhapXuats.SingleOrDefault(n => n.MaNX == ma);
             //Tiến hành xoá Chi tiết.
             if (MessageBox.Show("Bạn có muốn tự động cập nhật lại Số lượng hàng hoá?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
             {
                 List <ChiTiet> liCT = cuahang.ChiTiets.Where(c => c.MaNX == ma).ToList();
                 foreach (ChiTiet ct in liCT)
                 {
                     ctBAL.DeleteCTUpdateHang(ma, ct.MaHang);
                 }
             }
             else
             {
                 ctBAL.DeleteCTWithMaNX(ma);
             }
             //Tiến hành xoá nhập xuất.
             cuahang.NhapXuats.DeleteOnSubmit(nx);
             cuahang.SubmitChanges();
             MessageBox.Show("Thông tin xoá thành công.", "Thông báo");
         }
     }catch (Exception ex) { myme.ShowError(ex); }
 }
示例#2
0
        public async Task <ActionResult <NhapXuat> > PostUser(NhapXuat nhapxuat)
        {
            dbContext.NhapXuats.Add(nhapxuat);
            await dbContext.SaveChangesAsync();

            return(CreatedAtAction(nameof(Get), new { ID_NhapXuat = nhapxuat.ID_NhapXuat }, nhapxuat));
        }
 protected virtual void Set_Thong_Tin_Hien_Thi(NhapXuat p_NhapXuat = NhapXuat.Default)
 {
     if (p_NhapXuat == NhapXuat.ChungTuBanHang || p_NhapXuat == NhapXuat.ChungTuHangBanTraLai ||
         p_NhapXuat == NhapXuat.ChungTuNhapHang || p_NhapXuat == NhapXuat.ChungTuHangMuaTraLai)
     {
         layout_Kho.Visibility            = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
         layout_DKTT.Visibility           = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
         layout_HTTT.Visibility           = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
         layout_CheckCK.Visibility        = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
         layout_CheckKhuyenMai.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
         layout_CheckVAT.Visibility       = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
         colNgay_Het_Han.Visible          = false;
         colNgay_San_Xuat.Visible         = false;
         layoutControlGroup6.Expanded     = true;
     }
     if (p_NhapXuat == NhapXuat.ChungTuNhapKho || p_NhapXuat == NhapXuat.ChungTuXuatKho)
     {
         layout_Kho.Visibility            = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
         layout_DKTT.Visibility           = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
         layout_HTTT.Visibility           = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
         layout_CheckCK.Visibility        = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
         layout_CheckKhuyenMai.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
         layout_CheckVAT.Visibility       = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
         colKho.Visible                = false;
         colNgay_San_Xuat.Visible      = true;
         colNgay_San_Xuat.VisibleIndex = colThanh_Tien.VisibleIndex + 1;
         colNgay_Het_Han.Visible       = true;
         colNgay_Het_Han.VisibleIndex  = colNgay_San_Xuat.VisibleIndex + 1;
         layoutControlGroup6.Expanded  = false;
     }
 }
示例#4
0
        public void Put(int id, [FromBody] NhapXuat nhapxuat)
        {
            var entity = dbContext.NhapXuats.FirstOrDefault(e => e.ID_NhapXuat == id);

            entity.ID_ThucPham = nhapxuat.ID_ThucPham;
            entity.So_Luong    = nhapxuat.So_Luong;
            entity.Nhap_Xuat   = nhapxuat.Nhap_Xuat;
            entity.NgayNX      = nhapxuat.NgayNX;
            dbContext.SaveChanges();
        }
示例#5
0
 /// <summary>
 /// Load thông tin của Phiếu nhập xuất đã có lên các Controls.
 /// </summary>
 /// <param name="manx"></param>
 /// <param name="cboTenKhach"></param>
 /// <param name="chbTenKhach"></param>
 /// <param name="dtpNgay"></param>
 /// <param name="txtGhiChu"></param>
 public void LoadThongTinNhapXuat(string manx, ComboBox cboTenKhach, CheckBox chbTenKhach, DateTimePicker dtpNgay, TextBox txtGhiChu)
 {
     try
     {
         using (QLCuaHangDataContext cuahang = new QLCuaHangDataContext()) {
             NhapXuat nx = cuahang.NhapXuats.SingleOrDefault(n => n.MaNX == manx);
             if (nx.MaKhach == null)
             {
                 chbTenKhach.Checked = true;
             }
             else
             {
                 cboTenKhach.SelectedValue = nx.MaKhach;
             }
             dtpNgay.Value  = Convert.ToDateTime(nx.Ngay);
             txtGhiChu.Text = nx.GhiChu;
         }
     }catch (Exception ex) { myme.ShowError(ex); }
 }
 public void DeleteHang(string ma)
 {
     try
     {
         using (QLCuaHangDataContext cuahang = new QLCuaHangDataContext())
         {
             // Cập nhật thông tin từ Chi Tiết vào Ghi Chú của Nhập Xuất
             Hang           h  = cuahang.Hangs.Single(hh => hh.MaHang == ma);
             List <ChiTiet> ct = cuahang.ChiTiets.Where(c => c.MaHang == ma).ToList();
             foreach (ChiTiet c in ct)
             {
                 string   thongtin = DateTime.Now.ToShortDateString() + " xoá Hàng: " + h.TenHang + " -sl: " + c.SoLuong + " -giá: " + c.DonGia;
                 NhapXuat nx       = cuahang.NhapXuats.SingleOrDefault(n => n.MaNX == c.MaNX);
                 nx.GhiChu += Environment.NewLine + thongtin;
             }
             cuahang.SP_XoaHang(ma);
             cuahang.SubmitChanges();
             MessageBox.Show("Xoá thông tin thành công.", "Thông báo");
         }
     }
     catch (Exception ex) { myme.ShowError(ex); }
 }
 protected override void Set_Thong_Tin_Hien_Thi(NhapXuat p_NhapXuat)
 {
     base.Set_Thong_Tin_Hien_Thi(NhapXuat.ChungTuNhapKho);
 }