Пример #1
0
        public async Task <ActionResult> Deletes(int id, string quaylai)
        {
            if (quaylai != null)
            {
                return(RedirectToAction("Index"));
            }
            PhieuBaoHanh huyPhieuBaoHanh = (PhieuBaoHanh)await _phieuBaoHanhBus.Find(id);

            if (huyPhieuBaoHanh == null)
            {
                SetAlert("Đã xảy ra lỗi! Bạn hãy hủy lại", "error");
                return(RedirectToAction("Edit"));
            }
            else
            {
                try
                {
                    await _phieuBaoHanhBus.HuyPhieuBaoHanh(huyPhieuBaoHanh);

                    SetAlert("Đã hủy phiếu bảo hành thành công!!!", "success");
                }
                catch
                {
                    SetAlert("Đã xảy ra lỗi! Bạn hãy hủy lại", "error");
                    return(RedirectToAction("Edit"));
                }
            }
            return(RedirectToAction("Index"));
        }
        public async Task Confirm(object confirmModel)
        {
            PhieuBaoHanh pbh = (PhieuBaoHanh)confirmModel;

            pbh.NgayChinhSua = DateTime.Now;
            pbh.DaGiao       = true;

            await _phieuBaoHanhRepo.EditAsync(pbh);
        }
        public async Task Delete(object deleteModel)
        {
            PhieuBaoHanh pbh = (PhieuBaoHanh)deleteModel;

            pbh.NgayChinhSua = DateTime.Now;
            pbh.TrangThai    = false;

            await _phieuBaoHanhRepo.EditAsync(pbh);
        }
 public async Task XacNhanPhieuBaoHanh(object editModel)
 {
     try
     {
         PhieuBaoHanh editPhieuBaoHanh = (PhieuBaoHanh)editModel;
         editPhieuBaoHanh.DaGiao = true;
         await _phieuBaoHanhRepo.EditAsync(editPhieuBaoHanh);
     }
     catch (Exception)
     {
     }
 }
 public async Task HuyPhieuBaoHanh(object editModel)
 {
     try
     {
         PhieuBaoHanh editPhieuBaoHanh = (PhieuBaoHanh)editModel;
         editPhieuBaoHanh.TrangThai = false;
         await _phieuBaoHanhRepo.EditAsync(editPhieuBaoHanh);
     }
     catch (Exception)
     {
     }
 }
 public async Task Create(PhieuBaoHanhViewModel obj)
 {
     PhieuBaoHanh pbh = new PhieuBaoHanh
     {
         SoPhieuBaoHanh = obj.soPhieuBaoHanh,
         NgayLap        = obj.ngayLap,
         NgayGiao       = obj.ngayGiao,
         MaNhanVien     = obj.maNhanVien,
         TenKhachHang   = obj.tenKhachHang,
         SoDienThoai    = obj.soDienThoai,
         GhiChu         = obj.ghiChu,
         DaGiao         = false,
         TrangThai      = true,
         NgayChinhSua   = DateTime.Now,
         Value          = obj.modelName
     };
     await _phieuBaoHanhRepo.InsertAsync(pbh);
 }
        public async Task Create(PhieuBaoHanhViewModel O)
        {
            PhieuBaoHanh order = new PhieuBaoHanh
            {
                SoPhieuBaoHanh = O.soPhieuBaoHanh,
                NgayLap        = DateTime.Now,
                NgayGiao       = O.ngayGiao,
                MaNhanVien     = O.maNhanVien,
                TenKhachHang   = O.tenKhachHang,
                SoDienThoai    = O.soDienThoai,
                GhiChu         = O.ghiChu,
                DaGiao         = false,
                TrangThai      = true,
                NgayChinhSua   = DateTime.Now,
            };

            foreach (var i in O.chiTietPhieuBaoHanh)
            {
                order.ChiTietPhieuBaoHanh.Add(i);
            }
            await _phieuBaoHanhRepo.InsertAsync(order);
        }
        public async Task <ActionResult> Confirm(int id)
        {
            PhieuBaoHanh confirmPhieuBaoHanh = (PhieuBaoHanh)await _phieuBaoHanhBus.Find(id);

            if (confirmPhieuBaoHanh == null)
            {
                return(HttpNotFound());
            }
            else
            {
                try
                {
                    await _phieuBaoHanhBus.Confirm(confirmPhieuBaoHanh);

                    SetAlert("Đã xác nhận phiếu bảo hành thành công!!!", "success");
                }
                catch
                {
                    SetAlert("Đã xảy ra lỗi! Bạn hãy xác nhận lại", "error");
                }
            }
            return(RedirectToAction("Index"));
        }
        public async Task <ActionResult> Delete(int id)
        {
            PhieuBaoHanh delPhieuBaoHanh = (PhieuBaoHanh)await _phieuBaoHanhBus.Find(id);

            if (delPhieuBaoHanh == null)
            {
                return(HttpNotFound());
            }
            else
            {
                try
                {
                    await _phieuBaoHanhBus.Delete(delPhieuBaoHanh);

                    SetAlert("Đã hủy phiếu bảo hành thành công!!!", "success");
                }
                catch
                {
                    SetAlert("Đã xảy ra lỗi! Bạn hãy hủy lại", "error");
                }
            }
            return(RedirectToAction("Index"));
        }
Пример #10
0
 public void Update_PBH(PhieuBaoHanh ex)
 {
     bus.Update_PBH(ex);
 }
Пример #11
0
 public void XoaPhieuBaoHanh(PhieuBaoHanh ex)
 {
     bus.XoaPhieuBaoHanh(ex);
 }
Пример #12
0
 public void ThemPBH(PhieuBaoHanh ex)
 {
     bus.ThemPBH(ex);
 }