コード例 #1
0
ファイル: ThuePhongsController.cs プロジェクト: war-man/QLKS
        public ActionResult Edit([Bind(Include = "MaThuePhong,MaPhong,NgayBatDauThue")] ThuePhong thuePhong)
        {
            try {
                if (ModelState.IsValid)
                {
                    db.Entry(thuePhong).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                    return(View("SửaThànhCông"));
                }
            }

            catch
            {
                return(View("LỗiSửaTP"));
            }
            List <SelectListItem> tenPhong = new List <SelectListItem>();

            foreach (var item in db.Phong)
            {
                if (item.TinhTrang == false)
                {
                    tenPhong.Add(new SelectListItem
                    {
                        Text  = item.TenPhong,
                        Value = item.MaPhong.ToString()
                    });
                }
            }
            ViewBag.MaPhong = /*new SelectList(db.Phongs, "MaPhong", "MaPhong")*/ tenPhong;
            return(View(thuePhong));
        }
コード例 #2
0
        public ActionResult Edit([Bind(Include = "MaPhong,TenPhong,MaLoai,GhiChu,TinhTrang")] Phong phong)
        {
            List <SelectListItem> loaiPhong = new List <SelectListItem>();

            foreach (var item in db.LoaiPhong)
            {
                loaiPhong.Add(new SelectListItem
                {
                    Text  = item.TenLoai,
                    Value = Convert.ToString(item.MaLoai)
                });
            }
            ViewBag.LoaiPhong = loaiPhong;
            try
            {
                if (ModelState.IsValid)
                {
                    db.Entry(phong).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                    return(View("SửaPhòngTC"));
                }
            }
            catch
            {
                //return View("LỗiSửaPhòng");
            }
            return(View(phong));
        }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "MaDoanhThu,Thang,TongDoanhThu")] DoanhThu doanhThu)
 {
     if (ModelState.IsValid)
     {
         db.Entry(doanhThu).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(doanhThu));
 }
コード例 #4
0
 public ActionResult Edit([Bind(Include = "MaQuiDinh,TenQuiDinh,MoTa,ThamSo,ThamSoTien")] QuiDinh quiDinh)
 {
     if (ModelState.IsValid)
     {
         db.Entry(quiDinh).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("ThôngTinQuiĐịnh", new { id = Encryption.encrypt(quiDinh.MaQuiDinh.ToString()) }));
     }
     return(View(quiDinh));
 }
コード例 #5
0
ファイル: HDsController.cs プロジェクト: war-man/QLKS
        public ActionResult Edit([Bind(Include = "MaHD,MaKhachHang,MaNV,TongTien")] HD hD)
        {
            List <SelectListItem> tenKH = new List <SelectListItem>();

            foreach (var item in db.KhachHang)
            {
                tenKH.Add(new SelectListItem
                {
                    Text  = item.TenKhachHang,
                    Value = Convert.ToString(item.MaKhachHang)
                });
            }
            ViewBag.MaKH = /*new SelectList(db.KhachHangs, "MaKhachHang", "TenKhachHang")*/ tenKH;
            try
            {
                if (ModelState.IsValid)
                {
                    db.Entry(hD).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                    return(View("SửaThànhCôngHóaĐơn"));
                }
            }
            catch
            {
                return(View("LỗiKhiSửaHĐ"));
            }
            ViewBag.MaTP = new SelectList(db.ThuePhong, "MaThuePhong", "MaThuePhong", thuePhong.MaThuePhong);
            List <SelectListItem> tenNV = new List <SelectListItem>();

            foreach (var item in db.NV)
            {
                if (item.ChucVu.TenCV == "Ke Toan" || item.ChucVu.TenCV == "Ke Toan Truong")
                {
                    tenNV.Add(new SelectListItem
                    {
                        Text  = item.TenNV,
                        Value = Convert.ToString(item.MaNV)
                    });
                }
            }
            ViewBag.MaNV = tenNV;
            return(View(hD));
        }
コード例 #6
0
ファイル: ManageController.cs プロジェクト: war-man/QLKS
 public ActionResult Edit([Bind(Include = "Email,Pass,MaNV,Roles,NV")] TaiKhoan userprofile)
 {
     if (ModelState.IsValid)
     {
         db.Entry(userprofile).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("ThôngTinTàiKhoản", new { id = Encryption.encrypt(userprofile.MaNV.ToString()) }));
     }
     return(View(userprofile));
 }
コード例 #7
0
ファイル: TaiKhoansController.cs プロジェクト: war-man/QLKS
 public ActionResult Edit([Bind(Include = "Email,Pass,MaNV,Roles")] TaiKhoan taiKhoan)
 {
     if (ModelState.IsValid)
     {
         db.Entry(taiKhoan).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MaNV = new SelectList(db.NV, "MaNV", "TenNV", taiKhoan.MaNV);
     return(View(taiKhoan));
 }
コード例 #8
0
 public ActionResult Edit([Bind(Include = "MaKhachHang,TenKhachHang,MaLoaiKhach,DiaChi,CMND")] KhachHang khachHang)
 {
     if (ModelState.IsValid)
     {
         db.Entry(khachHang).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("ThôngTinKháchHàng", new { id = Encryption.encrypt(khachHang.MaKhachHang.ToString()) }));
     }
     ViewBag.MaLoaiKhach = new SelectList(db.LoaiKhach, "MaLoaiKhach", "TenLoaiKhach", khachHang.MaLoaiKhach);
     return(View(khachHang));
 }
