Beispiel #1
0
 public bool UpdateRoom(PHONG PHONGDAO)
 {
     try
     {
         PHONG u = dataContext.PHONGs.Where(p => p.id == PHONGDAO.id).SingleOrDefault();
         u.TenPhong   = PHONGDAO.TenPhong;
         u.SoLuongMay = PHONGDAO.SoLuongMay;
         u.GhiChu     = PHONGDAO.GhiChu;
         u.TrangThai  = PHONGDAO.TrangThai;
         dataContext.SaveChanges();
     }
     catch (DbEntityValidationException e)
     {
         foreach (var eve in e.EntityValidationErrors)
         {
             Debug.WriteLine("- Entity of type \"{0}\", in state \"{1}\" has the following validation errors: ", eve.Entry.Entity.GetType().Name, eve.Entry.State);
             foreach (var ve in eve.ValidationErrors)
             {
                 Debug.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage);
             }
         }
         return(false);
     }
     catch (Exception e)
     {
         Debug.WriteLine(e.Message);
         return(false);
     }
     return(true);
 }
Beispiel #2
0
        private void CommandBinding_Executed_themSV(object sender, ExecutedRoutedEventArgs e)
        {
            PHONG    k = (PHONG)cmbMaphong.SelectedItem;
            SINHVIEN a = new SINHVIEN();

            a.masv     = txtMasv.Text;
            a.maphong  = k.maphong;
            a.tensv    = txtTensv.Text;
            a.ngaysinh = dpNgaysinh.SelectedDate;
            if (rdoNam.IsChecked == true)
            {
                a.gioitinh = true;
            }
            else
            {
                a.gioitinh = false;
            }
            a.lop       = txtLop.Text;
            a.quequan   = txtQuequan.Text;
            a.dienthoai = txtDienthoai.Text;
            a.tinhtrang = true;

            xl.them(a);

            dgDSSVDango.ItemsSource = xl.getDSSinhienViewDango();
            dgDSSVDao.ItemsSource   = xl.getDSSinhienViewDao();
            QuanLyHopDong hd = new QuanLyHopDong();

            hd.txtMahd.Text = xlhd.taomahd(DateTime.Now, txtMasv.Text);
            hd.txtMasv.Text = txtMasv.Text;
            hd.Show();
        }
Beispiel #3
0
 public bool AddRoom(PHONG PHONG)
 {
     try
     {
         dataContext.PHONGs.Add(PHONG);
         dataContext.SaveChanges();
     }
     catch (DbUpdateException e)
     {
         Debug.WriteLine(e.ToString());
         return(false);
     }
     catch (DbEntityValidationException e)
     {
         foreach (var eve in e.EntityValidationErrors)
         {
             Debug.WriteLine("- Entity of type \"{0}\", in state \"{1}\" has the following validation errors: ", eve.Entry.Entity.GetType().Name, eve.Entry.State);
             foreach (var ve in eve.ValidationErrors)
             {
                 Debug.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage);
             }
         }
         return(false);
     }
     return(true);
 }
Beispiel #4
0
        private void CommandBinding_Executed_suaSV(object sender, ExecutedRoutedEventArgs e)
        {
            PHONG    k = (PHONG)cmbMaphong.SelectedItem;
            SINHVIEN a = new SINHVIEN();

            a.masv     = txtMasv.Text;
            a.maphong  = k.maphong;
            a.tensv    = txtTensv.Text;
            a.ngaysinh = dpNgaysinh.SelectedDate;
            if (rdoNam.IsChecked == true)
            {
                a.gioitinh = true;
            }
            else
            {
                a.gioitinh = false;
            }
            a.lop       = txtLop.Text;
            a.quequan   = txtQuequan.Text;
            a.dienthoai = txtDienthoai.Text;
            if (rdoDango.IsChecked == true)
            {
                a.tinhtrang = true;
            }
            else if (rdoDao.IsChecked == true)
            {
                a.tinhtrang = false;
            }

            xl.sua(a);

            dgDSSVDango.ItemsSource = xl.getDSSinhienViewDango();
            dgDSSVDao.ItemsSource   = xl.getDSSinhienViewDao();
        }
