protected SaleWaybill(WaybillType waybillType, string number, DateTime date, Deal deal, Team team, DealQuota quota, bool isPrepayment, User curator, DeliveryAddressType deliveryAddressType, string deliveryAddress, DateTime creationDate, User createdBy) : base(waybillType, number, date, curator, createdBy, creationDate) { ValidationUtils.Assert(deliveryAddressType == DeliveryAddressType.CustomAddress ? !String.IsNullOrEmpty(deliveryAddress) : true, "Адрес поставки не может быть пустым при ручном указании адреса поставки."); ValidationUtils.NotNull(team, "Необходимо указать команду."); Deal = deal; this.team = team; Quota = quota; IsPrepayment = isPrepayment; IsFullyPaid = false; DeliveryAddressType = deliveryAddressType; DeliveryAddress = deliveryAddress; }
public ExpenditureWaybill(string number, DateTime date, Storage senderStorage, Deal deal, Team team, DealQuota quota, bool isPrepayment, User curator, DeliveryAddressType deliveryAddressType, string deliveryAddress, DateTime creationDate, User createdBy) : base(WaybillType.ExpenditureWaybill, number, date, deal, team, quota, isPrepayment, curator, deliveryAddressType, deliveryAddress, creationDate, createdBy) { ValidationUtils.NotNull(senderStorage, "Не указано место хранения отправителя."); ValidationUtils.NotNull(quota, "Не указана квота по сделке."); ValidationUtils.NotNull(deal.Contract, "Невозможно создать накладную реализации товаров по сделке, для которой не создан договор."); if (quota.IsPrepayment && !isPrepayment) { throw new Exception("Невозможно создать накладную с отсрочкой платежа по данной квоте. Возможно, действующая квота была изменена."); } if (!deal.Contract.AccountOrganization.Storages.Contains(senderStorage)) { throw new Exception(String.Format("Место хранения «{0}» не связано с собственной организацией «{1}», указанной в договоре по данной сделке.", senderStorage.Name, deal.Contract.AccountOrganization.ShortName)); } State = ExpenditureWaybillState.Draft; SenderStorage = senderStorage; }