Ejemplo n.º 1
0
        // GET: Admin/NhapHang
        public ActionResult Index(bool all = true)
        {
            var listProduct = new SanPhamDAO().GetListProduct(all);

            ViewBag.countBill = countncc(listProduct);
            ViewBag.ChedoView = all;
            return(View(listProduct));
        }
        public ActionResult DaDuyet(string searchString, int page = 1, int pageSize = 5)
        {
            var dao   = new SanPhamDAO();
            var model = dao.DanhSachSPDaDuyet(searchString, page, pageSize);

            ViewBag.searchstring = searchString;
            return(View(model));
        }
Ejemplo n.º 3
0
        public ActionResult XemChiTiet(int?maSP)
        {
            SanPhamDAO    dao = new SanPhamDAO();
            XemSanPhamBus b   = new XemSanPhamBus();

            //ViewBag.ChiTietsp = dao.Lay1SP(maSP).ChiTietSP;
            return(View(b.Lay1SP(maSP)));
        }
Ejemplo n.º 4
0
        public DataTable GetTable()
        {
            SanPhamDAO sd = new SanPhamDAO();
            DataTable  dt = new DataTable();

            dt = SanPhamDAO.GetTable();
            return(dt);
        }
Ejemplo n.º 5
0
        //public ActionResult Index(int searchString, int page = 1, int pageSize = 5)
        //{
        //    ViewBag.DanhMuc = new SanPhamDAO().ListAll();
        //    var dao = new SanPhamDAO();
        //    var model = new SanPhamDAO().DanhSachSanPham(searchString,page,pageSize);



        //    return View(model);
        //}



        public ActionResult SanPham(String searchString, long id, int page = 1, int pageSize = 9)
        {
            ViewBag.DanhMuc = new SanPhamDAO().ListAll();
            var dao   = new SanPhamDAO();
            var model = new SanPhamDAO().DanhSachSanPham(searchString, id, page, pageSize);

            return(View(model));
        }
Ejemplo n.º 6
0
        public DataTable LayBangDanhMuc(int madm)
        {
            SanPhamDAO sd = new SanPhamDAO();
            DataTable  dt = new DataTable();

            dt = SanPhamDAO.LayBangDanhMuc(madm);
            return(dt);
        }
 public static Boolean Update(SanPhamDTO sanPhamDTO)
 {
     if (SanPhamDAO.IsExist(sanPhamDTO.TenSP))
     {
         return(SanPhamDAO.Update(sanPhamDTO));
     }
     return(false);
 }
 public static Boolean Delete(String maSP)
 {
     if (SanPhamDAO.IsExist(maSP))
     {
         return(SanPhamDAO.Delete(maSP));
     }
     return(false);
 }
 public static Boolean Insert(SanPhamDTO sanPhamDTO)
 {
     if (!SanPhamDAO.IsExist(sanPhamDTO.TenSP))
     {
         return(SanPhamDAO.Insert(sanPhamDTO));
     }
     return(false);
 }
Ejemplo n.º 10
0
 public static int ThemSP(SanPhamDTO dto)
 {
     if (SanPhamDAO.KiemTraTonTai(dto.MaSP))
     {
         return(-1);
     }
     return(SanPhamDAO.ThemSP(dto));
 }
Ejemplo n.º 11
0
        public JsonResult ThayDoiTrangThai(long id)
        {
            var result = new SanPhamDAO().ThayDoiTrangThai(id);

            return(Json(new
            {
                trangthai = result
            }));
        }
Ejemplo n.º 12
0
        public JsonResult ChangeStatus(long id)
        {
            var result = new SanPhamDAO().ChangeStatus(id);

            return(Json(new
            {
                status = result
            }));
        }
Ejemplo n.º 13
0
        public ActionResult XemTruoc(long id)
        {
            SanPhamDAO pr    = new SanPhamDAO();
            var        model = pr.ChiTietByID(id);

            pr.ThemLuotView(id);
            ViewBag.vb_size = new CoDAO().ListSizeByIDProduct(id);
            return(View(model));
        }
