Beispiel #1
0
        public ActionResult CreateCtPn(Pn item, IEnumerable <Ctpn> lst)
        {
            try
            {
                SanPham sp;
                foreach (var x in lst)
                { // cap nhap so luong
                    sp = SanPhamMager.GetSanPhamByID(x.MaSp);
                    if (PhieuNhapMager.ktthamso(x.MaSp, x.SoLuong) == true)
                    {
                        sp.SoLuongTon = sp.SoLuongTon + x.SoLuong;
                        SanPhamMager.uppdateSanPham(sp);
                        x.MaPN  = item.MaPN;
                        x.TenSP = sp.TenSp;
                    }

                    else
                    {
                        return(PartialView("error"));
                        //return Content("<script>  alert(\"" + x.SanPham.TenSp + " da bi loi \")+  location.reload(); </script>");
                    }
                }
                CtPnMager.insertall(lst);
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View("error"));
            }
        }
Beispiel #2
0
 public ActionResult Delete(int id)
 {
     if (Ktdangnhap() == true)
     {
         return(View(PhieuNhapMager.GetItemById(id)));
     }
     else
     {
         return(RedirectToAction("Index"));
     }
 }
Beispiel #3
0
        [HttpPost]  // xoa san pham , luu tt nhan vien xoa
        public ActionResult Delete(int id, FormCollection f)
        {
            try
            {
                PhieuNhapMager.delete(id);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(RedirectToAction("Delete", id));
            }
        }
Beispiel #4
0
 public ActionResult Create(Pn item)
 {
     PhieuNhapMager.insert(item);
     return(RedirectToAction("CreateCtPn", item));
 }
Beispiel #5
0
        // GET: NhapHang
        public ActionResult Index()
        {
            List <Pn> lst = PhieuNhapMager.getAll();

            return(View(lst));
        }