Ejemplo n.º 1
0
        public IActionResult ThongTinDiaChi()
        {
            string      sessionval  = HttpContext.Session.GetString("TenDangNhap");
            TaiKhoanBUS taikhoanbus = new TaiKhoanBUS();
            TaiKhoan    taikhoan    = new TaiKhoan();

            if (sessionval != "" && sessionval != null)
            {
                taikhoan = taikhoanbus.CheckTaiKhoan(sessionval);
            }
            else
            {
                taikhoan = null;
            }

            HangSanPhamBUS     hangsanphambus = new HangSanPhamBUS();
            List <HangSanPham> hang           = hangsanphambus.GetHangSanPhams();

            TinhThanhBUS     tinhthanhbus = new TinhThanhBUS();
            List <TinhThanh> tinhthanh    = tinhthanhbus.GetTinhThanhs();

            DiaChiBUS     diachibus = new DiaChiBUS();
            List <DiaChi> diachi    = new List <DiaChi>();

            if (taikhoan != null)
            {
                diachi = diachibus.GetDiaChisCus(taikhoan.TenDangNhap);
            }

            ViewBag.Hang      = hang;
            ViewBag.TinhThanh = tinhthanh;
            ViewBag.DiaChi    = diachi;
            return(View(taikhoan));
        }
Ejemplo n.º 2
0
        public IActionResult DonMua(string tinhtrang)
        {
            if (tinhtrang == null || tinhtrang == "")
            {
                tinhtrang = "Chưa xử lý";
            }
            else
            {
                switch (tinhtrang)
                {
                case "danggiao":
                    tinhtrang = "Đang giao";
                    break;

                case "dangxuly":
                    tinhtrang = "Đang xử lý";
                    break;

                case "daxuly":
                    tinhtrang = "Đã xử lý";
                    break;

                case "dahuy":
                    tinhtrang = "Đã huỷ";
                    break;
                }
            }

            string                sessionval         = HttpContext.Session.GetString("TenDangNhap");
            TaiKhoanBUS           taikhoanbus        = new TaiKhoanBUS();
            TaiKhoan              taikhoan           = new TaiKhoan();
            DonHangBUS            donhangbus         = new DonHangBUS();
            List <DonHang>        listdonhang        = new List <DonHang>();
            List <ChiTietDonHang> listchitietdonhang = new List <ChiTietDonHang>();

            if (sessionval != "" && sessionval != null)
            {
                taikhoan           = taikhoanbus.CheckTaiKhoan(sessionval);
                listdonhang        = donhangbus.GetDonHang(taikhoan.TenDangNhap, tinhtrang);
                listchitietdonhang = donhangbus.GetChiTietDonHang(taikhoan.TenDangNhap, tinhtrang);
            }
            else
            {
                taikhoan    = null;
                listdonhang = null;
            }
            HangSanPhamBUS     hangsanphambus = new HangSanPhamBUS();
            List <HangSanPham> hang           = hangsanphambus.GetHangSanPhams();

            ViewBag.Hang           = hang;
            ViewBag.TaiKhoan       = taikhoan;
            ViewBag.ChiTietDonHang = listchitietdonhang;
            return(View(listdonhang));
        }
Ejemplo n.º 3
0
        public IActionResult Search(string search, int?pagenumber)
        {
            pageNumber = pagenumber ?? 1;
            HangSanPhamBUS     hangsanphambus = new HangSanPhamBUS();
            List <HangSanPham> list           = hangsanphambus.Search(search, pageSize, pageNumber);
            List <HangSanPham> tong           = hangsanphambus.Search(search, pageSize);

            ViewBag.TrangHienTai = pageNumber;
            ViewBag.TongTrang    = TongTrang(tong);
            ViewBag.TrangThai    = "search";
            ViewBag.Search       = search;
            return(View("Index", list));
        }
Ejemplo n.º 4
0
        public IActionResult Sort(string sortorder, int?pagenumber)
        {
            pageNumber = pagenumber ?? 1;
            HangSanPhamBUS     hangsanphambus = new HangSanPhamBUS();
            List <HangSanPham> list           = hangsanphambus.Sort(sortorder, pageSize, pageNumber);
            List <HangSanPham> tong           = hangsanphambus.Sort(sortorder);

            ViewBag.TrangHienTai = pageNumber;
            ViewBag.TongTrang    = TongTrang(tong);
            ViewBag.TrangThai    = "sort";
            ViewBag.Sort         = sortorder;
            return(View("Index", list));
        }
Ejemplo n.º 5
0
        public IActionResult ChiTietDonMua(string id)
        {
            string                sessionval         = HttpContext.Session.GetString("TenDangNhap");
            TaiKhoanBUS           taikhoanbus        = new TaiKhoanBUS();
            TaiKhoan              taikhoan           = new TaiKhoan();
            DonHangBUS            donhangbus         = new DonHangBUS();
            DonHang               donhang            = new DonHang();
            List <ChiTietDonHang> listchitietdonhang = new List <ChiTietDonHang>();

            if (sessionval != "" && sessionval != null)
            {
                taikhoan           = taikhoanbus.CheckTaiKhoan(sessionval);
                donhang            = donhangbus.GetExactDonHang(id);
                listchitietdonhang = donhangbus.GetExactChiTietDonHang(id);
            }
            else
            {
                taikhoan = null;
                donhang  = null;
            }
            HangSanPhamBUS     hangsanphambus = new HangSanPhamBUS();
            List <HangSanPham> hang           = hangsanphambus.GetHangSanPhams();

            ViewBag.Hang           = hang;
            ViewBag.TaiKhoan       = taikhoan;
            ViewBag.ChiTietDonHang = listchitietdonhang;

            //Kiểm tra có  cho huỷ hay không
            bool huydonhang;
            List <ChiTietDonHang> listhuydon = listchitietdonhang.Where(c => c.TinhTrangChiTiet != "Chưa xử lý").ToList();

            if (listhuydon.Count == 0)
            {
                huydonhang = true;
            }
            else
            {
                huydonhang = false;
            }
            ViewBag.HuyDonHang = huydonhang;
            return(View(donhang));
        }
Ejemplo n.º 6
0
        public IActionResult DoiMatKhau()
        {
            string      sessionval  = HttpContext.Session.GetString("TenDangNhap");
            TaiKhoanBUS taikhoanbus = new TaiKhoanBUS();
            TaiKhoan    taikhoan    = new TaiKhoan();

            if (sessionval != "" && sessionval != null)
            {
                taikhoan = taikhoanbus.CheckTaiKhoan(sessionval);
            }
            else
            {
                taikhoan = null;
            }
            HangSanPhamBUS     hangsanphambus = new HangSanPhamBUS();
            List <HangSanPham> hang           = hangsanphambus.GetHangSanPhams();

            ViewBag.Hang = hang;
            return(View(taikhoan));
        }