Exemplo n.º 1
0
        // GET: Admin/SanPham/Edit/5
        public ActionResult Edit(int id)
        {
            var rs = SanPhamBus.ChiTiet(id);
            List <CustomDropDownList> BiXoa = new List <CustomDropDownList>()
            {
                new CustomDropDownList {
                    Text = "Không Xóa", Value = 0
                },
                new CustomDropDownList {
                    Text = "Xóa", Value = 1
                }
            };
            List <CustomDropDownList> TinhTrang = new List <CustomDropDownList>()
            {
                new CustomDropDownList {
                    Text = "Còn Hàng", Value = 1
                },
                new CustomDropDownList {
                    Text = "Hết Hàng", Value = 0
                }
            };

            ViewBag.TinhTrang = new SelectList(TinhTrang, "Value", "Text");
            ViewBag.BiXoa     = new SelectList(BiXoa, "Value", "Text");
            ViewBag.MaHang    = new SelectList(HangBus.DanhSach(), "MaHang", "TenHang", rs.MaHang);
            ViewBag.MaLoai    = new SelectList(LoaiBus.DanhSach(), "MaLoai", "TenLoai", rs.MaLoai);
            return(View(rs));
        }
Exemplo n.º 2
0
        public ActionResult NhaSanXuat(int MaNSX)
        {
            var ds = SanPhamBus.SanPhambyNSX(MaNSX);

            ViewBag.NhaSanXuat = NhaSanXuatBus.ChiTiet(MaNSX);
            return(View(ds));
        }
Exemplo n.º 3
0
        public ActionResult Index()
        {
            var SanPhamBanChay = SanPhamBus.List(6, "ASC");

            ViewBag.SanPhamMoiVe = SanPhamBus.List(12, "DESC");
            return(View(SanPhamBanChay));
        }
Exemplo n.º 4
0
        // GET: Product
        public ActionResult Index(int id, int page = 1)
        {
            ViewBag.SanPhamBanChay = SanPhamBus.List(6, "ASC");
            var LisrProduct = SanPhamBus.GetProductByProductType(page, 3, id);

            return(View(LisrProduct));
        }
