public JsonResult GetListPurchase() { var purchaselList = new PurchaseOfferDao().getPurchaseOffer(); List <PurchaseOfferDTO> purchaseOfferDTOs = new List <PurchaseOfferDTO>(); foreach (var p in purchaselList) { var purchaseOfferDTO = new PurchaseOfferDTO(); purchaseOfferDTO.id = p.Id_PurchasesOffer; purchaseOfferDTO.canBargain = p.Can_Bargain; purchaseOfferDTO.createdDate = ((DateTime)p.Date_PurchaseOffer).ToShortDateString(); purchaseOfferDTO.productName = p.PRODUCT.Name_Product; purchaseOfferDTO.seedName = p.SEED.Name_Seed; purchaseOfferDTO.quantity = p.Quantity_PurchaseOffer; purchaseOfferDTO.massName = p.MASS_UNIT.Name_MassUnit; purchaseOfferDTO.traderName = p.TRADER.Name_Trader; purchaseOfferDTO.price = p.Price_Purchase; purchaseOfferDTO.numberOfOrder = p.Number_Of_Orders; purchaseOfferDTO.payingTime = p.Paying_Time; purchaseOfferDTO.deliveringTime = p.Delivering_Time; purchaseOfferDTOs.Add(purchaseOfferDTO); } return(Json(new { data = purchaseOfferDTOs }, JsonRequestBehavior.AllowGet)); }
public JsonResult GetSuitableListPurchase(int saleOfferId) { var PurchaselList = new PurchaseOfferDao().SuitPurchaseOfferBySaleOfferId(saleOfferId); List <PurchaseOfferDTO> saleOfferDTOs = new List <PurchaseOfferDTO>(); foreach (var p in PurchaselList) { var purchaseOfferDTO = new PurchaseOfferDTO(); purchaseOfferDTO.id = p.Id_PurchasesOffer; purchaseOfferDTO.canBargain = p.Can_Bargain; purchaseOfferDTO.createdDate = ((DateTime)p.Date_PurchaseOffer).ToShortDateString(); purchaseOfferDTO.productName = p.PRODUCT.Name_Product; purchaseOfferDTO.seedName = p.SEED.Name_Seed; purchaseOfferDTO.quantity = p.Quantity_PurchaseOffer; purchaseOfferDTO.traderName = p.TRADER.Name_Trader; purchaseOfferDTO.massName = p.MASS_UNIT.Name_MassUnit; purchaseOfferDTO.price = p.Price_Purchase; saleOfferDTOs.Add(purchaseOfferDTO); } return(Json(new { data = saleOfferDTOs }, JsonRequestBehavior.AllowGet)); }
public JsonResult GetListPurchase() { var Traderid = Convert.ToInt32(Session["TraderID"]); var purchaselList = new PurchaseOfferDao().getPurchaseOfferByID(Traderid); List <PurchaseOfferDTO> purchaseOfferDTOs = new List <PurchaseOfferDTO>(); if (Traderid == 0) { purchaselList = new PurchaseOfferDao().getPurchaseOfferByIDForGuest(); } foreach (var p in purchaselList) { var purchaseOfferDTO = new PurchaseOfferDTO(); purchaseOfferDTO.purchOfferID = p.Id_PurchasesOffer; purchaseOfferDTO.canBargain = p.Can_Bargain; purchaseOfferDTO.createdDate = ((DateTime)p.Date_PurchaseOffer).ToShortDateString(); purchaseOfferDTO.productName = p.PRODUCT.Name_Product; purchaseOfferDTO.seedName = p.SEED.Name_Seed; purchaseOfferDTO.quantity = p.Quantity_PurchaseOffer; purchaseOfferDTO.massName = p.MASS_UNIT.Name_MassUnit; purchaseOfferDTO.trueMass = p.MASS_UNIT.Weight_To_Kg * p.Quantity_PurchaseOffer; purchaseOfferDTO.price = p.Price_Purchase; purchaseOfferDTO.numberOfOrder = p.Number_Of_Orders; purchaseOfferDTO.payingTime = p.Paying_Time; purchaseOfferDTO.deliveringTime = p.Delivering_Time; purchaseOfferDTOs.Add(purchaseOfferDTO); } return(Json(new { data = purchaseOfferDTOs }, JsonRequestBehavior.AllowGet)); }