public ActionResult Create([Bind(Include = "MaPhieuChi,NgayChi,NoiDung,SoTien,Flag")] PhieuChi phieuChi)
        {
            if (ModelState.IsValid)
            {
                var dal = new PhieuChi_DAL();

                phieuChi.MaPhieuChi = dal.AutoID();

                phieuChi.Flag = true;

                db.PhieuChi.Add(phieuChi);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(phieuChi));
        }
예제 #2
0
        public ActionResult Create([Bind(Include = "MaGiai,TenGiai,SoTienNhan,Flag")] Giai giai)
        {
            if (ModelState.IsValid)
            {
                var dal = new Giai_DAL();

                giai.MaGiai = dal.AutoID();

                giai.Flag = true;

                db.Giai.Add(giai);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(giai));
        }
예제 #3
0
        public ActionResult Create([Bind(Include = "MaLoaiVeSo,Tinh,GiaBan,Flag")] LoaiVeso loaiVeso)
        {
            if (ModelState.IsValid)
            {
                var dal = new LoaiVeSo_DAL();

                loaiVeso.MaLoaiVeSo = dal.AutoID();

                loaiVeso.Flag = true;

                db.LoaiVeso.Add(loaiVeso);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(loaiVeso));
        }
        public ActionResult Create([Bind(Include = "MaPhieuThu,MaDaiLy,NgayNop,SoTienNop,Flag")] PhieuThu phieuthu)
        {
            if (ModelState.IsValid)
            {
                var dal = new PhieuThu_DAL();

                phieuthu.MaPhieuThu = dal.AutoID();

                phieuthu.Flag = true;

                db.PhieuThu.Add(phieuthu);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.MaDaiLy = new SelectList(db.DaiLy, "MaDaiLy", "TenDaiLy", phieuthu.MaDaiLy);
            return(View(phieuthu));
        }
        public ActionResult Create([Bind(Include = "MaCongNo,MaDaiLy,NgayNo,SoTienNo,Flag")] CongNo congno)
        {
            if (ModelState.IsValid)
            {
                var dal = new CongNo_DAL();

                congno.MaCongNo = dal.AutoID();

                congno.Flag = true;

                db.CongNo.Add(congno);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.MaDaiLy = new SelectList(db.DaiLy, "MaDaiLy", "TenDaiLy", congno.MaDaiLy);
            return(View(congno));
        }
        public ActionResult Create([Bind(Include = "MaSoLuongDK,MaDaiLy,NgayDK,SoLuongDK1,Flag")] SoLuongDK sldk)
        {
            if (ModelState.IsValid)
            {
                var dal = new SLDangKy_DAL();

                sldk.MaSoLuongDK = dal.AutoID();

                sldk.Flag = true;

                db.SoLuongDK.Add(sldk);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.MaDaiLy = new SelectList(db.DaiLy, "MaDaiLy", "TenDaiLy", sldk.MaDaiLy);
            return(View(sldk));
        }
예제 #7
0
        public ActionResult Create([Bind(Include = "MaKetQua,MaLoaiVeSo,MaGiai,NgaySo,SoTrung,Flag")] KetQuaSoXo ketQuaSoXo)
        {
            if (ModelState.IsValid)
            {
                var dal = new KetQuaSoXo_DAL();

                ketQuaSoXo.MaKetQua = dal.AutoID();

                ketQuaSoXo.Flag = true;

                db.KetQuaSoXo.Add(ketQuaSoXo);
                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);
        }
        public ActionResult Create([Bind(Include = "MaDaiLy,TenDaiLy,DiaChi,SDT")] DaiLyModel daily)
        {
            if (ModelState.IsValid)
            {
                DaiLy dl = new DaiLy();
                dl.TenDaiLy = daily.TenDaiLy;
                dl.SDT      = daily.SDT;
                dl.DiaChi   = daily.DiaChi.DuongSoNha + ", " + daily.DiaChi.PhuongXa + ", " + daily.DiaChi.QuanHuyen + ", " + daily.DiaChi.TinhTP;

                var dal = new DaiLy_DAL();
                dl.MaDaiLy = dal.AutoID();
                dl.Flag    = true;
                db.DaiLy.Add(dl);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(daily));
        }
예제 #9
0
        public ActionResult Create([Bind(Include = "MaPhatHanh,MaDaiLy,MaLoaiVeSo,SoLuong,NgayNhan,SLBan,DoanhThuDPH,HoaHong,TienThanhToan,Flag")] PhatHanh phatHanh)
        {
            //So luong de xuat: tinh dua tren SoLuongDK
            //So luong duoc dang ký
            if (ModelState.IsValid)
            {
                var dal = new PhatHanh_DAL();

                phatHanh.MaPhatHanh = dal.AutoID();
                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 < 0.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));
                    }
                }
                phatHanh.DoanhThuDPH = dal.CalcDoanhThu(phatHanh.MaLoaiVeSo, Convert.ToInt32(phatHanh.SLBan));

                phatHanh.TienThanhToan = dal.CalcTienThanhToan(Convert.ToDecimal(phatHanh.DoanhThuDPH), Convert.ToDecimal(phatHanh.HoaHong));

                phatHanh.Flag = true;

                db.PhatHanh.Add(phatHanh);
                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));
        }