public void DeleteFixedPrice(Counterparty counterparty, NomenclatureFixedPrice nomenclatureFixedPrice) { if (counterparty.ObservableNomenclatureFixedPrices.Contains(nomenclatureFixedPrice)) { counterparty.ObservableNomenclatureFixedPrices.Remove(nomenclatureFixedPrice); } }
public FixedPriceItemViewModel(NomenclatureFixedPrice fixedPrice, IFixedPricesModel fixedPriceModel) { NomenclatureFixedPrice = fixedPrice ?? throw new ArgumentNullException(nameof(fixedPrice)); this.fixedPriceModel = fixedPriceModel ?? throw new ArgumentNullException(nameof(fixedPriceModel)); fixedPrice.PropertyChanged += FixedPriceOnPropertyChanged; }
public void DeleteFixedPrice(DeliveryPoint deliveryPoint, NomenclatureFixedPrice nomenclatureFixedPrice) { if (deliveryPoint.ObservableNomenclatureFixedPrices.Contains(nomenclatureFixedPrice)) { deliveryPoint.ObservableNomenclatureFixedPrices.Remove(nomenclatureFixedPrice); } }
private NomenclatureFixedPrice CreateNomenclatureFixedPrice(Nomenclature nomenclature, decimal price) { var nomenclatureFixedPrice = new NomenclatureFixedPrice(); nomenclatureFixedPrice.Nomenclature = nomenclature; nomenclatureFixedPrice.Price = price; return(nomenclatureFixedPrice); }
public void RemoveFixedPrice(NomenclatureFixedPrice nomenclatureFixedPrice) { if (nomenclatureFixedPrice == null) { throw new ArgumentNullException(nameof(nomenclatureFixedPrice)); } fixedPriceController.DeleteFixedPrice(deliveryPoint, nomenclatureFixedPrice); }
private bool CheckFixedPrice(out decimal fixedPrice, NomenclatureFixedPrice nomenclatureFixedPrice) { if (nomenclatureFixedPrice != null) { fixedPrice = nomenclatureFixedPrice.Price; return(true); } fixedPrice = default(int); return(false); }
public IEnumerable <string> GetAddressesWithFixedPrices(int counterpartyId) { IEnumerable <string> result; using (var uow = UnitOfWorkFactory.CreateWithoutRoot($"Получение списка адресов имеющих фиксированную цену")) { DeliveryPoint deliveryPointAlias = null; NomenclatureFixedPrice fixedPriceAlias = null; result = uow.Session.QueryOver <NomenclatureFixedPrice>(() => fixedPriceAlias) .Inner.JoinAlias(() => fixedPriceAlias.DeliveryPoint, () => deliveryPointAlias) .Where(() => deliveryPointAlias.Counterparty.Id == counterpartyId) .SelectList(list => list.SelectGroup(() => deliveryPointAlias.ShortAddress)) .List <string>(); } return(result); }
public override void Activate(Order order) { if (order == null) { return; } IList <NomenclatureFixedPrice> fixedPrices = order.Client.NomenclatureFixedPrices; if (order.DeliveryPoint != null) { fixedPrices = order.DeliveryPoint.NomenclatureFixedPrices; } var foundFixedPrice = fixedPrices.FirstOrDefault(x => x.Nomenclature.Id == Nomenclature.Id); if (foundFixedPrice == null) { foundFixedPrice = new NomenclatureFixedPrice(); fixedPrices.Add(foundFixedPrice); } foundFixedPrice.Nomenclature = Nomenclature; foundFixedPrice.Price = Price; }