コード例 #1
0
        public ActionResult Edit([Bind(Include = "MaKetQua,MaLoaiVeSo,MaGiai,NgaySo,SoTrung,Flag")] KetQuaSoXo ketQuaSoXo)
        {
            if (ModelState.IsValid)
            {
                ketQuaSoXo.Flag = true;

                db.Entry(ketQuaSoXo).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            ViewBag.MaGiai = new SelectList(db.Giai, "MaGiai", "TenGiai", ketQuaSoXo.MaGiai);
            ViewBag.MaLoaiVeSo = new SelectList(db.LoaiVeso, "MaLoaiVeSo", "Tinh", ketQuaSoXo.MaLoaiVeSo);
            return View(ketQuaSoXo);
        }
コード例 #2
0
        public ActionResult Edit([Bind(Include = "MaPhatHanh,MaDaiLy,MaLoaiVeSo,SoLuong,NgayNhan,SLBan,DoanhThuDPH,HoaHong,TienThanhToan,Flag")] PhatHanh phatHanh)
        {
            if (ModelState.IsValid)
            {
                phatHanh.Flag = true;

                var sl = db.SoLuongDK.Where(x => x.MaDaiLy == phatHanh.MaDaiLy && x.Flag == true).OrderByDescending(x => x.NgayDK).Take(1).FirstOrDefault().SoLuongDK1;
                if (phatHanh.SoLuong == null)
                {
                    phatHanh.SoLuong = sl;
                }
                else
                {
                    double tk = thongke(phatHanh.MaDaiLy);
                    if (tk < 75 && phatHanh.SoLuong > sl)
                    {
                        //Error
                        ModelState.AddModelError(string.Empty, "Phần trăm doanh số của đại lý này là " + tk + ". Không thể tăng số lượng vé số phát hành");
                        return(View(phatHanh));
                    }
                }

                db.Entry(phatHanh).State = EntityState.Modified;

                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.MaDaiLy    = new SelectList(db.DaiLy, "MaDaiLy", "TenDaiLy", phatHanh.MaDaiLy);
            ViewBag.MaLoaiVeSo = new SelectList(db.LoaiVeso, "MaLoaiVeSo", "Tinh", phatHanh.MaLoaiVeSo);
            return(View(phatHanh));
        }
コード例 #3
0
        public ActionResult Edit([Bind(Include = "MaPhieuChi,NgayChi,NoiDung,SoTien,Flag")] PhieuChi phieuChi)
        {
            if (ModelState.IsValid)
            {
                phieuChi.Flag = true;

                db.Entry(phieuChi).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(phieuChi));
        }
コード例 #4
0
        public ActionResult Edit([Bind(Include = "MaGiai,TenGiai,SoTienNhan,Flag")] Giai giai)
        {
            if (ModelState.IsValid)
            {
                giai.Flag = true;

                db.Entry(giai).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(giai));
        }
コード例 #5
0
        public ActionResult Edit([Bind(Include = "MaDaiLy,TenDaiLy,DiaChi,SDT,Flag")] DaiLy daily)
        {
            if (ModelState.IsValid)
            {
                daily.Flag = true;

                db.Entry(daily).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(daily));
        }
コード例 #6
0
        public ActionResult Edit([Bind(Include = "MaLoaiVeSo,Tinh,GiaBan,Flag")] LoaiVeso loaiVeso)
        {
            if (ModelState.IsValid)
            {
                loaiVeso.Flag = true;

                db.Entry(loaiVeso).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(loaiVeso));
        }
コード例 #7
0
        public ActionResult Edit([Bind(Include = "MaCongNo,MaDaiLy,NgayNo,SoTienNo,Flag")] CongNo congno)
        {
            if (ModelState.IsValid)
            {
                congno.Flag = true;

                db.Entry(congno).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.MaDaiLy = new SelectList(db.DaiLy, "MaDaiLy", "TenDaiLy", congno.MaDaiLy);
            return(View(congno));
        }
コード例 #8
0
        public ActionResult Edit([Bind(Include = "MaPhieuThu,MaDaiLy,NgayNop,SoTienNop,Flag")] PhieuThu phieuthu)
        {
            if (ModelState.IsValid)
            {
                phieuthu.Flag = true;

                db.Entry(phieuthu).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.MaDaiLy = new SelectList(db.DaiLy, "MaDaiLy", "TenDaiLy", phieuthu.MaDaiLy);
            return(View(phieuthu));
        }
コード例 #9
0
        public ActionResult Edit([Bind(Include = "MaSoLuongDK,MaDaiLy,NgayDK,SoLuongDK1,Flag")] SoLuongDK sldk)
        {
            if (ModelState.IsValid)
            {
                sldk.Flag = true;

                db.Entry(sldk).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.MaDaiLy = new SelectList(db.DaiLy, "MaDaiLy", "TenDaiLy", sldk.MaDaiLy);
            return(View(sldk));
        }