protected void Page_Load(object sender, EventArgs e) { this.PageAccessRequired = new Access(this.CurrentOrganization, AccessAspect.Participant); this.IsDashboard = true; // prevents encaps and enables odometer /* TEMP TEMP TEMP - REMOVE THIS CODE */ /* * Organization fwn = Organization.FromIdentity (2); * * Salaries salaries = Salaries.ForOrganization (fwn); * foreach (Salary salary in salaries) * { * if (salary.PayrollItem.Person.BitcoinPayoutAddress.Length > 0 && salary.Attested == false) * { * salary.Attest (salary.PayrollItem.Person); // null for system apparently isn't allowed here * } * }*/ this.PageTitle = Resources.Pages.Financial.Donate_PageTitle; this.InfoBoxLiteral = Resources.Pages.Financial.Donate_Info; this.LabelStatus.Text = Resources.Pages.Financial.Donate_StatusInitial; this.SuppressStatisticHeaders = true; if (this.CurrentOrganization.FinancialAccounts.AssetsBitcoinHot == null) { this.PanelDisabled.Visible = true; this.PanelEnabled.Visible = false; } HotBitcoinAddress address = HotBitcoinAddress.Create(this.CurrentOrganization, BitcoinChain.Cash, BitcoinUtility.BitcoinDonationsIndex, this.CurrentUser.Identity); this.BitcoinCashAddressUsed = address.ProtocolLevelAddress; string guid = Guid.NewGuid().ToString("N"); GuidCache.Set(guid, address.ProtocolLevelAddress); this.TransactionGuid = guid; // Calculate conversion rate (satoshi-cents to unit-cents, so we're good, even if the conversion rate // is calculated on microbitcoin to whole units) this.ConversionRateSatoshisToCents = Currency.BitcoinCash.GetConversionRate(CurrentOrganization.Currency); // Add subscription to address /* --- RETIRED CODE -- THIS WAS NOT RELIABLE -- DONE CLIENT SIDE INSTEAD * using ( * WebSocket socket = * new WebSocket("ws://localhost:" + SystemSettings.WebsocketPortFrontend + "/Front?Auth=" + * Uri.EscapeDataString(this.CurrentAuthority.ToEncryptedXml()))) * { * socket.Connect(); * * JObject data = new JObject(); * data ["ServerRequest"] = "AddBitcoinAddress"; * data["Address"] = address.ProtocolLevelAddress; * socket.Send(data.ToString()); * socket.Ping(); // wait a little little while for send to work * socket.Close(); * }*/ this.BoxTitle.Text = Resources.Pages.Financial.Donate_PageTitle; this.LabelExplainBitcoinDonation.Text = String.Format(Resources.Pages.Financial.Donate_Explain, CurrentOrganization.Name, address.ProtocolLevelAddress); this.LabelReceivedFunds.Text = String.Format(Resources.Pages.Financial.Donate_FundsReceivedLabel, CurrentOrganization.Currency.DisplayCode); this.ImageBitcoinQr.ImageUrl = "https://chart.googleapis.com/chart?cht=qr&chs=400x400&chl=bitcoincash:" + HttpUtility.UrlEncode(address.ProtocolLevelAddress + "?label=" + Uri.EscapeDataString(String.Format(Resources.Pages.Financial.Donate_TxLabel, CurrentOrganization.Name))); // URI scheme doesn't like &, = }
protected void Page_Load(object sender, EventArgs e) { this.PageAccessRequired = new Access(this.CurrentOrganization, AccessAspect.Administration); // This page is copied from Donate, with the echo payout added to the end /* TEMP TEMP TEMP - REMOVE THIS CODE */ /* * Organization fwn = Organization.FromIdentity (2); * * Salaries salaries = Salaries.ForOrganization (fwn); * foreach (Salary salary in salaries) * { * if (salary.PayrollItem.Person.BitcoinPayoutAddress.Length > 0 && salary.Attested == false) * { * salary.Attest (salary.PayrollItem.Person); // null for system apparently isn't allowed here * } * }*/ this.PageTitle = Resources.Pages.Admin.BitcoinEchoTest_PageTitle; this.InfoBoxLiteral = Resources.Pages.Admin.BitcoinEchoTest_Info; this.LabelStatus.Text = Resources.Pages.Admin.BitcoinEchoTest_StatusInitial; this.LiteralTxDetected.Text = JavascriptEscape(Resources.Pages.Admin.BitcoinEchoTest_TransactionDetected); if (this.CurrentOrganization.FinancialAccounts.AssetsBitcoinHot == null) { this.PanelDisabled.Visible = true; this.PanelEnabled.Visible = false; this.LiteralEnable.Text = @"false"; } HotBitcoinAddress address = HotBitcoinAddress.Create(this.CurrentOrganization, BitcoinUtility.BitcoinDonationsIndex, this.CurrentUser.Identity); this.LiteralBitcoinAddress.Text = address.Address; string guid = Guid.NewGuid().ToString("N"); GuidCache.Set(guid, address.Address); this.LiteralGuid.Text = guid; // TEST TEST TEST /* * BitcoinSecret secretKey = address.PrivateKey; * Coin[] spendableCoin = BitcoinUtility.GetSpendableCoin (secretKey); * * TransactionBuilder txBuild = new TransactionBuilder(); * Transaction tx = txBuild.AddCoins (spendableCoin) * .AddKeys (secretKey) * .Send (new BitcoinAddress (BitcoinUtility.BitcoinTestAddress), new Satoshis (address.UnspentSatoshis - BitcoinUtility.FeeSatoshisPerThousandBytes)) * .SendFees (new Satoshis(BitcoinUtility.FeeSatoshisPerThousandBytes)) * .SetChange (secretKey.GetAddress()) * .BuildTransaction (true); * * bool test = txBuild.Verify (tx); * if (!test) * { * throw new InvalidOperationException("Tx is not properly signed"); * } * * BitcoinUtility.BroadcastTransaction (tx);*/ this.BoxTitle.Text = Resources.Pages.Financial.Donate_PageTitle; this.LabelExplainBitcoinDonation.Text = String.Format(Resources.Pages.Financial.Donate_Explain, CurrentOrganization.Name, address.Address); this.ImageBitcoinQr.ImageUrl = "https://chart.googleapis.com/chart?cht=qr&chs=400x400&chl=bitcoin:" + HttpUtility.UrlEncode(address.Address + "?label=" + Uri.EscapeDataString(String.Format(Resources.Pages.Financial.Donate_TxLabel, CurrentOrganization.Name))); // URI scheme doesn't like &, = }