Exemple #1
0
        public static IEnumerable <DonDatHang> DanhSach()
        {
            var db   = new SmartShopConnectionDB();
            var dsDH = db.Query <DonDatHang>("select * from DonDatHang");
            List <DonDatHang> model = new List <DonDatHang>();

            /* foreach (var item in dsCL)
             * {
             *   viewMenu clvm = new viewMenu();
             *   clvm.MaCL = item.MaCL;
             *   clvm.TenCL = item.TenCL;
             *   clvm.dsLoai = db.Query<Loai>("select * from Loai where MaCL=@0", item.MaCL);
             *   model.Add(clvm);
             * }*/
            return(db.Query <DonDatHang>("SELECT * FROM DonDatHang"));
        }
Exemple #2
0
        public static IEnumerable <viewMenu> Menu()
        {
            var db = new SmartShopConnectionDB();
            //return db.Query<viewMenu>("SELECT * FROM viewMenu");

            var             dsCL  = db.Query <viewMenu>("select chungloai.MaCL,chungloai.TenCL from chungloai");
            List <viewMenu> model = new List <viewMenu>();

            foreach (var item in dsCL)
            {
                viewMenu clvm = new viewMenu();
                clvm.MaCL   = item.MaCL;
                clvm.TenCL  = item.TenCL;
                clvm.dsLoai = db.Query <Loai>("select * from Loai where MaCL=@0", item.MaCL);
                model.Add(clvm);
            }
            return(model);
        }
Exemple #3
0
        public static IEnumerable <DonDatHang> DsDHUs(string id)
        {
            var db   = new SmartShopConnectionDB();
            var dsDH = db.Query <DonDatHang>("select * from DonDatHang where Username=@0 ORDER BY NgayDatHang DESC", id);
            List <DonDatHang> model = new List <DonDatHang>();

            foreach (var item in dsDH)
            {
                DonDatHang dh = new DonDatHang();
                dh.MaDH        = item.MaDH;
                dh.Username    = item.Username;
                dh.NgayDatHang = item.NgayDatHang;
                dh.HoTen       = item.HoTen;
                dh.GhiChu      = item.GhiChu;
                dh.DiaChi      = item.DiaChi;
                dh.Email       = item.Email;
                dh.SDT         = item.SDT;
                dh.TinhTrang   = item.TinhTrang;
                dh.Tongtien    = item.Tongtien;
                dh.DsctDH      = db.Query <View_CTDH>("select * from [DAn_Web2].[dbo].[View_CTDH] where MaDH=@0", item.MaDH);
                model.Add(dh);
            }
            return(model);
        }
Exemple #4
0
        public static IEnumerable <DonDatHang> DanhSach()
        {
            var db   = new SmartShopConnectionDB();
            var dsDH = db.Query <DonDatHang>("select * from DonDatHang");
            List <DonDatHang> model = new List <DonDatHang>();

            foreach (var item in dsDH)
            {
                DonDatHang dh = new DonDatHang();
                dh.MaDH        = item.MaDH;
                dh.Username    = item.Username;
                dh.NgayDatHang = item.NgayDatHang;
                dh.HoTen       = item.HoTen;
                dh.GhiChu      = item.GhiChu;
                dh.DiaChi      = item.DiaChi;
                dh.Email       = item.Email;
                dh.SDT         = item.SDT;
                dh.TinhTrang   = item.TinhTrang;
                dh.Tongtien    = item.Tongtien;
                dh.DsctDH      = db.Query <View_CTDH>("select * from ChiTietDH where MaDH=@0", item.MaDH);
                model.Add(dh);
            }
            return(model);
        }
Exemple #5
0
        //
        // GET: /Cart/

        public ActionResult Index()
        {
            var           db    = new SmartShopConnectionDB();
            List <Cart>   ds_SP = new List <Cart>();
            List <string> sp    = new List <string>();

            sp = (List <string>)Session["sp_gh"];
            if (sp != null)
            {
                foreach (var item in sp)
                {
                    Cart sp_gh = new Cart();
                    sp_gh.dsSP = db.Query <Product>("select * from Product where MaSP=@0", item.ToString());
                    ds_SP.Add(sp_gh);
                }
            }
            return(View(ds_SP));
        }
Exemple #6
0
        public static IEnumerable <viewLoai> DanhSachView()
        {
            var db = new SmartShopConnectionDB();

            return(db.Query <viewLoai>("SELECT * FROM viewLoai"));
        }
Exemple #7
0
        public static IEnumerable <ChungLoai> DanhSach()
        {
            var db = new SmartShopConnectionDB();

            return(db.Query <ChungLoai>("SELECT * FROM chungloai"));
        }
Exemple #8
0
        public static IEnumerable <Image> DsTheoSP(string masp)
        {
            var db = new SmartShopConnectionDB();

            return(db.Query <Image>("SELECT * FROM Image where MaSP=@0", masp));
        }