Exemplo n.º 1
0
 public int EditDeal(int id, int buyManID, int carID, decimal price, int saleManID)
 {
     DealModel deal = new DealModel();
     deal.ID = id;
     deal.BuyManID = buyManID;
     deal.CarID = carID;
     deal.Price = price;
     deal.SaleManID = saleManID;
     deal.Time = DateTime.Now;
     return bll.EditDeal(deal);
 }
Exemplo n.º 2
0
 public int AddDeal(int buyManID, int carID, decimal price, int saleManID)
 {
     DealModel deal = new DealModel();
     deal.BuyManID = buyManID;
     deal.CarID = carID;
     deal.Price = price;
     deal.SaleManID = saleManID;
     deal.Time = DateTime.Now;
     bll.AddDeal(deal);
     return 1;
 }
Exemplo n.º 3
0
 public List<DealModel> GetAllDeals()
 {
     List<DealModel> list=new List<DealModel>();
     var deals = context.Deal;
     foreach (var deal in deals)
     {
         DealModel model=new DealModel();
         model.ID = deal.ID;
         model.BuyManID = deal.BuyManID;
         model.CarID = deal.CarID;
         model.Price = deal.Price;
         model.SaleManID = deal.SaleManID;
         model.Time = deal.Time;
         list.Add(model);
     }
     return list;
 }
Exemplo n.º 4
0
 /// <summary>
 /// 获取该用户的成交记录(卖家)
 /// </summary>
 /// <param name="userid"></param>
 /// <returns></returns>
 public List<DealModel> GetDealsByUserId(int userid)
 {
     CarSaleEntities context=new CarSaleEntities();
     List<DealModel> list=new List<DealModel>();
     var deals=context.Deal.Where(d => d.SaleManID == userid);
     foreach (var deal in deals)
     {
         DealModel model=new DealModel();
         model.ID = deal.ID;
         model.BuyManID = deal.BuyManID;
         model.CarID = deal.CarID;
         model.Price = deal.Price;
         model.SaleManID = deal.SaleManID;
         model.Time = deal.Time;
         list.Add(model);
     }
     return list;
 }
Exemplo n.º 5
0
 public int EditDeal(DealModel deal)
 {
     try
     {
         int id = deal.ID;
         var editDeal = context.Deal.FirstOrDefault(d => d.ID == id);
         editDeal.BuyManID = deal.BuyManID;
         editDeal.CarID = deal.CarID;
         editDeal.Price = deal.Price;
         editDeal.SaleManID = deal.SaleManID;
         editDeal.Time = deal.Time;
         context.SaveChanges();
         return 1;
     }
     catch (Exception)
     {
         return 0;
     }
 }
Exemplo n.º 6
0
 public int AddDeal(DealModel deal)
 {
     try
     {
         Deal newDeal = new Deal();
         newDeal.BuyManID = deal.BuyManID;
         newDeal.CarID = deal.CarID;
         newDeal.Price = deal.Price;
         newDeal.SaleManID = deal.SaleManID;
         newDeal.Time = deal.Time;
         context.AddToDeal(newDeal);
         context.SaveChanges();
         return 1;
     }
     catch (Exception)
     {
         return 0;
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// 卖家同意出售给购买人。
        /// </summary>
        /// <returns></returns>
        public ActionResult OKToSale(int id)
        {
            OrderBll orderBll=new OrderBll();
            var order = orderBll.GetOrderById(id);
            DealBll dealBll=new DealBll();
            DealModel newDeal=new DealModel();
            newDeal.BuyManID = order.BuyManID;
            newDeal.CarID = order.CarID;
            newDeal.Price = order.Price;
            newDeal.SaleManID = order.SaleManID;
            newDeal.Time = DateTime.Now;

            dealBll.AddDeal(newDeal);//添加到成交记录

            CarBll carBll = new CarBll();//车辆信息修改为已售
            carBll.ChageCarStatusToSold(order.CarID);

            orderBll.RemoveOrder(id);//从订单记录中删除

            return RedirectToAction("MyOrders", "SaleMan");
        }
Exemplo n.º 8
0
 public int EditDeal(DealModel deal)
 {
     return dal.EditDeal(deal);
 }
Exemplo n.º 9
0
 public int AddDeal(DealModel deal)
 {
     dal.AddDeal(deal);
     return 1;
 }