Beispiel #1
0
        public ActionResult Create(DIEN dien)
        {
            if (ModelState.IsValid)
            {
                var dao = new QLDsModel();

                if (dao.Find(dien.MaDien) != null)
                {
                    SetAlert("Mã điện đã tồn tại", "error");
                    return(RedirectToAction("Create", "QLDs"));
                }

                String result = dao.Insert(dien);
                if (!String.IsNullOrEmpty(result))
                {
                    SetAlert("Thêm điện thành công", "success");
                    return(RedirectToAction("Index", "QLDs"));
                }
                else
                {
                    ModelState.AddModelError("", "Thêm điện không thành công");
                }
            }
            return(View());
        }
Beispiel #2
0
        //
        // GET: /QLDs/
        public ActionResult Index(string searchString)
        {
            var dien = new QLDsModel();

            if (searchString == "")
            {
                SetAlert("Vui lòng nhập nội dung tìm kiếm", "error");
            }
            var model = dien.ListWhereAll(searchString);

            @ViewBag.SearchString = searchString;
            return(View(model));
        }
Beispiel #3
0
        public double TinhTongTien()
        {
            QLDsModel   qld      = new QLDsModel();
            QLNsModel   qln      = new QLNsModel();
            HoaDonModel donModel = new HoaDonModel();
            double      tongTien = 0;

            if (qld.MaPhong == donModel.MaPhong && qln.MaPhong == donModel.MaPhong)
            {
                tongTien = ((qld.CSC - qld.CSD) * qld.DonGia) + ((qln.CSC - qln.CSD) * qln.DonGia);
                return(tongTien);
            }
            return(0);
        }
Beispiel #4
0
        public ActionResult Edit(DIEN dien)
        {
            if (ModelState.IsValid)
            {
                var dao = new QLDsModel();


                var result = dao.Update(dien);
                if (result == true)
                {
                    SetAlert("Cập thông tin điện thành công", "success");
                    return(RedirectToAction("Index", "QLDs"));
                }
                else
                {
                    ModelState.AddModelError("", "Cập nhật thông tin điện không thành công");
                }
            }
            return(View());
        }
Beispiel #5
0
        public ActionResult Edit(string maDien)
        {
            var dien = new QLDsModel().getByMaDien(maDien);

            return(View(dien));
        }