コード例 #9
0
 public ActionResult Edit([Bind(Include = "MaThuePhong,MaKhachHang,SoLuongKhach")] ChiTietThuePhong chiTietThuePhong)
 {
     if (ModelState.IsValid)
     {
         db.Entry(chiTietThuePhong).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("ChiTiết", new { id = chiTietThuePhong.MaThuePhong, khachHang = chiTietThuePhong.MaKhachHang }));
     }
     ViewBag.MaKhachHang = new SelectList(db.KhachHang, "MaKhachHang", "TenKhachHang", chiTietThuePhong.MaKhachHang);
     ViewBag.MaThuePhong = new SelectList(db.ThuePhong, "MaThuePhong", "MaThuePhong", chiTietThuePhong.MaThuePhong);
     return(View(chiTietThuePhong));
 }
コード例 #10
0
 public ActionResult Edit([Bind(Include = "MaHD,MaThuePhong,NgayThanhToan,SoNgayThue,ThanhTien")] ChiTietHoaDon chiTietHoaDon)
 {
     if (ModelState.IsValid)
     {
         db.Entry(chiTietHoaDon).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MaHD        = new SelectList(db.HD, "MaHD", "MaHD", chiTietHoaDon.MaHD);
     ViewBag.MaThuePhong = new SelectList(db.ThuePhong, "MaThuePhong", "MaThuePhong", chiTietHoaDon.MaThuePhong);
     return(View(chiTietHoaDon));
 }
コード例 #11
0
ファイル: LoaiPhongsController.cs プロジェクト: war-man/QLKS
 public ActionResult Edit([Bind(Include = "MaLoai,TenLoai,Dongia")] LoaiPhong loaiPhong)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.Entry(loaiPhong).State = System.Data.Entity.EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("ThêmLoạiPhòngTC", new { id = Encryption.encrypt(loaiPhong.MaLoai.ToString()) }));
         }
     }
     catch
     {
         return(View("LỗiLoạiPhòng"));
     }
     return(View(loaiPhong));
 }
コード例 #12
0
 public ActionResult Edit([Bind(Include = "MaDoanhThu,LoaiPhong,DoanhThu,Tile")] ChiTietDoanhThu chiTietDoanhThu)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.Entry(chiTietDoanhThu).State = System.Data.Entity.EntityState.Modified;
             db.SaveChanges();
             return(View("SửaDoanhThuTC"));
         }
     }
     catch
     {
         return(View("LỗiSửaDoanhThu"));
     }
     return(View(chiTietDoanhThu));
 }
コード例 #13
0
 public ActionResult Edit([Bind(Include = "MaCV,TenCV")] ChucVu chucVu)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.Entry(chucVu).State = System.Data.Entity.EntityState.Modified;
             db.SaveChanges();
             return(View("SửaChứcVụThànhCông"));
         }
     }
     catch
     {
         return(View("LỗiChứcVụ"));
     }
     return(View(chucVu));
 }
コード例 #14
0
        public ActionResult Edit([Bind(Include = "MaNV,TenNV,MaCV,SDTNV,DCNV")] NV nV)
        {
            List <SelectListItem> selectList1 = new List <SelectListItem>();
            List <SelectListItem> selectList2 = new List <SelectListItem>();
            List <SelectListItem> selectList3 = new List <SelectListItem>();
            List <SelectListItem> selectList4 = new List <SelectListItem>();

            foreach (var item in db.ChucVu)
            {
                if (item.MaCV == 1)
                {
                    selectList1.Add(new SelectListItem
                    {
                        Text  = item.TenCV,
                        Value = item.MaCV.ToString()
                    });
                }
                else if (item.MaCV == 2 && item.MaCV != 1)
                {
                    selectList2.Add(new SelectListItem
                    {
                        Text  = item.TenCV,
                        Value = item.MaCV.ToString()
                    });
                }
                else if (item.MaCV == 3 && item.MaCV != 1 && item.MaCV != 2)
                {
                    selectList3.Add(new SelectListItem
                    {
                        Text  = item.TenCV,
                        Value = item.MaCV.ToString()
                    });
                }
                else if (item.MaCV != 1 || item.MaCV != 2 || item.MaCV != 3)
                {
                    selectList4.Add(new SelectListItem
                    {
                        Text  = item.TenCV,
                        Value = item.MaCV.ToString()
                    });
                }
            }
            ViewBag.TenCV1 = /*new SelectList(db.ChucVus, "MaCV", "TenCV")*/ selectList1;
            ViewBag.TenCV2 = /*new SelectList(db.ChucVus, "MaCV", "TenCV")*/ selectList2;
            ViewBag.TenCV3 = /*new SelectList(db.ChucVus, "MaCV", "TenCV")*/ selectList3;
            ViewBag.TenCV4 = /*new SelectList(db.ChucVus, "MaCV", "TenCV")*/ selectList4;
            try
            {
                if (ModelState.IsValid)
                {
                    db.Entry(nV).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                    return(View("SửaNVTC"));
                }
            }
            catch
            {
                return(View("LỗiSửaNV"));
            }
            return(View(nV));
        }