Esempio n. 1
0
        private void payButton_Click(object sender, EventArgs e)
        {
            OutgoingTransaction tr      = new OutgoingTransaction(Guid.NewGuid().ToString().Substring(0, 8).ToUpper(), this.expenseDetails, DateTime.Now, user.getFlat());
            ExpenseReceipt      receipt = new ExpenseReceipt(user, tr, this, mainView);

            this.Parent.Parent.Controls.Add(receipt);
            receipt.BringToFront();
            receipt.Left = 50;
            receipt.Top  = 50;
        }
Esempio n. 2
0
        public async Task Commit()
        {
            bool result = false;

            var(success, response) = await SendRequestAsync(
                OutgoingTransaction.Create((UInt16)0xB004, CreateTransactionId()));

            if (success && response != null && response.ResponseCode == IdpResponseCode.OK)
            {
                result = true;
            }
        }
Esempio n. 3
0
        public async Task <bool> EraseFlash()
        {
            bool result = false;

            var(success, response) = await SendRequestAsync(OutgoingTransaction.Create((UInt16)0xB002, CreateTransactionId()), 10000);

            if (success && response != null && response.ResponseCode == IdpResponseCode.OK)
            {
                result = true;
            }

            return(result);
        }
Esempio n. 4
0
        public async Task <float> GetVersion()
        {
            float result = -1;

            var(success, response) = await SendRequestAsync(OutgoingTransaction.Create((UInt16)0xB001, CreateTransactionId()));

            if (success && response != null && response.ResponseCode == IdpResponseCode.OK)
            {
                result = response.Transaction.Read <float>();
            }

            return(result);
        }
        /// <summary>Creates new message call transaction or a contract creation, if the data field contains code.</summary>
        /// <param name="transaction">The hex encoded signed transaction</param>
        /// <returns>The Hex-encoded transaction hash.</returns>
        public string SendTransaction(OutgoingTransaction transaction)
        {
            var parameters = new Dictionary <string, object>
            {
                { "from", transaction.From },
                { "fromType", transaction.FromType },
                { "to", transaction.To },
                { "toType", transaction.ToType },
                { "value", transaction.Value },
                { "fee", transaction.Fee },
                { "data", transaction.Data }
            };

            return(Call <string>(method: "sendTransaction", parameters));
        }
Esempio n. 6
0
        public override void confirmPayment(OutgoingTransaction transaction, ExpenseCard expense)
        {
            SqlCommand insertCommand = new SqlCommand(INSERT_OUT_TR_SP.SP_NAME, connection);

            insertCommand.CommandType = System.Data.CommandType.StoredProcedure;

            insertCommand.Parameters.Add(new SqlParameter(INSERT_OUT_TR_SP.TR_ID_PARAM, transaction.getTrID()));
            insertCommand.Parameters.Add(new SqlParameter(INSERT_OUT_TR_SP.EXPENSE_ID_PARAM, transaction.getExpense().getExpenseID()));
            insertCommand.Parameters.Add(new SqlParameter(INSERT_OUT_TR_SP.DATE_PARAM, transaction.getDate()));
            insertCommand.Parameters.Add(new SqlParameter(INSERT_OUT_TR_SP.PAID_BY_PARAM, transaction.getPaidBy().getFlatNumber()));
            insertCommand.Parameters.Add(new SqlParameter(INSERT_OUT_TR_SP.APARTMENT_ID_PARAM, Guid.Parse(transaction.getPaidBy().getApartment().getID())));
            connection.Open();
            insertCommand.ExecuteNonQuery();
            connection.Close();
            expense.changeToPaid();
        }
Esempio n. 7
0
        public ExpenseReceipt(User user, OutgoingTransaction tr, ExpenseCard ex, MainScreen mainView) : this(mainView)
        {
            this.user = user;
            this.expenseTransaction = tr;
            this.expense            = ex;

            if (tr.getExpense().GetExpenseStatus() == ExpenseStatus.Unpaid && user.getFlat().getIsManager() >= 2)
            {
                this.setConfrimFields();
            }

            else
            {
                this.setDetailsField();
            }
        }
Esempio n. 8
0
        public async Task <bool> WriteBlock(byte[] data)
        {
            bool result = false;

            var(success, response) = await SendRequestAsync(
                OutgoingTransaction.Create((UInt16)0xB003, CreateTransactionId())
                .Write((byte)data.Length)
                .Write(data));

            if (success && response != null && response.ResponseCode == IdpResponseCode.OK)
            {
                Console.WriteLine("Block written response ok");
                result = true;
            }
            else
            {
                Console.WriteLine("Block written response bad");
            }

            return(result);
        }
Esempio n. 9
0
 public async Task StartBootloader()
 {
     var(success, response) =
         await SendRequestAsync(OutgoingTransaction.Create(0xb501, CreateTransactionId(), IdpCommandFlags.None));
 }
Esempio n. 10
0
 virtual public void confirmPayment(OutgoingTransaction transaction, ExpenseCard expense)
 {
 }