Beispiel #5
0
        private void btnPhong_Click(object sender, EventArgs e)
        {
            ButtonX btnPhong = sender as ButtonX;
            int     maPhong  = (int)btnPhong.Tag;
            PHONG   phong    = listPhong.SingleOrDefault(item => item.MaPhong == maPhong);

            if (phong != null)
            {
                txtMaPhong.Text   = phong.MaPhong.ToString();
                txtGhiChu.Text    = phong.GhiChu == null ? "" : phong.GhiChu.ToString();
                txtTienPhong.Text = phong.LOAIPHONG.DonGia.ToString();
                cboLoaiPhong.Text = phong.LOAIPHONG.TenLoaiPhong;
                cboTinhTrang.Text = phong.LOAITINHTRANG.TenLoaiTinhTrang;

                if (phong.LOAITINHTRANG.TenLoaiTinhTrang == "Đặt" || phong.LOAITINHTRANG.TenLoaiTinhTrang == "Có người ở")
                {
                    btnDatPhong.Enabled = false;
                }
                else
                {
                    btnDatPhong.Enabled = true;
                }

                if (phong.LOAITINHTRANG.TenLoaiTinhTrang == "Có người ở")
                {
                    btnThanhToan.Enabled = true;
                }
                else
                {
                    btnThanhToan.Enabled = false;
                }
            }
        }
Beispiel #6
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            if (txtMaPhong.Text == "")
            {
                MessageBoxEx.Show("Bạn phải chọn 1 phòng để chỉnh sửa", "Thông báo");
            }
            else
            {
                PHONG phong = new PHONG();
                phong.MaLoaiPhong     = (int)cboLoaiPhong.SelectedValue;
                phong.MaLoaiTinhTrang = (int)cboTinhTrang.SelectedValue;
                phong.GhiChu          = txtGhiChu.Text.Trim();

                int ketQua = PhongDAO.Instance.ChinhSuaPhong(phong);
                if (ketQua > 0)
                {
                    MessageBoxEx.Show("Chỉnh sửa phòng thành công", "Thông báo");
                    LoadDanhSachPhong();
                }
                else
                {
                    MessageBoxEx.Show("Chỉnh sửa phòng thất bại", "Thông báo");
                    LoadDanhSachPhong();
                }
            }
        }
Beispiel #7
0
 public bool DeleteRoom(int id)
 {
     try
     {
         PHONG u = dataContext.PHONGs.Single(p => p.id == id);
         dataContext.PHONGs.Remove(u);
     }
     catch (DbEntityValidationException e)
     {
         foreach (var eve in e.EntityValidationErrors)
         {
             Debug.WriteLine("- Entity of type \"{0}\", in state \"{1}\" has the following validation errors: ", eve.Entry.Entity.GetType().Name, eve.Entry.State);
             foreach (var ve in eve.ValidationErrors)
             {
                 Debug.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage);
             }
         }
         return(false);
     }
     catch (Exception e)
     {
         Debug.WriteLine(e.Message);
         return(false);
     }
     return(true);
 }
Beispiel #8
0
 public ActionResult ResultDoiPhong(String MAPHIEUDAT, String ma_phong_cu, String ma_phong_moi)
 {
     if (MAPHIEUDAT == null || ma_phong_cu == null || ma_phong_moi == null)
     {
         return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
     }
     try
     {
         PHIEUDATPHONG pdp = db.PHIEUDATPHONGs.Find(Int32.Parse(MAPHIEUDAT));
         PHONG         p   = db.PHONGs.Find(pdp.PHONG.MAPHONG); // lấy thông tin phòng cũ
         p.TINHTRANGPHONG  = 1;                                 // set phòng cũ về đang dọn
         db.Entry(p).State = EntityState.Modified;
         pdp.MAPHONG       = Int32.Parse(ma_phong_moi);         // đổi phòng cũ sang mới
         p = db.PHONGs.Find(Int32.Parse(ma_phong_moi));         // lấy thông tin phòng mới
         p.TINHTRANGPHONG    = 2;                               // set phòng mới về đang sd
         db.Entry(p).State   = EntityState.Modified;
         db.Entry(pdp).State = EntityState.Modified;
         db.SaveChanges();
         @ViewBag.NGAYRA = pdp.NGAYRA;
         ViewBag.result  = "success";
     }
     catch (Exception e)
     {
         ViewBag.result = "error: " + e;
     }
     return(View());
 }
