//[HttpPost] //public ActionResult Create() //{ // return View(); //} public ActionResult Detail(string orderNo) { // 先获得订单对象 Order order = _orderBLL.GetOrderByOrderNo(orderNo); ViewBag.OrderNo = order.OrderNo; ViewBag.OrderStatus = order.Status; ViewBag.Status = order.Status == 0 ? "未完成" : (order.Status == 1 ? "已完成" : "已取消"); ViewBag.TotalPrice = order.TotalPrice; ViewBag.CreateTime = order.CreatedTime; ViewBag.Payway = order.PayWay == 0 ? "微信支付" : "余额支付"; // 获取订单配送状态 OrderStatus os = _orderStausBLL.GetOrderStatusByOrderId(order.Id); ViewBag.Logistical = os.Status; // 获取地址 Address address = _addressBLL.GetAddressById(order.AddressId); // 构造 AddressModel AddressModel ad = new AddressModel(); ad.City = address.City; ad.Consignee = address.Consignee; ad.County = address.County; ad.Detail = address.Detail; ad.Phone = address.Phone; ad.Province = address.Province; ViewData["address"] = ad; List <OrderDetail> odList = new List <OrderDetail>(); odList = _orderDetailBLL.GetOrderDetailByOrderNo(orderNo).ToList(); List <OrderDetailModel> odmList = new List <OrderDetailModel>(); foreach (var item in odList) { OrderDetailModel odm = new OrderDetailModel(item); odm.GoodsName = _goodsBLL.GetGoodsById(item.GoodsId).Name; odm.PicturePath = _goodsImagesBLL.GetPictureByGoodsId(item.GoodsId).ImagePath; odmList.Add(odm); } ViewData["OrderDetailModelList"] = odmList; ViewBag.TotalPrice = order.TotalPrice; return(View()); }
public ActionResult Index() { // 先获得推荐商品的索引 即商品的guid list IEnumerable <ReCommend> recommendList = _recommendBLL.GetAllReCommendListwithSortByTime(); List <GoodsModel> goodsModelList = new List <GoodsModel>(); foreach (var item in recommendList) { Goods goods = _goodsBLL.GetGoodsById(item.GoodsId); if (goods == null) { LogHelper.Log.Write("goods is null"); } GoodsImage gi = _goodsImageBLL.GetPictureByGoodsId(goods.Id); if (gi == null) { LogHelper.Log.Write("gi is null"); } GoodsModel gm = new GoodsModel(goods); gm.PicturePath = gi.ImagePath; goodsModelList.Add(gm); } // 要显示的推荐商品 ViewData["GoodsModelList"] = goodsModelList; return(View()); }
private void loadData() { this.tsslabTotal.Text = "加载中..."; Decimal price = 0; int count = 0; List <ReportGoodsRank> items = bll.GetStatisticsTodayCategorySale(); foreach (ReportGoodsRank item in items) { price += item.Price; count += item.Count; this.dgvStatisticsCategory.Rows.Add(new String[] { item.GoodsName, item.Price.ToString(), item.Count.ToString() }); } this.tsslabTotal.Text = String.Format("(总金额:{0}元 总数量:{1}件)", price, count); items = bll.GetStatisticsTodayGoodsSale(); foreach (ReportGoodsRank item in items) { this.dgvStatisticsGoods.Rows.Add(new String[] { item.GoodsName, item.Price.ToString(), item.Count.ToString() }); } List <SaleLog> logs = logBll.GetAllSaleLogsByDate(DateTime.Now.Date, DateTime.Now); foreach (SaleLog log in logs) { log.Goods = goodsBll.GetGoodsById(log.GoodsId); log.Goods.Category = catBll.GetCategory(log.Goods.CategoryId); this.dgvSaleLog.Rows.Add(new String[] { TimeStamp.ConvertIntDateTime(log.CreatedAt).ToString("yyyy-MM-dd hh:mm:ss"), log.Goods?.Name, log.Goods.Category.Name, log.Money.ToString(), log.Summary }); } }
public ActionResult List() { Member member = _memberBLL.GetMemberByOpenId(System.Web.HttpContext.Current.Session["member"] as string); double discount = _rulesBLL.GetDiscountByVIP(member.Vip); List <Cart> cartList = _cartBLL.GetCartByMemberId(member.Id).ToList(); List <CartModel> cartModelList = new List <CartModel>(); foreach (var item in cartList) { CartModel cm = new CartModel(_goodsBLL.GetGoodsById(item.GoodsId)); GoodsImage gi = _goodsImageBLL.GetPictureByGoodsId(item.GoodsId); cm.PicturePath = gi.ImagePath; cm.Count = item.Count; cm.Discount = discount; cartModelList.Add(cm); } ViewData["CartModelList"] = cartModelList; return(View()); }
private void AddMyService(Guid memberId, string OrderNo) { // 先根据orderNo 获取到所有的 OrderDetail 里面的商品列表 List <OrderDetail> odList = _orderDetailBLL.GetOrderDetailByOrderNo(OrderNo).ToList(); List <Goods> serviceList = new List <Goods>(); // 再判断 servicecount 是否大于 0 来找出服务对象 foreach (var item in odList) { Goods goods = _goodsBLL.GetGoodsById(item.GoodsId); if (goods.ServiceCount > 0) { serviceList.Add(goods); } } // 最后根据所得服务列表 添加 MyService 表 foreach (var item in serviceList) { MyService ms = new MyService(); ms.Id = Guid.NewGuid(); ms.IsDeleted = false; ms.MemberId = memberId; ms.TotalCount = item.ServiceCount; ms.CurrentCount = item.ServiceCount; ms.CreatedTime = DateTime.Now; ms.DeletedTime = DateTime.MinValue.AddHours(8); ms.GoodsId = item.Id; ms.GoodsName = item.Name; _serviceBLL.Add(ms); // 生成二维码 CreateServiceQR(memberId, ms.Id); } }
public ActionResult GetGoodsList(string categoryCode) { // 先取出当前vip等级会员折扣 Member member = _memberBLL.GetMemberByOpenId(System.Web.HttpContext.Current.Session["member"].ToString()); double discount = _rulesBLL.GetDiscountByVIP(member.Vip); List <GoodsModel> goodsList = new List <GoodsModel>(); // 判断传递进来的categoryCode 是否为空 // 如果为空 则搜索出所有没有标记为删除的Goods对象 if (categoryCode == null) { // 得到所有Goods对象之后 遍历 构造出 GoodsModel list foreach (var item in _goodsBLL.GetAllNoDeteledGoods()) { GoodsModel gm = new GoodsModel(item); gm.PicturePath = _goodsImagesBLL.GetPictureByGoodsId(gm.Id).ImagePath; gm.Discount = discount; goodsList.Add(gm); } } else { // 如果传进来的categoryCode 不为空 // 则要根据这个categoryCode 找到对应的Category对象 // 然后通过找到的category对象 得到 GoodsCategoryList Category category = _categoryBLL.GetCategoryByCategoryNo(categoryCode); List <GoodsCategory> goodsCategoryList = _goodsCategoryBLL.GetGoodsCategoryListByCategoryId(category.Id).ToList(); // 最后再构造 GoodModelList foreach (var item in goodsCategoryList) { GoodsModel gm = new GoodsModel(_goodsBLL.GetGoodsById(item.GoodsId)); gm.PicturePath = _goodsImagesBLL.GetPictureByGoodsId(item.GoodsId).ImagePath; gm.Discount = discount; goodsList.Add(gm); } } // 由于这个方法需要与前端传递 List对象 // 所以要将等到的 GoodsModel List 序列化为 json字符串 传递到前端 string jsonResult = string.Empty; try { // 序列化 jsonResult = ObjToJson <List <GoodsModel> >(goodsList); } catch (Exception ex) { LogHelper.Log.Write(ex.Message); LogHelper.Log.Write(ex.StackTrace); throw; } return(Content(jsonResult)); }