Ejemplo n.º 1
0
        public ReturnFromClientWaybill(string number, DateTime date, AccountOrganization recipient, Deal deal, Team team, Storage recipientStorage,
                                       ReturnFromClientReason returnFromClientReason, User curator, User createdBy, DateTime creationDate)
            : base(WaybillType.ReturnFromClientWaybill, number, date, curator, createdBy, creationDate)
        {
            ValidationUtils.NotNull(deal, "Не указана сделка.");
            ValidationUtils.NotNull(recipient, "Не указана организация-приемщик.");
            ValidationUtils.NotNull(recipientStorage, "Не указано место хранения-приемщик.");
            ValidationUtils.NotNull(returnFromClientReason, "Не указана причина возврата.");
            ValidationUtils.NotNull(team, "Не указана команда.");

            State         = ReturnFromClientWaybillState.Draft;
            distributions = new HashedSet <DealPaymentDocumentDistributionToReturnFromClientWaybill>();

            Recipient              = recipient;
            RecipientStorage       = recipientStorage;
            ReturnFromClientReason = returnFromClientReason;
            Deal = deal;
            Team = team;

            // Автоматически переводим сделку на этап "Закрытие договора", если она была закрыта
            deal.MoveToContractClosingStage();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Добавление сделки
 /// </summary>
 /// <param name="deal">Сделка</param>
 public virtual void AddDeal(Deal deal)
 {
     deals.Add(deal);
     deal.Client = this;
 }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Конструктор
        /// </summary>
        /// <param name="task">Задача</param>
        /// <param name="creationDate">Дата совершения изменений</param>
        /// <param name="createdBy">Пользователь, внесший изменения в исполнение задачи</param>
        internal TaskHistoryItem(Task task, DateTime creationDate, User createdBy,
                                 bool isContractorChanged, Contractor contractor, bool isDeadLineChanged, DateTime?deadLine, bool isDealChanged, Deal deal,
                                 bool isDeletionDateChanged, DateTime?deletionDate, bool isDescriptionChanged, string description, bool isExecutedByChanged, User executedBy,
                                 bool isFactualCompletionDateChanged, DateTime?factualCompletionDate, bool isFactualSpentTimeChanged, int?factualSpentTime, bool isTaskPriorityChanged,
                                 TaskPriority taskPriority, bool isProductionOrderChanged, ProductionOrder productionOrder, bool isStartDateChanged, DateTime?startDate, bool isTopicChanged,
                                 string topic, bool isTaskTypeChanged, TaskType taskType, bool isTaskExecutionStateChanged, TaskExecutionState taskExecutionState, TaskExecutionItem taskExecutionItem)
            : base(creationDate, createdBy)
        {
            ValidationUtils.NotNull(task, "Необходимо указать задачу, к которой относится история.");
            ValidationUtils.NotNull(description, "Описание не может быть null.");

            Task = task;

            IsContractorChanged = isContractorChanged;
            Contractor          = contractor;
            IsDeadLineChanged   = isDeadLineChanged;
            Deadline            = deadLine;
            IsDealChanged       = isDealChanged;
            Deal = deal;
            IsDeletionDateChanged          = isDeletionDateChanged;
            DeletionDate                   = deletionDate;
            IsDescriptionChanged           = isDescriptionChanged;
            Description                    = description;
            IsExecutedByChanged            = isExecutedByChanged;
            ExecutedBy                     = executedBy;
            IsFactualCompletionDateChanged = isFactualCompletionDateChanged;
            FactualCompletionDate          = factualCompletionDate;
            IsFactualSpentTimeChanged      = isFactualSpentTimeChanged;
            FactualSpentTime               = factualSpentTime;
            IsTaskPriorityChanged          = isTaskPriorityChanged;
            TaskPriority                   = taskPriority;
            IsProductionOrderChanged       = isProductionOrderChanged;
            ProductionOrder                = productionOrder;
            IsStartDateChanged             = isStartDateChanged;
            StartDate                   = startDate;
            IsTopicChanged              = isTopicChanged;
            Topic                       = topic;
            IsTaskTypeChanged           = isTaskTypeChanged;
            TaskType                    = taskType;
            IsTaskExecutionStateChanged = isTaskExecutionStateChanged;
            TaskExecutionState          = taskExecutionState;
            TaskExecutionItem           = taskExecutionItem;
        }