예제 #1
0
        public ActionResult Create([Bind(Include = "MaHDTC,IDSIM,TuNgay,DenNgay,PhiHangThang,TongTien,NgayXuat,ThanhToan,Flag")] HoaDonTinhCuoc hoaDonTinhCuoc)
        {
            if (ModelState.IsValid)
            {
                db.HoaDonTinhCuocs.Add(hoaDonTinhCuoc);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.IDSIM = new SelectList(db.ThongTinSIMs, "IDSIM", "SoDienThoai", hoaDonTinhCuoc.IDSIM);
            return(View(hoaDonTinhCuoc));
        }
예제 #2
0
        private void dvHoaDonChuaThanhToan_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            int dong = e.RowIndex;

            if (dong >= 0)
            {
                DataGridViewRow row = dvHoaDonChuaThanhToan.Rows[e.RowIndex];

                hdtc = db.HoaDonTinhCuoc.Find(row.Cells["MaHDTC"].Value.ToString());

                sim_cat = db.ThongTinSIM.Find(row.Cells["IDSIM"].Value.ToString());
            }
        }
예제 #3
0
 public bool CapNhatThanhToan(int mahd)
 {
     try
     {
         HoaDonTinhCuoc hd = db.HoaDonTinhCuocs.Find(mahd);
         hd.ThanhToan = true;
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
예제 #4
0
        // GET: HoaDonTinhCuocs/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HoaDonTinhCuoc hoaDonTinhCuoc = db.HoaDonTinhCuocs.Find(id);

            if (hoaDonTinhCuoc == null)
            {
                return(HttpNotFound());
            }
            return(View(hoaDonTinhCuoc));
        }
예제 #5
0
        // GET: HoaDonTinhCuocs/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HoaDonTinhCuoc hoaDonTinhCuoc = db.HoaDonTinhCuocs.Find(id);

            if (hoaDonTinhCuoc == null)
            {
                return(HttpNotFound());
            }
            ViewBag.IDSIM = new SelectList(db.ThongTinSIMs, "IDSIM", "SoDienThoai", hoaDonTinhCuoc.IDSIM);
            return(View(hoaDonTinhCuoc));
        }
예제 #6
0
        // GET: HoaDonTinhCuocs/Details/5
        public ActionResult Details(string id, DateTime date)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            //var chitiet = db.ChiTietSuDungs.Where(i => i.IDSIM == id);
            HoaDonTinhCuoc hoaDonTinhCuoc = db.HoaDonTinhCuocs.Find(id);

            if (hoaDonTinhCuoc == null)
            {
                return(HttpNotFound());
            }
            return(View(hoaDonTinhCuoc));
        }
        private void xoa_Click(object sender, EventArgs e)
        {
            HoaDonTinhCuoc hdtc = db.HoaDonTinhCuoc.Find(tbxMaHDTC.Text);

            DialogResult rs = MessageBox.Show("Bạn có muốn xóa " + hdtc.MaHDTC + " ?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (rs == DialogResult.Yes)
            {
                hdtc.Flag = false;

                db.Entry(hdtc).State = EntityState.Modified;
                db.SaveChanges();

                Clear();
            }
        }