Exemple #1
0
        /// <summary>
        /// Конструктор, инициализирующий общие для всех конструкторов данные
        /// </summary>
        private AccountingPriceList(string number, DateTime startDate, DateTime?endDate, AccountingPriceCalcRule priceCalcRule, LastDigitCalcRule lastDigitRule, User curator)
        {
            if (String.IsNullOrWhiteSpace(number))
            {
                throw new Exception("Номер не указан.");
            }

            CreationDate  = DateTimeUtils.GetCurrentDateTime();
            state         = AccountingPriceListState.New;
            storages      = new HashedSet <Storage>();
            articlePrices = new HashedSet <ArticleAccountingPrice>();
            IsRevaluationOnStartCalculated = false;
            IsRevaluationOnEndCalculated   = false;

            CheckAndCorrectDates(ref startDate, ref endDate, CreationDate);

            Number    = number;
            StartDate = startDate;
            EndDate   = endDate;
            AccountingPriceCalcRule = priceCalcRule ?? AccountingPriceCalcRule.GetDefault();
            LastDigitCalcRule       = lastDigitRule ?? LastDigitCalcRule.GetDefault();
            Curator = curator;
        }
Exemple #2
0
        /// <summary>
        /// Конструктор для основания "По месту хранения"
        /// </summary>
        public AccountingPriceList(string number, DateTime startDate, DateTime?endDate, Storage storage,
                                   IEnumerable <ArticleAccountingPrice> articleAccountingPriceList, User curator, AccountingPriceCalcRule priceCalcRule = null, LastDigitCalcRule lastDigitRule = null)
            : this(number, startDate, endDate, priceCalcRule, lastDigitRule, storage, curator)
        {
            Reason = AccountingPriceListReason.Storage;

            CheckArticleListForUniqueness(articleAccountingPriceList);
            SetArticleAccountingPriceOwner(articleAccountingPriceList, this);
            SetArticleAccountingPriceList(articleAccountingPriceList);
        }
Exemple #3
0
        /// <summary>
        /// Конструктор для основания "Приход"
        /// </summary>
        public AccountingPriceList(string number, DateTime startDate, DateTime?endDate, ReceiptWaybill receiptWaybill, IEnumerable <Storage> storageList,
                                   IEnumerable <ArticleAccountingPrice> articleAccountingPriceList, User curator, AccountingPriceCalcRule priceCalcRule = null, LastDigitCalcRule lastDigitRule = null)
            : this(number, startDate, endDate, priceCalcRule, lastDigitRule, storageList, curator)
        {
            Reason = AccountingPriceListReason.ReceiptWaybill;

            ReasonReceiptWaybillId     = receiptWaybill.Id;
            ReasonReceiptWaybillDate   = receiptWaybill.Date;
            ReasonReceiptWaybillNumber = receiptWaybill.Number;

            CheckArticleListForUniqueness(articleAccountingPriceList);
            SetArticleAccountingPriceOwner(articleAccountingPriceList, this);
            SetArticleAccountingPriceList(articleAccountingPriceList);
        }
Exemple #4
0
 /// <summary>
 /// Конструктор для основания "Переоценка"
 /// </summary>
 public AccountingPriceList(string number, DateTime startDate, DateTime?endDate,
                            IEnumerable <Storage> storageList, User curator, AccountingPriceCalcRule priceCalcRule = null, LastDigitCalcRule lastDigitRule = null)
     : this(number, startDate, endDate, priceCalcRule, lastDigitRule, storageList, curator)
 {
     Reason = AccountingPriceListReason.Revaluation;
 }
Exemple #5
0
 /// <summary>
 /// Конструктор для распространения из нескольких складов
 /// </summary>
 private AccountingPriceList(string number, DateTime startDate, DateTime?endDate, AccountingPriceCalcRule priceCalcRule, LastDigitCalcRule lastDigitRule, Storage storage, User curator)
     : this(number, startDate, endDate, priceCalcRule, lastDigitRule, curator)
 {
     storages.Add(storage);
 }
Exemple #6
0
 /// <summary>
 /// Конструктор, для распространения на один склад
 /// </summary>
 private AccountingPriceList(string number, DateTime startDate, DateTime?endDate, AccountingPriceCalcRule priceCalcRule, LastDigitCalcRule lastDigitRule, IEnumerable <Storage> storageList, User curator)
     : this(number, startDate, endDate, priceCalcRule, lastDigitRule, curator)
 {
     if (storageList.Any())
     {
         SetStorageList(storageList);
     }
     else
     {
         throw new Exception("Не выбрано ни одного места хранения.");
     }
 }