コード例 #1
0
        /// <summary>
        /// Обновляет одно поступление.
        /// </summary>
        /// <param name="editedReceipt">Отредактированное поступление</param>
        public void UpdateReceipt(ReceiptDTO editedReceipt)
        {
            // Найти поступление, равное редактированному, в текущем списке поступлений ОСП.
            ReceiptDTO receipt = Receipts.FirstOrDefault(x => x.Id == editedReceipt.Id);

            // Если поступление найдено.
            if (receipt != null)
            {
                // Присвоить значения свойств отредактированного поступления текущему.
                foreach (var prop in receipt.GetType().GetProperties())
                {
                    prop.SetValue(receipt, prop.GetValue(editedReceipt));
                }
            }
        }
コード例 #2
0
        public BlockProcessingRpcMock(Web3Mock web3Mock) : base(web3Mock)
        {
            web3Mock.GetBlockWithTransactionsByNumberMock.Setup(s => s.SendRequestAsync(It.IsAny <HexBigInteger>(), null))
            .Returns <HexBigInteger, object>((n, id) =>
            {
                BlockRequestCount++;
                return(Task.FromResult(Blocks.FirstOrDefault(b => b.Number.Value == n.Value)));
            });

            web3Mock.GetTransactionReceiptMock.Setup(s => s.SendRequestAsync(It.IsAny <string>(), null))
            .Returns <string, object>((hash, id) =>
            {
                ReceiptRequestCount++;
                return(Task.FromResult(Receipts.FirstOrDefault(b => b.TransactionHash == hash)));
            });
        }
コード例 #3
0
        public bool RemoveReceipt(int receiptId, string uid)
        {
            bool    HasBeenRemoved = false;
            Receipt receipt        = Receipts.FirstOrDefault(r => r.ReceiptID == receiptId);

            if (!IsClosed())
            {
                foreach (ReceiptItem ri in receipt.ReceiptItems)
                {
                    ri.Active = false;
                    ri.Save(uid);
                }

                receipt.Active = false;
                receipt.Save(uid);
                RefreshReceipts();

                bool isPartiallyReceived = false;

                HasBeenReceived(out isPartiallyReceived, uid);
                DateReceived = DateTime.MinValue;

                if (isPartiallyReceived)
                {
                    StatusLUID = PurchaseOrderStatusPartiallyReceivedLUID();
                }
                else
                {
                    StatusLUID = PurchaseOrderOrderedStatusLUID();
                }

                Save(uid);

                HasBeenRemoved = true;
            }

            return(HasBeenRemoved);
        }