Beispiel #9
0
            public List <BuildQuery.IQueryFilter> GetFilters()
            {
                var result = new List <IQueryFilter>();
                var refObj = new PHONG();

                if (!string.IsNullOrEmpty(this.MAPHONG))
                {
                    result.Add(new QueryFilterLinQ
                    {
                        Property = ClassHelper.GetProperty(() => refObj.MAPHONG),
                        Value    = this.MAPHONG,
                        Method   = FilterMethod.Like
                    });
                }
                if (!string.IsNullOrEmpty(this.MALOAIPHONG))
                {
                    result.Add(new QueryFilterLinQ
                    {
                        Property = ClassHelper.GetProperty(() => refObj.MALOAIPHONG),
                        Value    = this.MALOAIPHONG,
                        Method   = FilterMethod.Like
                    });
                }
                if (!string.IsNullOrEmpty(this.TENPHONG))
                {
                    result.Add(new QueryFilterLinQ
                    {
                        Property = ClassHelper.GetProperty(() => refObj.TENPHONG),
                        Value    = this.TENPHONG,
                        Method   = FilterMethod.Like
                    });
                }
                return(result);
            }
Beispiel #10
0
        public ActionResult Create(string loaiPh, string giaPh, string mieutaPh)
        {
            PHONG ph = new PHONG();

            ph.SOPHONG     = new GenerateIDPhongThue().generateIDPhong();
            ph.LOAIPHONG   = loaiPh;
            ph.GIAPHONG    = Convert.ToInt32(giaPh);
            ph.MIEUTAPHONG = mieutaPh;
            ph.TRANGTHAI   = "false";
            var exist = db.PHONGs.Where(x => x.SOPHONG == ph.SOPHONG).SingleOrDefault();

            if (exist == null)
            {
                try
                {
                    db.PHONGs.Add(ph);
                    db.SaveChanges();
                    return(Content("true"));
                }
                catch
                {
                    return(Content("false"));
                }
            }
            else
            {
                return(Content("false"));
            }
        }
 public void CheckTrangThaiPhong()
 {
     try
     {
         var listPhong            = db.PHONGs.ToList();
         var listChiTietPhieuThue = db.CHITIETPHIEUTHUEs.ToList();
         foreach (CHITIETPHIEUTHUE ct in listChiTietPhieuThue)
         {
             if ((ct.NgayThuePhong == DateTime.Now) && (ct.PHONG.LOAITINHTRANG.TenLoaiTinhTrang == "Đặt"))
             {
                 PHONG phong = listPhong.SingleOrDefault(item => item.MaPhong == ct.MaPhong);
                 if (phong != null)
                 {
                     phong.MaLoaiTinhTrang = 2; // Có người ở
                 }
             }
             if ((ct.NgayTraPhong < DateTime.Now) && (ct.PHONG.LOAITINHTRANG.TenLoaiTinhTrang == "Có người ở"))
             {
                 PHONG phong = listPhong.SingleOrDefault(item => item.MaPhong == ct.MaPhong);
                 if (phong != null)
                 {
                     phong.MaLoaiTinhTrang = 1; // trống
                 }
             }
         }
         db.SaveChanges();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #12
0
        public async Task <IActionResult> PutPHONG([FromRoute] string id, [FromBody] PHONG pHONG)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != pHONG.MAPHONG)
            {
                return(BadRequest());
            }

            _context.Entry(pHONG).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PHONGExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Beispiel #13
0
        public ActionResult Edit(PHONG phong)
        {
            if (ModelState.IsValid)
            {
                var dao = new PhongModel();

                var result = dao.Update(phong);
                try {
                    if (result)
                    {
                        SetAlert("Chỉnh sửa thông tin phòng thành công ", "success");
                        return(RedirectToAction("Index", "Phong"));
                    }
                    else
                    {
                        if (phong.SoCho > 8)
                        {
                            ModelState.AddModelError("", "Mỗi phòng chỉ có 8 chỗ!");
                        }
                        else
                        {
                            ModelState.AddModelError("", "Mã phòng không được sửa");
                        }
                    }
                }catch (Exception e)
                {
                }
            }
            return(View());
        }
Beispiel #14
0
        public ActionResult Themphong(FormCollection collection, PHONG phg)
        {
            ViewBag.Tang     = new SelectList(db.TANGs.ToList().OrderBy(n => n.Tang1), "Tang1", "Tang1");
            ViewBag.DienTich = new SelectList(db.TANGs.ToList().OrderBy(n => n.DienTich), "DienTich", "DienTich");
            ViewBag.Gia      = new SelectList(db.TANGs.ToList().OrderBy(n => n.Gia), "Gia", "Gia");
            var MaPhong  = collection["MaPHG"];
            var TenPhong = collection["TenPHG"];
            var Tang     = collection["Tang"];
            var DienTich = collection["DienTich"];
            var Gia      = collection["Gia"];

            if (String.IsNullOrEmpty(TenPhong))
            {
                ViewData["Loi1"] = "Tên phòng không được để trống";
            }
            else
            {
                phg.MaPHG    = Convert.ToInt32(MaPhong);
                phg.TenPHG   = TenPhong;
                phg.Tang     = Convert.ToInt32(Tang);
                phg.DienTich = Convert.ToInt32(DienTich);
                db.PHONGs.Add(phg);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(this.Themphong());
        }
Beispiel #15
0
        public String XoaP(String maP)
        {
            // Kiểm tra phòng có tồn tại không ?
            PHONG check = _p.TimPTheoMaP(maP);

            // Không tồn tại
            if (check == null)
            {
                return("Không tìm thấy dữ liệu cần xóa, xin vui lòng thử lại!");
            }
            // Tồn tại
            else
            {
                // Hàm xóa phòng
                PHONG result = _p.XoaP(check.MaPhong);
                // Kiểm tra kết quả của hàm xóa sinh viên
                if (result == null)
                {
                    return("Đã xảy ra lỗi trong quá trình xóa phòng, xin vui lòng thử lại!");
                }
                else
                {
                    return(null);
                }
            }
        }
Beispiel #16
0
        public async Task <IHttpActionResult> Delete(string id)
        {
            var   result   = new TransferObj <bool>();
            PHONG instance = await _service.Repository.FindAsync(id);

            if (instance == null)
            {
                return(NotFound());
            }
            try
            {
                _service.Delete(instance.ID);
                int del = await _service.UnitOfWork.SaveAsync();

                if (del > 0)
                {
                    result.Data    = true;
                    result.Status  = true;
                    result.Message = "Xóa thành công bản ghi";
                }
                else
                {
                    result.Data    = false;
                    result.Status  = false;
                    result.Message = "Thao tác không thành công";
                }
            }
            catch (Exception e)
            {
                result.Data    = false;
                result.Status  = false;
                result.Message = e.Message;
            }
            return(Ok(result));
        }
Beispiel #17
0
        private void icoBtnThem_Click(object sender, EventArgs e)
        {
            PHONG phong = getLastRoom();

            if (phong == null)
            {
                PHONG temp = new PHONG()
                {
                    MaPhong = "1501", MaLoaiPhong = cboLoaiphong.SelectedValue.ToString(), MaLoaiTinhTrangPhong = cboTinhtrang.SelectedValue.ToString(), GhiChu = txtGhichu.Text
                };
                context.PHONG.Add(temp);
                context.SaveChanges();
                loadData();
                MessageBox.Show("Thêm thành công!", "Thông báo");
            }
            else
            {
                string maMoi = convertNumbtoID(phong.MaPhong);
                PHONG  temp  = new PHONG()
                {
                    MaPhong = maMoi, MaLoaiPhong = cboLoaiphong.SelectedValue.ToString(), MaLoaiTinhTrangPhong = cboTinhtrang.SelectedValue.ToString(), GhiChu = txtGhichu.Text
                };
                context.PHONG.Add(temp);
                context.SaveChanges();
                loadData();
                MessageBox.Show("Thêm thành công!", "Thông báo");
            }
        }
Beispiel #18
0
        public ActionResult Chitiethopdong(int id, int id2)
        {
            HOPDONG        hopdong   = db.HOPDONGs.SingleOrDefault(n => n.MaHD == id);
            CHITIETHOPDONG cthopdong = db.CHITIETHOPDONGs.SingleOrDefault(n => n.MaHD == id);
            PHONG          phong     = db.PHONGs.SingleOrDefault(n => n.MaPHG == id);
            CONGTY         cty       = db.CONGTies.SingleOrDefault(n => n.MaCongTy == id2);


            ViewBag.MaHD         = hopdong.MaHD;
            ViewBag.MaPHG        = cthopdong.MaPHG;
            ViewBag.TenPHG       = phong.TenPHG;
            ViewBag.Tang         = phong.Tang;
            ViewBag.DienTich     = phong.DienTich;
            ViewBag.ThoiGianThue = cthopdong.ThoiGianThue;

            ViewBag.MaCongTy = cty.MaCongTy;
            ViewBag.TenCT    = cty.TenCT;

            if (hopdong == null)
            {
                Response.StatusCode = 404;
                return(null);
            }

            return(View(hopdong));
        }
Beispiel #19
0
 private void icoBtnXoa_Click(object sender, EventArgs e)
 {
     if (maPhongGlobal == "")
     {
         MessageBox.Show("Vui lòng chọn phòng cần xóa!", "Thông báo");
     }
     else
     {
         PHONG phong = context.PHONG.FirstOrDefault(p => p.MaPhong == maPhongGlobal);
         if (phong == null)
         {
             MessageBox.Show("Không tồn tại phòng này!", "Thông báo");
         }
         else
         {
             if (MessageBox.Show("Xác nhận xóa!", "Cảnh báo!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
             {
                 context.PHONG.Remove(phong);
                 context.SaveChanges();
                 loadData();
                 MessageBox.Show("Xóa thành công!", "Thông báo");
             }
         }
     }
 }
        private void icoBtnSua_Click(object sender, EventArgs e)
        {
            if (maPSGlobal == "")
            {
                MessageBox.Show("Chọn phiếu cần sửa!");
            }
            else
            {
                PHIEU_SUA_CHUA psc = context.PHIEU_SUA_CHUA.FirstOrDefault(p => p.MaPhieuSua == maPSGlobal);

                psc.MaNhanVien  = cboManhanvien.SelectedValue.ToString();
                psc.GhiChu      = txtGhichu.Text;
                psc.MaPhong     = cboMaphong.SelectedValue.ToString();
                psc.NgayBatDau  = DateTime.Parse(dtpBatDau.Text);
                psc.NgayKetThuc = DateTime.Parse(dtpKetthuc.Text);
                psc.NguyenNhan  = txtNguyennhan.Text;

                CHI_TIET_PHIEU_SUA_CHUA ct = context.CHI_TIET_PHIEU_SUA_CHUA.FirstOrDefault(p => p.MaPhieuSua == maPSGlobal);

                ct.PhiSuaChua = int.Parse(txtPhisuachua.Text);


                PHONG phong = context.PHONG.FirstOrDefault(p => p.MaPhong == cboMaphong.SelectedValue.ToString());
                phong.MaLoaiTinhTrangPhong = "TP002";
                context.SaveChanges();
                loadData();
                MessageBox.Show("Sửa thành công!");
            }
        }
 private void buttonThem_Click(object sender, EventArgs e)
 {
     using (QUANLYKHACHSANEntities db = new QUANLYKHACHSANEntities())
     {
         PHONG phong = new PHONG()
         {
             MaPhong     = textBoxMaPhong.Text,
             SoPhong     = textBoxTenPhong.Text,
             TrangThai   = comboBoxTrangThai.Text,
             MaLoaiPhong = textBoxMaLoaiPhong.Text,
         };
         if (db.PHONGs.Select(p => p.MaPhong).Contains(textBoxMaPhong.Text))
         {
             MessageBox.Show("Mã phòng đã tồn tại!!!");
             return;
         }
         if (db.PHONGs.Select(p => p.SoPhong).Contains(textBoxTenPhong.Text))
         {
             MessageBox.Show(" Phòng đã tồn tại!!!");
             return;
         }
         db.PHONGs.Add(phong);
         db.SaveChanges();
         MessageBox.Show("Thêm phòng thành công");
         LoadPhong(dataGridViewPhong);
     }
 }
 private void LoadDuLieuHoaDon()
 {
     phongThue        = PhongDAO.Instance.LoadChiTietPhong(Common.phongThue.MaPhong);
     chiTietPhieuThue = ThuePhongDAO.Instance.LoadChiTietPhongThue(phongThue.MaPhong);
     listDichVu       = DichVuDAO.Instance.LoadAllDichVu();
     listLoaiPhong    = LoaiPhongDAO.Instance.LoadAllLoaiPhong();
     LoadDataLenControl();
 }
Beispiel #23
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            PHONG phong = PhongBLL.Get(p => p.Sophong == txtSP.Text);

            PhongBLL.Delete(phong);
            ClearpanelDSPhong();
            LoadPhong();
        }
Beispiel #24
0
        private void LoadDuLieuThuePhong()
        {
            phongThue     = PhongDAO.Instance.LoadChiTietPhong(Common.phongThue.MaPhong);
            listNhanVien  = NhanVienDAO.Instance.LoadAllNhanVien();
            listKhachHang = KhachHangDAO.Instance.LoadAllKhachHang();

            BindingData();
        }
        public ActionResult PhongDeleteConfirmed(string id)
        {
            PHONG pHONG = db.PHONGs.Find(id);

            db.PHONGs.Remove(pHONG);
            db.SaveChanges();
            return(RedirectToAction("PhongIndex"));
        }
Beispiel #26
0
        private void btn_xacnhan_Click(object sender, EventArgs e)
        {
            DialogResult res;

            res = MessageBox.Show("Xác nhận trả phòng!", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
            if (res == DialogResult.Yes)
            {
                try
                {
                    int    position = gridView_traphong.FocusedRowHandle;
                    string m        = gridView_traphong.GetRowCellValue(position, "Makt").ToString();
                    string n        = gridView_traphong.GetRowCellValue(position, "Mahd").ToString();

                    HOPDONG hd = new HOPDONG();
                    hd.MAHD      = n;
                    hd.TINHTRANG = false;

                    KHACHTHUE kt = new KHACHTHUE();
                    kt.MAKT      = m;
                    kt.TINHTRANG = false;

                    if (hopdong.sua_tinhtrangHopDong(hd) == true)
                    {
                        dal_sm.updatetinhtrangKT(hd.MAHD);

                        grv_traphong.DataSource = traphong.LoadTraPhong();
                    }
                    else
                    {
                        MessageBox.Show("Thất bại");
                    }
                    PHONG p = new PHONG();
                    p.MAPHONG    = txt_maphong.Text;
                    p.TINHTRANG  = false;
                    p.SOLUONG_HT = 0;

                    if (phong.sua_slhientai(p) == true)
                    {
                        MessageBox.Show(" thành công");
                    }
                    else
                    {
                        MessageBox.Show("Sữa slht thất bại");
                    }
                }
                catch
                {
                    MessageBox.Show("Lỗi !!!");
                }

                frm_traphong_Load(sender, e);
                txt_slhientai.Text = "0";
            }
            else
            {
                return;
            }
        }
 public ActionResult Edit([Bind(Include = "MaPhong,TenLoaiPHong,HienTrang,SoNguoi,SoDTPhong")] PHONG pHONG)
 {
     if (ModelState.IsValid)
     {
         db.Entry(pHONG).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(pHONG));
 }
Beispiel #28
0
 public ActionResult Edit([Bind(Include = "SOPHONG,LOAIPHONG,GIAPHONG")] PHONG pHONG)
 {
     if (ModelState.IsValid)
     {
         db.Entry(pHONG).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(pHONG));
 }
Beispiel #29
0
        //Lay phong cuoi
        public PHONG getLastRoom()
        {
            PHONG        tb   = null;
            List <PHONG> list = context.PHONG.ToList();

            foreach (var temp in list)
            {
                tb = temp;
            }
            return(tb);
        }
Beispiel #30
0
        public ActionResult Chitietphong(int id)
        {
            PHONG phg = db.PHONGs.SingleOrDefault(n => n.MaPHG == id);

            ViewBag.MaPHG = phg.MaPHG;
            if (phg == null)
            {
                Response.StatusCode = 404;
            }
            return(View(phg));
        }