Exemplo n.º 5
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            SanPhamBus    bussp = new SanPhamBus();
            SanPhamEntity sp    = new SanPhamEntity();
            KetNoiCSDL    con   = new KetNoiCSDL();

            try
            {
                sp.MaSP    = con.SinhMa("SANPHAM", "SP");
                sp.TenSP   = txtTenSP.Text;
                sp.SoLuong = int.Parse(txtSoLuong.Text);
                sp.GiaBan  = int.Parse(txtGiaBan.Text);
                sp.GiaNhap = int.Parse(txtGiaNhap.Text);
                sp.MaLH    = cboLoaiHang.SelectedValue.ToString();
                sp.NhaCC   = cboNhaCC.SelectedValue.ToString();
                sp.NSX     = dtNgaySX.Value.ToString();
                sp.MoTa    = rtbMoTa.Text;
                sp.HinhAnh = null;
                bussp.ThemSanPham(sp);
                MessageBox.Show("Nhập hàng thành công", "Thông báo");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 6
0
        // GET: SanPham/Details/5
        public ActionResult Details(int id)
        {
            var ctSanPham = SanPhamBus.ChiTietSanPham(id);

            ViewBag.sanphamlienquan = SanPhamBus.ListSPLQ(id);
            return(View(ctSanPham));
        }
Exemplo n.º 7
0
        public ActionResult Index(int?page)
        {
            int pageNumber   = (page ?? 1);
            int itemsPerPage = 3;
            var DSSanPham    = SanPhamBus.DanhSach(pageNumber, itemsPerPage);

            return(View(DSSanPham));
        }
        // GET: Admin/SanPhamAdmin/Edit/5
        public ActionResult Edit(int id)
        {
            ViewBag.MaHang      = new SelectList(NhaSanXuatBus.DanhSach(), "MaHang", "TenHang");
            ViewBag.MaLoai      = new SelectList(LoaiSanPhamBus.DanhSach(), "MaLoai", "TenLoai");
            ViewBag.MaTinhTrang = new SelectList(TinhTrangSanPhamBus.DanhSach(), "MaTinhTrang", "TenTinhTrang");
            var db = SanPhamBus.ChiTiet(id);

            return(View(db));
        }
Exemplo n.º 9
0
        // GET: SanPham/Details/5
        public ActionResult Details(int id)
        {
            var sp  = SanPhamBus.ChiTiet(id);
            var nsx = NhaSanXuatBus.ChiTiet(sp.MaNSX);

            return(View(new SanPhamViewModels()
            {
                SanPham = sp, NhaSanXuat = nsx
            }));
        }
Exemplo n.º 10
0
        // GET: SanPham/Details/5
        public ActionResult Details(int id)
        {
            var ChiTietSP      = SanPhamBus.ChiTiet(id);
            var ChiTietLoaiSP  = LoaiBus.ChiTietViewModel(ChiTietSP.MaLoai);
            var ChitTietHangSP = HangBus.ChiTietViewModel(ChiTietSP.MaLoai);

            return(View(new SanPhamViewModel()
            {
                LoaiSP = ChiTietLoaiSP, HangSP = ChitTietHangSP, SanPham = ChiTietSP
            }));
        }
Exemplo n.º 11
0
        public ActionResult TimKiem(string SearchTerm)
        {
            var dsSanPham = SanPhamBus.HienThiDanhSachSanPham();

            if (!String.IsNullOrEmpty(SearchTerm))
            {
                dsSanPham = SanPhamBus.TimKiem(SearchTerm);
            }
            ViewBag.SearchTerm = SearchTerm;
            return(View(dsSanPham));
        }
Exemplo n.º 12
0
        // GET: SanPham/Details/5
        public ActionResult Details(int id)
        {
            var BinhLuan = BinhLuanBus.DanhSach(id);
            var ChiTiet  = SanPhamBus.ChiTiet(id);
            var data     = new SanPhamViewModels()
            {
                SanPham = ChiTiet, BinhLuanSP = BinhLuan
            };

            return(View(data));
        }
 public ActionResult Edit(int id, SanPham sp)
 {
     try
     {
         // TODO: Add update logic here
         SanPhamBus.Sua(id, sp);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
 public ActionResult Create(SanPham sp)
 {
     try
     {
         // TODO: Add insert logic here
         SanPhamBus.Them(sp);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Exemplo n.º 15
0
 public ActionResult Create(sanpham sp)
 {
     //try
     //{
     // TODO: Add insert logic here
     SanPhamBus.Them(sp);
     return(RedirectToAction("Index"));
     //}
     //catch
     //{
     //    return View();
     //}
 }
Exemplo n.º 16
0
 public ActionResult Delete(int id, FormCollection collection)
 {
     try
     {
         // TODO: Add delete logic here
         SanPhamBus.Xoa(id);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Exemplo n.º 17
0
        // GET: Product/Details/5
        public ActionResult Details(int id)
        {
            ViewBag.SanPhamBanChay = SanPhamBus.List(6, "ASC");

            var sp = SanPhamBus.Details(id);

            ViewBag.LSP = Models.LoaiSanPhamBus.LoaiSanPhamBus.DanhSach();

            ViewBag.SanPhamLienQuan = SanPhamBus.RelatedProductsDetails(id, 6, sp.LoaiSp);

            ViewBag.listimg = DanhSachHinh.danhsach(id);

            return(View(sp));
        }
Exemplo n.º 18
0
 public ActionResult Create(SanPham sp)
 {
     if (HttpContext.Request.Files.Count > 0)
     {
         var hpf = HttpContext.Request.Files[0];
         if (hpf.ContentLength > 0)
         {
             string fileName             = Guid.NewGuid().ToString();
             string fullPathWithFileName = "/ShopOnline/img/" + fileName + ".jpg";
             hpf.SaveAs(Server.MapPath(fullPathWithFileName));
             sp.HinhAnh = fileName + ".jpg";
         }
     }
     SanPhamBus.Them(sp);
     return(RedirectToAction("Index"));
 }
Exemplo n.º 19
0
        public ActionResult Create(SanPham sp)
        {
            {
                // TODO: Add insert logic here
                //Hàm thêm
                if (HttpContext.Request.Files.Count > 0)
                {
                }

                var hpf = HttpContext.Request.Files[0];
                if (hpf.ContentLength > 0)
                {
                    string fileName              = Guid.NewGuid().ToString();
                    string fileName1             = Guid.NewGuid().ToString();
                    string fileName2             = Guid.NewGuid().ToString();
                    string fileName3             = Guid.NewGuid().ToString();
                    string fileName4             = Guid.NewGuid().ToString();
                    string fullPathWithFileName  = "/Assets/img/products/" + fileName + ".jpg";
                    string fullPathWithFileName1 = "/Assets/img/products/" + fileName + ".jpg";
                    string fullPathWithFileName2 = "/Assets/img/products/" + fileName + ".jpg";
                    string fullPathWithFileName3 = "/Assets/img/products/" + fileName + ".jpg";
                    string fullPathWithFileName4 = "/Assets/img/products/" + fileName + ".jpg";
                    hpf.SaveAs(Server.MapPath(fullPathWithFileName));
                    hpf.SaveAs(Server.MapPath(fullPathWithFileName1));
                    hpf.SaveAs(Server.MapPath(fullPathWithFileName2));
                    hpf.SaveAs(Server.MapPath(fullPathWithFileName3));
                    hpf.SaveAs(Server.MapPath(fullPathWithFileName4));
                    sp.HinhAnh  = fullPathWithFileName;
                    sp.HinhAnh1 = fullPathWithFileName1;
                    sp.HinhAnh2 = fullPathWithFileName2;
                    sp.HinhAnh3 = fullPathWithFileName3;
                    sp.HinhAnh4 = fullPathWithFileName4;
                }
            }
            sp.TinhTrang = 0;
            SanPhamBus.ThemSP(sp);
            return(RedirectToAction("Index"));
        }
Exemplo n.º 20
0
        public ActionResult Edit(int id, SanPham sp)
        {
            var db = new MobileShopConnectionDB();
            var rs = db.SingleOrDefault <MobileShopConnection.SanPham>("select HinhAnh from sanpham where MaSP=@0", id);

            if (HttpContext.Request.Files.Count > 0)
            {
                var hpf = HttpContext.Request.Files[0];
                if (hpf.ContentLength > 0)
                {
                    string fileName             = Guid.NewGuid().ToString();
                    string fullPathWithFileName = "/ShopOnline/img/" + fileName + ".jpg";
                    hpf.SaveAs(Server.MapPath(fullPathWithFileName));
                    sp.HinhAnh = fileName + ".jpg";
                }
                else
                {
                    sp.HinhAnh = rs.HinhAnh;
                }
            }
            SanPhamBus.Sua(sp);
            return(RedirectToAction("Index"));
        }
Exemplo n.º 21
0
        // GET: Home
        public ActionResult Index(int page = 1)
        {
            var dsSanPham = SanPhamBus.DanhSach(page, 6);

            return(View(dsSanPham));
        }
Exemplo n.º 22
0
 public ActionResult Restore(int id)
 {
     SanPhamBus.KhoiPhuc(id);
     return(RedirectToAction("Deleted"));
 }
Exemplo n.º 23
0
        public ActionResult Deleted(int Page = 1)
        {
            var DsSanPham = SanPhamBus.PageDanhSachDaXoa(Page, 10);

            return(View(DsSanPham));
        }
Exemplo n.º 24
0
        // GET: Admin/SanPham/Details/5
        public ActionResult Details(int id)
        {
            var ChiTiet = SanPhamBus.ChiTiet(id);

            return(View(ChiTiet));
        }
Exemplo n.º 25
0
        // GET: Admin/SanPham/Delete/5
        public ActionResult Delete(int id)
        {
            var rs = SanPhamBus.ChiTiet(id);

            return(View(rs));
        }
Exemplo n.º 26
0
        // GET: Admin/SanPham
        public ActionResult Index(int Page = 1)
        {
            var DsSanPham = SanPhamBus.PageDanhSach(Page, 10);

            return(View(DsSanPham));
        }
Exemplo n.º 27
0
        // GET: SanPham
        public ActionResult Index()
        {
            var dsSanPham = SanPhamBus.DanhSach();

            return(View(dsSanPham));
        }
Exemplo n.º 28
0
 public ActionResult Index()
 {
     return(View(SanPhamBus.List()));
 }
Exemplo n.º 29
0
 public ActionResult Details(int id)
 {
     return(View(SanPhamBus.ChiTiet(id)));
 }
Exemplo n.º 30
0
        // GET: SanPham
        public ActionResult Index()
        {
            var DSSanPham = SanPhamBus.DanhSach(2, 3);

            return(View(DSSanPham));
        }