Ejemplo n.º 14
0
        public ActionResult Filter()
        {
            var result = new SanPhamDAO().GetListProduct();

            return(Json(new
            {
                status = result
            }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 15
0
        public ActionResult Detail(long id)
        {
            var dao = new SanPhamDAO().ViewDetail(id);

            ViewBag.Category       = new CategoryDAO().ViewDetail(dao.LOAISANPHAM_ID);
            ViewBag.RelatedProduct = new SanPhamDAO().GetListRelatedProducts(id);
            ViewBag.ListImage      = new SanPhamDAO().GetListImagetId(id);
            return(View(dao));
        }
Ejemplo n.º 16
0
 public void SetUp()
 {
     sanphamDAO = new SanPhamDAO();
     this.sp1   = new SanPhamDTO("1", "Sữa tắm mướt lông", "CSCM", "30", "6000", "30000");
     this.sp2   = new SanPhamDTO("2", "Áo tắm", "DDCM", "10", "20000", "80000");
     this.sp3   = new SanPhamDTO("3", "Thuốc an thần", "DPCM", "15", "60000", "180000");
     this.sp4   = new SanPhamDTO("4", "Áo quần Adidas", "PKCM", "30", "150000", "130000");
     this.sp5   = new SanPhamDTO("5", "Ngũ cốc hoàng gia", "TACM", "30", "150000", "450000");
 }
Ejemplo n.º 17
0
 private void btSaveFood_Click(object sender, EventArgs e)
 {
     if (tbFood.Text != "" && numPrice.Value > 0)
     {
         DTO.Food newFood = new DTO.Food(-1, tbFood.Text, Convert.ToInt32(cbCategory.SelectedValue.ToString()), (float)numPrice.Value);
         SanPhamDAO.InsertSanPham(newFood);
         DisplayProductTreeView();
     }
 }
Ejemplo n.º 18
0
        // GET: Admin/Product

        public ActionResult Index(string searching)
        {
            getNCC();
            getTypeProduct();
            var dao   = new SanPhamDAO();
            var model = dao.GetListProduct();

            return(View(model));
        }
Ejemplo n.º 19
0
        public ActionResult Edit(long id)
        {
            var dao     = new SanPhamDAO();
            var content = dao.ViewDetail(id);

            LoadDanhMuc(content.DanhMucID);

            return(View(content));
        }
        public ActionResult Detail(int id)
        {
            var product = new SanPhamDAO().chiTietSanPham(id);

            ViewBag.Category  = new DanhMucSPDAO().viewDetail(product.IDDanhMuc.Value);
            ViewBag.MoreImage = new HinhAnhSPDAO().ListByProductID(product.ID);
            ViewBag.SPComment = new SanPhamCommentDAO().ListAll(product.ID);
            return(View(product));
        }
Ejemplo n.º 21
0
        // GET: TrangChu
        public ActionResult Index()
        {
            var dao = new SanPhamDAO();

            ViewBag.KhuyenMais  = dao.GetListKhuyenMai();
            ViewBag.NewProducts = dao.GetListNew(20);
            GetListBannerGiua();
            return(View());
        }
Ejemplo n.º 22
0
        public ActionResult CapNhat(long id)
        {
            var pr = new SanPhamDAO().ChiTietByID(id);

            ViewBag.vb_anhdaidien = pr.AnhDaiDien;
            GetCateGoryForCreateProduct();
            LayDanhSachHang();
            return(View(pr));
        }
        public ActionResult Muahang(int id)
        {
            SanPhamDAO     db = new SanPhamDAO();
            var            ds = db.LaySP();
            List <GioHang> gh = null;

            if (Session["GioHang"] == null)
            {
                GioHang a  = new GioHang();
                Sanpham sp = db.LaySP().SingleOrDefault(s => s.MaSP == id);
                if (sp != null)
                {
                    a.ID     = sp.MaSP;
                    a.Name   = sp.TenSP;
                    a.SL     = 1;
                    a.DonGia = (float)sp.GiaBan;
                    a.Image  = sp.AnhSP;
                    gh       = new List <GioHang>();
                    gh.Add(a);
                    Session["GioHang"] = gh;
                }
            }
            else
            {
                gh = (List <GioHang>)Session["GioHang"];
                var test = gh.Find(s => s.ID == id);
                if (test == null)
                {
                    GioHang a  = new GioHang();
                    var     sp = db.LaySP().Where(s => s.MaSP == id).Single();
                    a.ID     = sp.MaSP;
                    a.Name   = sp.TenSP;
                    a.SL     = 1;
                    a.DonGia = (float)sp.GiaBan;
                    a.Image  = sp.AnhSP;
                    gh.Add(a);
                }
                else
                {
                    test.SL = int.Parse(test.SL.ToString()) + 1;
                }
                Session["GioHang"] = gh;
            }
            float tongtien = 0;
            int   soluong  = 0;

            if (gh != null)
            {
                foreach (GioHang sp in gh)
                {
                    tongtien += sp.SL * sp.DonGia;
                }
                soluong = gh.Count;
            }
            return(Json(new { GioHang = gh, tongtien = tongtien, soluong = soluong }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 24
0
        public ActionResult Index(string tenmh, string gia, string sl, HttpPostedFileBase anhbia, HttpPostedFileBase anh1, HttpPostedFileBase anh2, int loai, int nsx, int km, DateTime ngay, string mota)
        {
            if (Session["TaiKhoan"] != null)
            {
                var tk = Session["TaiKhoan"] as KhachHang;


                if (tk.LoaiTK == "Khách Hàng")
                {
                    return(View("../Home/Index"));
                }
                else
                {
                    SanPhamDAO dao = new SanPhamDAO();
                    if (Session["UpdateMH"] == null)
                    {
                        int rs = dao.AdđoChoi(tk.MaKH, tenmh, gia, sl, anhbia, anh1, anh2, loai, nsx, km, ngay, mota);
                        if (rs == 1)
                        {
                            ViewBag.Gia = "Giá phải lớn hơn 0";
                        }
                        else if (rs == 2)
                        {
                            ViewBag.SL = "Số lượng phải lớn hơn bằng 0";
                        }
                        else
                        {
                            Session["ListMH"] = dao.GetList();
                        }
                    }
                    else
                    {
                        var mh = Session["UpdateMH"] as SanPham;
                        var rs = dao.UpdateDoChoi(tk.MaKH, mh.MaSP, tenmh, gia, sl, anhbia, anh1, anh2, loai, nsx, km, ngay, mota);
                        if (rs == 1)
                        {
                            ViewBag.Gia = "Giá phải lớn hơn 0";
                        }
                        else if (rs == 2)
                        {
                            ViewBag.SL = "Số lượng phải lớn hơn bằng 0";
                        }
                        else
                        {
                            Session["ListMH"]   = dao.GetList();
                            Session["UpdateMH"] = null;
                        }
                    }
                    return(View("Index"));
                }
            }
            else
            {
                return(View("../DangNhap/Index"));
            }
        }
Ejemplo n.º 25
0
        public ActionResult DungCu()
        {
            Session["CTBrand"]     = null;
            Session["CTKhuyenMai"] = null;
            SanPhamDAO dao = new SanPhamDAO();

            Session["Title"]    = "Dụng Cụ Mô Hình";
            Session["Products"] = dao.GetListToolAll();
            return(RedirectToAction("Index", "MoHinhs"));
        }
Ejemplo n.º 26
0
        public ActionResult Reset()
        {
            Session["CTBrand"]     = null;
            Session["CTKhuyenMai"] = null;
            SanPhamDAO dao = new SanPhamDAO();

            Session["Title"]    = "Tất Cả";
            Session["Products"] = dao.GetList();
            return(RedirectToAction("Index", "MoHinhs"));
        }
Ejemplo n.º 27
0
 public ActionResult Create(SanPham sanpham)
 {
     if (ModelState.IsValid)
     {
         SanPhamDAO.Insert(sanpham);
         return(RedirectToAction("Index"));
     }
     setViewBagLoaiSP();
     return(View());
 }
 public static bool CapNhatSoLuongTonKho(string masp, string SizeGiay, int soluongdamua)
 {
     if (SanPhamDAO.CapNhatTonkho(masp, SizeGiay, soluongdamua))
     {
         return(true);
     }
     {
         return(false);
     }
 }
Ejemplo n.º 29
0
        public ActionResult ChiTietSanPham(string url)
        {
            SanPhamDAO sp = new SanPhamDAO();

            var model = sp.laySanPhamTheoURL(url);

            ViewBag.DanhSachHinhAnh = sp.loadMoreImages(model.ID);

            return(View(model));
        }
Ejemplo n.º 30
0
        public JsonResult ListName(string q)
        {
            var data = new SanPhamDAO().ListName(q);

            return(Json(new
            {
                data = data,
                status = true
            }, JsonRequestBehavior.AllowGet));
        }