Exemplo n.º 1
0
        public ActionResult thanh_toan(FormCollection fc)
        {
            Order order = new Order();

            order.id       = DateTime.Now.ToString("ddmmyyyyhhmmss");
            order.username = fc["username"];
            order.phone    = fc["phone"];
            order.email    = fc["email"];
            order.address  = fc["address"];
            order.date     = DateTime.Now;
            order.total    = fc["total"];
            order.sum      = fc["sum"];
            DAOOrder dao = new DAOOrder();

            dao.Add_order(order);

            List <CartItem> giohang = Session["giohang"] as List <CartItem>;

            foreach (var item in giohang)
            {
                Order_detail orderDetail = new Order_detail();
                orderDetail.image      = item.Hinh;
                orderDetail.name       = item.TenSanPham;
                orderDetail.quantity   = item.SoLuong;
                orderDetail.price      = item.DonGia;
                orderDetail.id_order   = order.id;
                orderDetail.product_id = item.SanPhamID;
                dao.order_detail(orderDetail);
            }

            TempData["msg"] = "INSERT SUCCESS";
            Session.Remove("giohang");
            return(RedirectToAction("dat_hang", "Home", new{ order_id = order.id }));
        }
Exemplo n.º 2
0
        public ActionResult chi_tiet_don_hang(string idi)
        {
            ViewBag.list_order = DAOOrder.show_hoadon(idi);
            DataSet ds = DAOOrder.show_order_byID(idi);

            ViewBag.show = ds.Tables[0];
            return(View());
        }
Exemplo n.º 3
0
        public ActionResult chinh_sua_donhang(string maDH)
        {
            DAOOrder dao = new DAOOrder();
            DataSet  ds  = dao.show_order_id(maDH);

            ViewBag.updateDH = ds.Tables[0];
            return(View());
        }
Exemplo n.º 4
0
        public ActionResult Dơn_hang(string user)
        {
            DAOOrder dao = new DAOOrder();
            DataSet  ds  = dao.show_order_byuser(user);

            ViewBag.showSP = ds.Tables[0];
            return(View());
        }
Exemplo n.º 5
0
        public ActionResult dat_hang(string order_id)
        {
            List <Order> list_order = DAOOrder.show_hoadon(order_id);

            ViewBag.list_order = list_order;

            DataSet ds = DAOOrder.show_order_byID(order_id);

            ViewBag.show = ds.Tables[0];
            return(View());
        }
Exemplo n.º 6
0
        public ActionResult chinh_sua_donhang(string maDH, FormCollection fc)
        {
            Order o = new Order();

            o.id     = maDH;
            o.status = fc["status"];
            o.date   = Convert.ToDateTime(fc["date"]);
            DAOOrder daoOrder = new DAOOrder();

            daoOrder.Update_order(o, maDH);
            return(RedirectToAction("QuanLyDonHang", "Admin"));
        }
Exemplo n.º 7
0
        public ActionResult del_oder(string idi)
        {
            if (DAOOrder.del_oder(idi))
            {
                new DaoLog().WARNING("success", "del_oder");
            }
            else
            {
                new DaoLog().WARNING("fail", "del_oder");
            }

            return(RedirectToAction("QuanLyDonHang", "Admin"));
        }
Exemplo n.º 8
0
        public ActionResult QuanLyDonHang()
        {
            List <Order> list_order = DAOOrder.show_quanlyhoadon();

            return(View(list_order));
        }