Exemplo n.º 1
0
        public bool SuaLoaiDia(LoaiDia loaiDia)
        {
            string query  = "UPDATE dbo.LoaiDia SET TenLoai = N'" + loaiDia.TenLoai + "' WHERE MaSo = " + loaiDia.MaSo;
            int    result = DataProvider.Instance.ExecuteNonQuery(query);

            return(result > 0);
        }
Exemplo n.º 2
0
        private bool KiemTraLoaiDia(string maloaidia)
        {
            LoaiDia loaidia = db.LoaiDias.Where(x => x.MaLoaiDia == maloaidia).FirstOrDefault();

            if (loaidia != null)
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 3
0
        public string LayTenLoaiDiaTheoMaLoai(string maloaidia)
        {
            LoaiDia loaidia = db.LoaiDias.Where(x => x.MaLoaiDia == maloaidia).FirstOrDefault();

            if (loaidia == null)
            {
                return(null);
            }
            return(loaidia.TenLoaiDia);
        }
        public ActionResult Create(LoaiDia loaidia)
        {
            if (ModelState.IsValid)
            {
                db.LoaiDias.Add(loaidia);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(loaidia);
        }
Exemplo n.º 5
0
        public int ThietLapThoiGianThue(eLoaiDia loaiDia)
        {
            if (!KiemTraLoaiDia(loaiDia.maLoai))
            {
                return(0);
            }
            LoaiDia loaidia = db.LoaiDias.Where(x => x.MaLoaiDia.Equals(loaiDia.maLoai)).FirstOrDefault();

            loaidia.ThoiGianThue = loaiDia.thoiGianThue;
            db.SubmitChanges();
            return(1);
        }
Exemplo n.º 6
0
        public eLoaiDia LayLoaiDiaTheoMa(string ma)
        {
            LoaiDia loai = db.LoaiDias.Where(x => x.MaLoaiDia.Equals(ma)).FirstOrDefault();

            if (loai != null)
            {
                eLoaiDia eloai = new eLoaiDia();
                eloai.maLoai       = loai.MaLoaiDia;
                eloai.tenLoai      = loai.TenLoaiDia;
                eloai.thoiGianThue = loai.ThoiGianThue;
                eloai.giaThue      = loai.GiaThue;
                eloai.giaPhat      = loai.GiaPhat;
                return(eloai);
            }
            return(null);
        }
Exemplo n.º 7
0
        public eLoaiDia LayLoaiDiaTheoDia(eDia dia)
        {
            TieuDe td = db.TieuDes.Where(x => x.MaTieuDe.Equals(dia.Matieude)).FirstOrDefault();

            if (td != null)
            {
                LoaiDia loai = db.LoaiDias.Where(x => x.MaLoaiDia.Equals(td.MaLoaiDia)).FirstOrDefault();
                if (loai != null)
                {
                    eLoaiDia eloai = new eLoaiDia();
                    eloai.maLoai       = loai.MaLoaiDia;
                    eloai.tenLoai      = loai.TenLoaiDia;
                    eloai.thoiGianThue = loai.ThoiGianThue;
                    eloai.giaThue      = loai.GiaThue;
                    eloai.giaPhat      = loai.GiaPhat;
                    return(eloai);
                }
            }
            return(null);
        }
 public ActionResult Edit(LoaiDia loaidia)
 {
     if (ModelState.IsValid)
     {
         db.Entry(loaidia).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(loaidia);
 }
Exemplo n.º 9
0
        public decimal LayGia(string id)
        {
            LoaiDia loaidia = db.LoaiDias.Where(x => x.MaLoai == id).FirstOrDefault();

            return(loaidia.GiaThue);
        }
Exemplo n.º 10
0
        public int SoNgayChoPhepThue(string id)
        {
            LoaiDia loaidia = db.LoaiDias.Where(x => x.MaLoai == id).FirstOrDefault();

            return(loaidia.ThoiGianChoPhepThue);
        }
Exemplo n.º 11
0
        public string GetTenLoaiByID(string id)
        {
            LoaiDia loaidia = db.LoaiDias.Where(x => x.MaLoai == id).FirstOrDefault();

            return(loaidia.TenLoai);
        }
Exemplo n.º 12
0
 public bool SuaLoaiDia(LoaiDia loaiDia)
 {
     return(LoaiDiaDAO.Instance.SuaLoaiDia(loaiDia));
 }