Exemplo n.º 1
0
        //
        // GET: /QLNs/
        public ActionResult Index(string searchString)
        {
            var nuoc = new QLNsModel();

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

            var model = nuoc.ListWhereAll(searchString);

            @ViewBag.SearchString = searchString;
            return(View(model));
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
 public ActionResult Edit(NUOC nuoc)
 {
     if (ModelState.IsValid)
     {
         var dao    = new QLNsModel();
         var result = dao.Update(nuoc);
         if (result)
         {
             SetAlert("Cập nhật thông tin nước thành công", "success");
             return(RedirectToAction("Index", "QLNs"));
         }
         else
         {
             ModelState.AddModelError("", "Cập nhật thông tin nước không thành công");
         }
     }
     return(View());
 }
Exemplo n.º 4
0
 public ActionResult Create(NUOC nuoc)
 {
     if (ModelState.IsValid)
     {
         var dao = new QLNsModel();
         if (dao.Find(nuoc.MaNuoc) != null)
         {
             SetAlert("Mã nước đã tồn tại", "error");
             return(RedirectToAction("Create", "QLNs"));
         }
         String result = dao.Insert(nuoc);
         if (!String.IsNullOrEmpty(result))
         {
             SetAlert("Thêm nước thành công", "success");
             return(RedirectToAction("Index", "QLNs"));
         }
         else
         {
             ModelState.AddModelError("", "Thêm nước không thành công");
         }
     }
     return(View());
 }
Exemplo n.º 5
0
        public ActionResult Edit(string maNuoc)
        {
            var nuoc = new QLNsModel().getByMaNuoc(maNuoc);

            return(View(nuoc));
        }