Esempio n. 1
0
        public ActionResult DatHang()
        {
            //Kiem tra dang nhap
            if (Session["TaiKhoan"] != null)
            {
                PQ_Chucvu kh = (PQ_Chucvu)Session["TaiKhoan"];
                ViewBag.TenKH = "Chào  " + kh.HoTen;
                ViewBag.MaKH  = kh.MaKH;
                ViewBag.CV    = kh.Chucvu;
            }
            else
            {
                return(RedirectToAction("Dangnhap", "User"));
            }
            if (Session["Giohang"] == null)
            {
                return(RedirectToAction("Index", "LatopSore"));
            }

            //Lay gio hang tu Session
            List <Giohang> lstGiohang = Laygiohang();

            ViewBag.Tongsoluong = TongSoLuong();
            ViewBag.Tongtien    = TongTien();

            return(View(lstGiohang));
        }
Esempio n. 2
0
        // GET: Trangchu

        public ActionResult Trangchu(FormCollection fc, int?page)
        {
            int pageNum  = (page ?? 1);
            int pageSize = 6;

            if (Session["Taikhoan"] != null)
            {
                PQ_Chucvu kh = (PQ_Chucvu)Session["Taikhoan"];
                ViewBag.TenKH = "Chào  " + kh.HoTen;
                ViewBag.MaKH  = kh.MaKH;
                ViewBag.CV    = kh.Chucvu;
            }
            //Nút tìm kiếm---------------------------------------
            string tk = fc["Search"];

            if (tk != null && tk != "")
            {
                var fullnh = (from n in data.NUOCHOAs where n.TenNH.ToUpper().Contains(tk.ToUpper()) select n).ToList();
                return(View(fullnh.ToPagedList(pageNum, pageSize)));
            }
            //-----------------------------------------------
            //hiển thị tất cả sản phẩm của cửa hàng
            else
            {
                var fullnh = (from n in data.NUOCHOAs select n).ToList();
                return(View(fullnh.ToPagedList(pageNum, pageSize)));
            }
            //--------------------------------------------------------
        }
Esempio n. 3
0
        //Hiện thị thông tin khách hàng và lihcj sử mua hàng
        public ActionResult ThongtinKH(FormCollection fc)
        {
            if (Session["Taikhoan"] != null)
            {
                PQ_Chucvu kh = (PQ_Chucvu)Session["Taikhoan"];
                ViewBag.TenKH = "Chào  " + kh.HoTen;
                ViewBag.MaKH  = kh.MaKH;
                ViewBag.ht    = kh.HoTen;
                ViewBag.dt    = kh.DienthoaiKH;
                ViewBag.dc    = kh.DiachiKH;
                ViewBag.email = kh.Email;
                ViewBag.ns    = kh.Ngaysinh;
                ViewBag.CV    = kh.Chucvu;

                int tk     = kh.MaKH;
                var fullnh = (from n in data.thongtinKHs where n.MaKH == tk select n).ToList();
                return(View(fullnh));
            }
            //--------------------------------------------------------
            else
            {
                ViewBag.thongbao = "Đăng nhập trước khi xem nhé";
                return(View());
            }
        }
Esempio n. 4
0
        public ActionResult DangNhap(FormCollection collection)
        {
            // Gán các giá trị người dùng nhập liệu cho các biến
            var tendn   = collection["Taikhoan"];
            var matkhau = collection["Matkhau"];

            if (String.IsNullOrEmpty(tendn))
            {
                ViewData["Loi1"] = "Phải nhập tên đăng nhập";
            }
            else if (String.IsNullOrEmpty(matkhau))
            {
                ViewData["Loi2"] = "Phải nhập mật khẩu";
            }
            else
            {
                //Gán giá trị cho đối tượng được tạo mới (kh)
                PQ_Chucvu kh = data.PQ_Chucvus.SingleOrDefault(n => n.Taikhoan == tendn && n.Matkhau == matkhau);
                if (kh != null)
                {
                    ViewBag.Thongbao    = "Chúc mừng đăng nhập thành công";
                    Session["Taikhoan"] = kh;
                }
                else
                {
                    ViewBag.Thongbao = "Tên đăng nhập hoặc mật khẩu không đúng";
                }
            }
            return(RedirectToAction("Trangchu", "Trangchu"));
        }
Esempio n. 5
0
 public ActionResult Xacnhandonhang()
 {
     if (Session["TaiKhoan"] != null)
     {
         PQ_Chucvu kh = (PQ_Chucvu)Session["Taikhoan"];
         ViewBag.TenKH = "Chào  " + kh.HoTen;
         ViewBag.MaKH  = kh.MaKH;
         ViewBag.CV    = kh.Chucvu;
     }
     return(View());
 }
Esempio n. 6
0
        public ActionResult SPTheoLoai(int id /*,int ? page*/)
        {
            //int pageSize = 6;
            //int pageNum = (page ?? 1);
            if (Session["Taikhoan"] != null)
            {
                PQ_Chucvu kh = (PQ_Chucvu)Session["Taikhoan"];
                ViewBag.TenKH = "Chào  " + kh.HoTen;
                ViewBag.MaKH  = kh.MaKH;
                ViewBag.CV    = kh.Chucvu;
            }
            var nuochoa = from lt in data.NUOCHOAs where lt.MaLoai == id select lt;

            return(View(nuochoa /*.ToPagedList(pageNum, pageSize)*/));
        }
Esempio n. 7
0
        public ActionResult Details(int id)
        {
            if (Session["Taikhoan"] != null)
            {
                PQ_Chucvu kh = (PQ_Chucvu)Session["Taikhoan"];
                ViewBag.TenKH = "Chào  " + kh.HoTen;
                ViewBag.MaKH  = kh.MaKH;
                ViewBag.CV    = kh.Chucvu;
            }
            var nh = from s in data.NUOCHOAs
                     where s.MaNH == id
                     select s;

            return(View(nh.Single()));
        }
Esempio n. 8
0
        //Xay dung trang Gio hang
        public ActionResult GioHang()
        {
            if (Session["TaiKhoan"] != null)
            {
                PQ_Chucvu kh = (PQ_Chucvu)Session["Taikhoan"];
                ViewBag.TenKH = "Chào  " + kh.HoTen;
                ViewBag.MaKH  = kh.MaKH;
                ViewBag.CV    = kh.Chucvu;
            }
            List <Giohang> lstGiohang = Laygiohang();

            if (lstGiohang.Count == 0)
            {
                return(RedirectToAction("Trangchu", "Trangchu"));
            }
            ViewBag.Tongsoluong = TongSoLuong();
            ViewBag.Tongtien    = TongTien();
            return(View(lstGiohang));
        }