コード例 #1
0
        public TxTemplate MakeTransferTransaction(dynamic unspentOutputs, List <Output> outputs, dynamic metadata)
        {
            var inputList = new List <InputTemplate>();

            foreach (var output in unspentOutputs)
            {
                var _tx = new
                {
                    tx          = output.tx,
                    outputIndex = output.output_index
                };

                //var fulfulledOutput = _tx.outputs[_tx.outputIndex];
                var fulfilledOutput = output[_tx.outputIndex];

                var transactionLink = new Fulfill {
                    OutputIndex   = _tx.outputIndex,
                    TransactionId = _tx.tx.id
                };

                inputList.Add(makeInputTemplate(fulfilledOutput.public_keys, transactionLink));
            }

            var assetLink = new {
                id = unspentOutputs[0].tx.operation == "CREATE" ? unspentOutputs[0].tx.id : unspentOutputs[0].tx.asset.id
            };

            return(MakeTrasnsaction("TRANSFER", assetLink, metadata, outputs, inputList));
        }
コード例 #2
0
        private void _onStatusPropChange(CswNbtNodeProp Prop)
        {
            AssignedTo.setHidden(value: (Status.Value == Statuses.Pending || Status.Value == Statuses.Completed || Status.Value == Statuses.Cancelled), SaveToDb: true);
            Fulfill.setHidden(value: (Status.Value == Statuses.Pending || Status.Value == Statuses.Completed || Status.Value == Statuses.Cancelled), SaveToDb: true);

            //27800 - don't show redundant props when status is pending
            Request.setHidden(value: (Status.Value == Statuses.Pending), SaveToDb: true);
            Name.setHidden(value: (Status.Value == Statuses.Pending), SaveToDb: true);
            Requestor.setHidden(value: (Status.Value == Statuses.Pending), SaveToDb: true);
            Status.setHidden(value: (Status.Value == Statuses.Pending), SaveToDb: true);
            Priority.setHidden(value: (Status.Value == Statuses.Pending), SaveToDb: true);
            ExternalOrderNumber.setHidden(value: (Status.Value == Statuses.Pending), SaveToDb: true);
            Type.setHidden(value: (Status.Value == Statuses.Pending), SaveToDb: true);

            switch (Status.Value)
            {
            case Statuses.Submitted:
                toggleReadOnlyProps(true, this);
                break;

            case Statuses.Cancelled:     //This fallthrough is intentional
            case Statuses.Completed:
                CswNbtObjClassRequest NodeAsRequest = _CswNbtResources.Nodes[Request.RelatedNodeId];
                if (null != NodeAsRequest)
                {
                    NodeAsRequest.setCompletedDate();
                }
                _toggleReadOnlyProps(IsReadOnly: true, ItemInstance: this);
                Node.setReadOnly(value: true, SaveToDb: true);
                break;
            }

            onStatusPropChange(Prop);
        }
コード例 #3
0
 private InputTemplate makeInputTemplate(IList <string> publicKeys, Fulfill fulfills = null, string fulfillment = null)
 {
     return(new InputTemplate {
         Fulfillment = fulfillment,
         Fulfills = fulfills,
         Owners_before = publicKeys
     });
 }
コード例 #4
0
        private void _toggleRequestItemPropVisibility()
        {
            bool HideTheseProperties = (_IsFavorite || _IsRecurring);

            Status.setHidden(value: HideTheseProperties, SaveToDb: true);
            Fulfill.setHidden(value: HideTheseProperties, SaveToDb: true);
            AssignedTo.setHidden(value: HideTheseProperties, SaveToDb: true);
            Number.setHidden(value: HideTheseProperties, SaveToDb: true);
            NeededBy.setHidden(value: HideTheseProperties, SaveToDb: true);
            TotalMoved.setHidden(value: HideTheseProperties, SaveToDb: true);
            TotalDispensed.setHidden(value: HideTheseProperties, SaveToDb: true);
            ReceiptLotToDispense.setHidden(value: HideTheseProperties, SaveToDb: true);
            ReceiptLotsReceived.setHidden(value: HideTheseProperties, SaveToDb: true);
            GoodsReceived.setHidden(value: HideTheseProperties, SaveToDb: true);
        }
コード例 #5
0
        private List <InputTemplate> makeInputTemplate(List <string> publicKeys, Fulfill fulfills = null, string fulfillment = null)
        {
            var listOfInputTemplates = new List <InputTemplate>();

            foreach (var temp in publicKeys)
            {
                listOfInputTemplates.Add(new InputTemplate
                {
                    Fulfillment   = fulfillment,
                    Fulfills      = fulfills,
                    Owners_before = publicKeys,
                });
            }
            return(listOfInputTemplates);
        }
コード例 #6
0
        }//afterDeleteNode()

        public void setFulfillVisibility()
        {
            bool HideMenuButton = (Status.Value == Statuses.Pending);

            if (false == HideMenuButton &&
                CswTools.IsPrimaryKey(Request.RelatedNodeId) &&
                Status.Value != Statuses.Cancelled &&
                Status.Value != Statuses.Completed)
            {
                CswNbtObjClassRequest NodeAsRequest = _CswNbtResources.Nodes[Request.RelatedNodeId];
                if (null != NodeAsRequest &&
                    _CswNbtResources.CurrentNbtUser.UserId == NodeAsRequest.Requestor.RelatedNodeId)
                {
                    HideMenuButton = true;
                }
            }
            Fulfill.setHidden(value: HideMenuButton, SaveToDb: false);
        }
コード例 #7
0
        public TxTemplate MakeTransferTransaction(List <UnspentOutput> unspentOutputs, List <Output> outputs, dynamic metadata)
        {
            var inputTemplates = new List <InputTemplate>();

            foreach (var uo in unspentOutputs)
            {
                var tx = uo.Tx;
                var fulfilledOutput = tx.Outputs[uo.OutputIndex];
                var transactionLink = new Fulfill
                {
                    OutputIndex   = uo.OutputIndex,
                    TransactionId = tx.Id
                };

                inputTemplates.Add(makeInputTemplate(fulfilledOutput.PublicKeys, transactionLink));
            }

            var assetLink = new AssetLink
            {
                Id = unspentOutputs[0].Tx.Operation == Transaction.CREATE.ToString() ? unspentOutputs[0].Tx.Id : unspentOutputs[0].Tx.Asset.Id
            };

            return(MakeTrasnsaction(Transaction.TRANSFER.ToString(), assetLink, metadata, outputs, inputTemplates));
        }