protected string GetPrayerBlogs() { string sql = "Select * from PrayerRequest Inner Join Users on Users.ID = PrayerRequest.UserID order by PrayerRequest.Added desc"; DataTable dt = new DataTable(); try { dt = gData.GetDataTable2(sql); }catch (Exception) { MsgBox("Error", "Contact [email protected]", this); } string html = "<table class=saved><tr><th width=20%>User</th><th width=20%>Added<th width=50%>Subject"; for (int y = 0; y < dt.Rows.Count; y++) { SavedObject s = RowToObject(dt.Rows[y]); string sUserName = NotNull(s.Props.UserName); if (sUserName == "") { sUserName = "******"; } string sAnchor = "<a href='PrayerView.aspx?id=" + s.Props.id.ToString() + "'>"; string div = sAnchor + "<tr><td>" + DataOps.GetAvatar(s.Props.Picture) + " " + sUserName + "</td>" + UICommon.GetTd(dt.Rows[y], "Added", sAnchor) + UICommon.GetTd(dt.Rows[y], "subject", sAnchor) + "</tr>"; html += div + "\r\n"; } html += "</table>"; return(html); }
public string DepositReport() { // If their Deposit address is empty, repopulate string sql = "Select * from Users where ID='" + gUser(this).UserId.ToString() + "'"; DataTable dt = gData.GetDataTable2(sql, false); if (dt.Rows.Count > 0) { string dep = dt.Rows[0]["DepositAddress"].ToString() ?? ""; if (dep == "") { dep = WebRPC.GetNewDepositAddress(); DataOps.UpdateSingleField("Users", "DepositAddress", dep, gUser(this).UserId.ToString()); } txtDepositAddress.Text = dep; } txtBalance.Text = GetTotal(gUser(this).UserId.ToString()).ToString(); // List pending deposit txids string sPending = GetPendingTXIDs(gUser(this).UserId.ToString()); string html = ""; if (sPending.Length > 1) { html += "<font color=red>Pending Incoming Transaction(s): <font color=green>" + sPending + "</font></font><br><br>"; } html += "<span>Note: To make a deposit, send BBP to the below address. If you send BBP to this address, you will see the pending transaction here. <br><br>It takes 3 confirms for the pending transaction to be credited to your account.</span><br>Note: After sending a deposit, please wait two minutes before checking for the deposit (for the list to be refreshed). <br><br><hr>"; html += "<br>"; return(html); }
protected void btnAddFractionalSanctuary_Click(object sender, EventArgs e) { if (gUser(this).LoggedIn == false) { MsgBox("Log In Error", "Sorry, you must be logged in first.", this); return; } if (gUser(this).TwoFactorAuthorized == false || gUser(this).Require2FA != 1) { MsgBox("Two Factor Not Enabled", "Sorry, you cannot add fractional sancs unless you enable two factor authorization. Please go to the Account Edit page to enable 2FA. ", this); return; } double nTotal = GetTotalFrom(gUser(this).UserId.ToString(), "Deposit"); double nReq = GetDouble(txtAmount.Text); if (nTotal == 0 || nReq > nTotal) { MsgBox("Insufficient Funds", "Sorry, the amount requested exceeds your balance.", this); return; } if (nReq <= 0 || nReq > 1000000) { MsgBox("Out of Range", "Sorry, the amount requested is too high or low.", this); return; } // Ensure total does not exceed cap double nCap = 4250000; double nTotalFracExisting = DataOps.GetTotalFrom(gUser(this).UserId.ToString(), "SanctuaryInvestments"); if (nReq + nTotalFracExisting > nCap) { MsgBox("Investment not accepted", "Sorry, our fractional sanctuaries are limited to a total of " + nCap.ToString() + " BBP at this time. Please create a full sanctuary.", this); return; } bool fDisable = false; if (fDisable) { MsgBox("Investment not accepted", "Sorry, our fractional sanctuaries are currently being upgraded to POOS. Please try back on September 1st, 2020.", this); return; } if (nTotal >= nReq) { DataOps.IncrementAmountByFloat("SanctuaryInvestments", nReq, gUser(this).UserId); DataOps.AdjBalance(-1 * nReq, gUser(this).UserId.ToString(), "Sanctuary Investment " + nReq.ToString()); string sNarr = "The fractional sanctuary addition was successful <br><br><br>Now you can sit back and relax. In approximately 24 hours, you will see new transactions in the Fractional Sanctuary report, and your sanctuary reward will automatically be credited to your balance. <br><br>Thank you for using BiblePay! "; MsgBox("Success", sNarr, this); return; } else { MsgBox("General Failure", "General failure.", this); } }
protected void Page_Load(object sender, EventArgs e) { if (Debugger.IsAttached) { CoerceUser(Session); } string action = Request.QueryString["action"] ?? ""; string id = Request.QueryString["id"] ?? ""; if (action == "sponsornow" && id.Length > 1) { string sql = "Select * from SponsoredOrphan where userid is null and id = '" + BMS.PurifySQL(id, 100) + "' "; double dAmt = 0; try { dAmt = gData.GetScalarDouble(sql, "MonthlyAmount"); } catch (Exception) { MsgBox("Error", "Please contact [email protected] for more information", this); return; } string sChildID = gData.GetScalarString2(sql, "childid"); string sName = gData.GetScalarString2(sql, "name"); if (dAmt == 0) { MsgBox("Orphan does not exist", "Sorry, this orphan no longer exists. ", this); return; } if (!gUser(this).LoggedIn) { MsgBox("Not Logged In", "Sorry, you must be logged in first.", this); return; } double dUserBalance = GetDouble(DataOps.GetUserBalance(this)); UpdateBBPPrices(); double dMonthly = GetBBPAmountDouble(dAmt); if (dUserBalance < dMonthly) { MsgBox("Balance too Low", "Sorry, your balance is too low to sponsor this orphan for a minimum of 30 days.", this); return; } // They have enough BBP; lets remove the first months payment, and set the last payment date: string sql1 = "Update SponsoredOrphan set Userid=@userid, LastPaymentDate=getdate() where id='" + id.ToString() + "'"; SqlCommand command = new SqlCommand(sql1); command.Parameters.AddWithValue("@userid", gUser(this).UserId.ToString()); gData.ExecCmd(command); string sNotes = "Initial Sponsorship"; sql1 = "Insert into SponsoredOrphanPayments (id,childid,amount,added,userid,updated,notes) values (newid(),'" + sChildID + "','" + dMonthly.ToString() + "',getdate(),'" + gUser(this).UserId.ToString() + "',getdate(),'" + sNotes + "')"; gData.Exec(sql1); DataOps.AdjBalance(-1 * dMonthly, gUser(this).UserId.ToString(), "Sponsor Payment " + sChildID); MsgBox("Success", "Thank you for sponsoring " + sName + "! You are bearing Christian Fruit and fulfilling James 1:27. <br><br>Starting in 30 days, we will deduct the sponsorship amount automatically each month. ", this); return; } }
private void SetValueInternal(int index, object value) { _threadSafety.DoLocked(() => { if (DataOps.ValueWouldChange(value, _array.Get(index), _array)) { _array.Set(index, DataOps.ToCouchbaseObject(value)); } }); }
/// <inheritdoc /> public Dictionary <string, object> ToDictionary() { var dict = new Dictionary <string, object>(); foreach (var key in Keys) { dict[key] = DataOps.ToNetObject(GetValue(key)); } return(dict); }
/// <summary> /// Initialized from the web.config file when the application loads for the first time. /// </summary> /// <param name="name">The name of the role provider</param> /// <param name="config">Collection of keys. They need to include ApplicationName, ConnectionString. /// Description is optional</param> public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config) { //Make sure we have a valid config collection if (config == null) { throw new ArgumentNullException("config"); } //If no name was given, we'll give it a generic name if (string.IsNullOrEmpty(name)) { name = "CAESDORoleProvider"; } //If no description is given, we'll give it a generic one if (string.IsNullOrEmpty(config["description"])) { config.Remove("description"); config.Add("description", "CAESDO Role Provider"); } //Initialize the RoleProvider base base.Initialize(name, config); //Now initialize our vars (these values should get overwritten next) _applicationName = "DefaultApp"; _name = name; //Loop through the config collection and set our private variables foreach (string key in config.Keys) { switch (key.ToLower()) { case "applicationname": _applicationName = config[key]; break; case "connectionstring": _connectionStringKey = config[key]; _connectionString = config[key]; break; case "description": _description = config[key]; break; } } //Setup the dataops -- We probably want to change the 'connection string' to a connection string key //pointing to a web.config connection strings section _dops = new DataOps(); _dops.ConnectionString = _connectionStringKey; }
protected void btnSubmitProposal_Click(object sender, EventArgs e) { string sError = ""; if (txtName.Text.Length < 5) { sError = "Proposal name too short."; } if (txtAddress.Text.Length < 24) { sError = "Address must be valid."; } if (GetDouble(txtAmount.Text) <= 0) { sError = "Amount must be populated."; } if (!gUser(this).LoggedIn) { sError = "You must be logged in."; } bool fValid = PoolCommon.ValidateBiblepayAddress(IsTestNet(this), txtAddress.Text); if (!fValid) { sError = "Address is not valid for this chain."; } if (GetDouble(txtAmount.Text) > 2600000) { sError = "Amount is too high (over superblock limit)."; } double nMyBal = DataOps.GetUserBalance(this); if (nMyBal < 2501) { sError = "Balance too low."; } if (sError != "") { MsgBox("Error", sError, this); } // Submit DataOps.AdjBalance(-1 * 2500, gUser(this).UserId, "Proposal Fee - " + Left(txtURL.Text, 100)); Code.Proposals.gobject_serialize(IsTestNet(this), gUser(this).UserId, gUser(this).UserName, txtName.Text, txtAddress.Text, txtAmount.Text, txtURL.Text, ddCharity.SelectedValue); MsgBox("Success", "Thank you. Your proposal will be submitted in six blocks.", this); }
private void SetValueInternal([NotNull] string key, object value) { _threadSafety.DoLocked(() => { var oldValue = _dict.Get(key); value = DataOps.ToCouchbaseObject(value); if (DataOps.ValueWouldChange(value, oldValue, _dict)) { _dict.Set(key, new MValue(value)); KeysChanged(); } }); }
protected void Page_Load(object sender, EventArgs e) { string sso = Server.UrlDecode(Request.Unvalidated["sso"] ?? ""); string ss1 = Request.Unvalidated["redir"] ?? ""; if (ss1 == "0") { // This just prevents a perpetual redirect. return; } //Handle the SSO return call: if (sso.Length > 2) { string decsso = UICommon.decipherSSO(sso); string[] vData = decsso.Split("|"); if (vData.Length >= 2) { string un = vData[0]; string url = vData[1]; if (un == "Guest") { User u1 = new User(); u1.UserName = un; u1.AvatarURL = "https://forum.biblepay.org/Themes/Offside/images/default-avatar.png"; u1.LoggedIn = false; Session["CurrentUser"] = u1; } else if (un != "") { User u1 = new User(); u1.UserName = un; u1.AvatarURL = url; DataOps.PersistUser(ref u1); u1.LoggedIn = u1.Require2FA == 1 ? false : true; Session["CurrentUser"] = u1; string sTarget = u1.Require2FA == 1 ? "Login.aspx" : "Default.aspx"; Response.Redirect(sTarget); return; } // Redirect the user to the home page. Response.Redirect("Default.aspx"); return; } } else { Response.Redirect("Default.aspx?redir=0"); } }
private void button1_Click_1(object sender, EventArgs e) { // gray out this form this.Enabled = false; // increments active tasks ConfigFile.IncrementTaskStarted(); // asks for the "player name" to the user string playerName = Interaction.InputBox("Insert Player Name to download:", "Download all data of Player", "PlayerName", -1, -1); lblElaborating.Text = "Retriving data..."; lblElaborating.ForeColor = Color.Green; // opens a "waiting to complete" form //frmWaiting waiting = new frmWaiting("Retriving data from remote DB..."); //waiting.lblInformation.Text = "Retriving data from remote DB..."; //waiting.Enabled = true; //waiting.Show(); //waiting.BringToFront(); playerName = playerName.Trim(); if (!string.IsNullOrWhiteSpace(playerName)) { List <PlayerStatT> player = SqlOps.RetrievePlayerStat(playerName); lblElaborating.Text = "Elaborating data..."; lblElaborating.ForeColor = Color.Red; //waiting.lblInformation.Text = "Elaborating data..."; if (player.Count > 0) { player = DataOps.AddAbsoluteSeason(player, playerName); player = DataOps.PopulateKDpM(player); FileInfo textFile = DataOps.PlayerDataToFile(player); frmShowCharts newChart = new frmShowCharts(); newChart.Elaborate(player, playerName, textFile); //waiting.Dispose(); newChart.Visible = true; } else { //waiting.Dispose(); MessageBox.Show("Player not found.", "Search Player in DB: WARNING", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); this.BringToFront(); } } this.BringToFront(); ConfigFile.IncrementTaskFinished(); //waiting.Dispose(); lblElaborating.Text = "Not elaborating."; lblElaborating.ForeColor = Color.Green; this.BringToFront(); this.Enabled = true; }
/// <inheritdoc /> public Dictionary <string, object> ToDictionary() { var result = new Dictionary <string, object>(_dict.Count); _threadSafety.DoLocked(() => { foreach (var item in _dict.AllItems()) { result[item.Key] = DataOps.ToNetObject(item.Value?.AsObject(_dict)); } }); return(result); }
public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config) { if (config == null) { throw new ArgumentNullException("config"); } if (string.IsNullOrEmpty(name)) { name = "CAESDO Profile Provider"; } if (string.IsNullOrEmpty(config["description"])) { config.Remove("description"); config.Add("description", "CAESDO Profile Provider"); } base.Initialize(name, config); // Initialize default values _applicationName = "DefaultApp"; _connectionStringKey = @"ASPProvider"; _description = "DefaultApp"; _name = name; // Now go through the properties and initialize custom values foreach (string key in config.Keys) { switch (key.ToLower()) { case "applicationname": ApplicationName = config[key]; break; case "connectionstring": _connectionStringKey = config[key]; break; case "description": _description = config[key]; break; } } //Setup the dataops -- We probably want to change the 'connection string' to a connection string key //pointing to a web.config connection strings section //_connectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings[_connectionStringKey].ToString(); _dops = new DataOps(); _dops.ConnectionString = _connectionStringKey; }
/// <summary> /// Similar to the LINQ method, but returns all objects converted to standard /// .NET types /// </summary> /// <returns>A list of standard .NET typed objects in the array</returns> public List <object> ToList() { var count = _array.Count; var result = new List <object>(count); _threadSafety.DoLocked(() => { for (var i = 0; i < count; i++) { result.Add(DataOps.ToNetObject(GetObject(_array, i))); } }); return(result); }
public Parameters SetValue([NotNull] string name, [CanBeNull] object value) { CBDebug.MustNotBeNull(WriteLog.To.Query, Tag, nameof(name), name); // HACK: Use side effect of data validation var cbVal = DataOps.ToCouchbaseObject(value); if (cbVal is MutableDictionaryObject || cbVal is MutableArrayObject) { throw new ArgumentException(CouchbaseLiteErrorMessage.QueryParamNotAllowedContainCollections); } _freezer.PerformAction(() => _params[name] = value); return(this); }
public Parameters SetValue(string name, object value) { CBDebug.MustNotBeNull(Log.To.Query, Tag, nameof(name), name); // HACK: Use side effect of data validation var cbVal = DataOps.ToCouchbaseObject(value); if (cbVal is MutableDictionaryObject || cbVal is MutableArrayObject) { throw new ArgumentException("Query parameters are not allowed to contain collections"); } _freezer.PerformAction(() => _params[name] = value); return(this); }
/// <inheritdoc /> public IMutableArray SetData(IList array) { _threadSafety.DoLocked(() => { _array.Clear(); if (array != null) { foreach (var item in array) { _array.Add(DataOps.ToCouchbaseObject(item)); } } }); return(this); }
private object ToJSON(object input) { switch (input) { case IDictionary <string, object> d: return(DictAsJson(d)); case IList e: return(ListAsJson(e)); case IExpression qe when qe is QueryExpression qe2: return(qe2.ConvertToJSON()); default: return(DataOps.ToCouchbaseObject(input)); } }
public string GetTweet() { // Displays the tweet that the user clicked on from the web list. string id = Request.QueryString["id"] ?? ""; if (id == "") { return("N/A"); } MarkRead(id, gUser(this).UserId); string sql = "Select * from Tweet left Join Users on Users.ID = Tweet.UserID where Tweet.id = @id"; SqlCommand command = new SqlCommand(sql); command.Parameters.AddWithValue("@id", id); DataTable dt = gData.GetDataTable(command); if (dt.Rows.Count < 1) { MsgBox("Not Found", "We are unable to find this item.", this); return(""); } SavedObject s = RowToObject(dt.Rows[0]); string sUserPic = DataOps.GetAvatar(s.Props.Picture); string sUserName = NotNull(s.Props.UserName); if (sUserName == "") { sUserName = "******"; } string sHTMLBody = ReplaceURLs(s.Props.Body); string sBody = "<div style='min-height:300px'><span style=''>" + sHTMLBody + "</span></div>"; string div = "<table style='padding:10px;' width=73%><tr><td>User:<td>" + sUserPic + "</tr>" + "<tr><td>User Name:<td>" + sUserName + "</tr>" + "<tr><td>Added:<td>" + s.Props.Added.ToString() + "</td></tr>" + "<tr><td>Subject:<td>" + s.Props.Subject + "</td></tr>" + "<tr><td> </tr><tr><td width=8%>Body:<td style='border:1px solid lightgrey;min-height:300px' colspan=1 xbgcolor='grey' width=40%>" + sBody + "</td></tr></table>"; div += UICommon.GetComments(id, this); return(div); }
/// <inheritdoc /> public IMutableDictionary SetData(IDictionary <string, object> dictionary) { _threadSafety.DoLocked(() => { _dict.Clear(); if (dictionary != null) { foreach (var item in dictionary) { _dict.Set(item.Key, new MValue(DataOps.ToCouchbaseObject(item.Value))); } } KeysChanged(); }); return(this); }
protected void btnRemoveFractionalSanctuary_Click(object sender, EventArgs e) { if (gUser(this).LoggedIn == false) { MsgBox("Log In Error", "Sorry, you must be logged in first.", this); return; } if (gUser(this).TwoFactorAuthorized == false || gUser(this).Require2FA != 1) { MsgBox("Two Factor Not Enabled", "Sorry, you cannot change fractional sancs unless you enable two factor authorization. Please go to the Account Edit page to enable 2FA. ", this); return; } double nTotalFrac = DataOps.GetTotalFrom(gUser(this).UserId.ToString(), "SanctuaryInvestments"); double nReq = GetDouble(txtRemoveFractionalAmount.Text); if (nReq > nTotalFrac) { MsgBox("Insufficient Funds", "Sorry, the amount requested exceeds your fractional sanctuary balance.", this); return; } if (nReq <= 0 || nReq > 1000000) { MsgBox("Out of Range", "Sorry, the amount requested is too high or low.", this); return; } // Deduct the balance and add to the fractional sanc if (nTotalFrac >= nReq) { DataOps.IncrementAmountByFloat("SanctuaryInvestments", nReq * -1, gUser(this).UserId); DataOps.AdjBalance(nReq, gUser(this).UserId.ToString(), "Sanctuary Liquidation " + nReq.ToString()); string sNarr = "The fractional sanctuary removal was successful <br><br><br> Thank you for using BiblePay! "; MsgBox("Success", sNarr, this); return; } else { MsgBox("General Failure", "General failure.", this); } }
protected void btnTip_Click(object sender, EventArgs e) { bool bValid = PoolCommon.ValidateBiblepayAddress(IsTestNet(this), txtAddress.Text); double nBalance = DataOps.GetUserBalance(gUser(this).UserId); double dAmt = GetDouble(txtAmount.Text); string sReferrer = Request.QueryString["referrer"].ToNonNullString(); if (dAmt > nBalance) { MsgBox("Balance Too Low", "Sorry, unable to tip user because your balance is too low.", this); return; } if (dAmt < 0 || dAmt > 1000000) { MsgBox("Out of Range", "Sorry you must tip between .01 and 1MM BBP.", this); return; } if (!bValid) { MsgBox("Invalid address", "Sorry, the address is invalid.", this); return; } string txid = Withdraw(gUser(this).UserId, txtAddress.Text, dAmt, "Tip to " + txtAddress.Text); if (txid == "") { MsgBox("Send Failure", "Sorry, the tip failed. Please contact [email protected]", this); return; } else { string sRedirect = "Click <a href='" + sReferrer + "'>here to return to the page you came from</a>."; if (sReferrer == "") { sRedirect = "Have a great day."; } MsgBox("Success!", "You have tipped " + txtAddress.Text + " the amount " + dAmt.ToString() + " BBP. <br><br>" + sRedirect, this); return; } }
public string GetPrayer() { // Displays the prayer that the user clicked on from the web list. string id = Request.QueryString["id"] ?? ""; if (id == "") { return("N/A"); } string sql = "Select * from PrayerRequest Inner Join Users on Users.ID = PrayerRequest.UserID where prayerrequest.id = @id"; SqlCommand command = new SqlCommand(sql); command.Parameters.AddWithValue("@id", id); DataTable dt = gData.GetDataTable(command); if (dt.Rows.Count < 1) { MsgBox("Not Found", "We are unable to find this prayer.", this); return(""); } SavedObject s = RowToObject(dt.Rows[0]); string sUserPic = DataOps.GetAvatar(s.Props.Picture); string sUserName = NotNull(s.Props.UserName); if (sUserName == "") { sUserName = "******"; } string sBody = " <textarea style='width: 70%;' id=txtbody rows=25 cols=65>" + s.Props.Body + "</textarea>"; string div = "<table style='padding:10px;' width=100%><tr><td>User:<td>" + sUserPic + "</tr>" + "<tr><td>User Name:<td><h2>" + sUserName + "</h2></tr>" + "<tr><td>Added:<td>" + s.Props.Added.ToString() + "</td></tr>" + "<tr><td>Subject:<td>" + s.Props.Subject + "</td></tr>" + "<tr><td>Body:<td colspan=2>" + sBody + "</td></tr></table>"; div += UICommon.GetComments(id, this); return(div); }
private void MarkRead(string id, string userid) { if (userid == "" || userid == null) { return; } string sql = "Select count(*) ct from TweetRead where parentid = '" + id + "' and userid = '" + userid + "'"; double dCt = gData.GetScalarDouble(sql, "ct"); sql = "IF NOT EXISTS (SELECT ID FROM TweetRead where parentid='" + id + "' and userid = '" + userid + "') Insert into TweetRead (id,userid,added,parentid,ReadTime) values (newid(), '" + userid + "',getdate(),'" + id + "',getdate())"; gData.Exec(sql); if (dCt == 0) { sql = "Select subject from Tweet where id='" + BMS.PurifySQL(id, 50) + "'"; string sSubject = gData.GetScalarString2(sql, "subject"); DataOps.AdjBalance(1, userid, "Tweet Read [" + sSubject + "]"); } this.Session["Tweet" + id] = "1"; }
protected void Page_Load(object sender, EventArgs e) { if (Debugger.IsAttached) { CoerceUser(Session); } if (gUser(this).LoggedIn == false) { string Promotion = "<br><font color=red></font>Thank you for using BiblePay."; MsgBox("Log In Error", "Sorry, you must be logged in first." + Promotion, this); return; } double nTotalFracSancBalance = DataOps.GetTotalFrom(gUser(this).UserId.ToString(), "SanctuaryInvestments"); double nTotalBalance = DataOps.GetTotalFrom(gUser(this).UserId.ToString(), "Deposit"); txtGlobalSancInvestments.Text = DataOps.GetTotalFrom("", "SanctuaryInvestments").ToString(); txtGlobalSancInvestmentCount.Text = GetUserCountFrom("SanctuaryInvestments").ToString(); txtFractionalSancBalance.Text = nTotalFracSancBalance.ToString(); txtBalance.Text = nTotalBalance.ToString(); double nRewards = GetTotalFrom(gUser(this).UserId.ToString(), "Deposit", "Notes like 'sanctuary payment%'"); txtRewards.Text = nRewards.ToString(); double nGrossEarningsPerDay = 0; double nOrphanDeductions = 0; double nROI = GetEstimatedHODL(true, 0, out nGrossEarningsPerDay, out nOrphanDeductions); txtBBPEarningsPerDay.Text = nGrossEarningsPerDay.ToString() + " BBP"; txtOrphanChargesPerDay.Text = nOrphanDeductions.ToString() + " BBP"; txtHODLPercent.Text = (nROI * 100).ToString() + "%"; double nNet = nGrossEarningsPerDay - nOrphanDeductions; double nOrpSancPct = GetOrphanFracSancPercentage(); txtNetEarningsPerDay.Text = nNet.ToString() + " BBP"; }
public void TestAutoconvertJson() { var jVal = new JValue("test"); var jArray = new JArray(jVal); var jObj = new JObject { ["test"] = jVal }; DataOps.ToCouchbaseObject(jVal).Should().Be("test"); DataOps.ToCouchbaseObject(jArray).As <MutableArrayObject>()[0].String.Should().Be("test"); DataOps.ToCouchbaseObject(jObj).As <MutableDictionaryObject>()["test"].String.Should().Be("test"); var jsonString = "{\"level1\":{\"foo\":\"bar\"},\"level2\":{\"list\":[1, 3.14, \"s\"]}, \"$type\":\"JSON .NET Object\"}"; var json = JsonConvert.DeserializeObject <IDictionary <string, object> >(jsonString); var converted = DataOps.ToCouchbaseObject(json) as MutableDictionaryObject; converted.Should().NotBeNull(); converted["level1"]["foo"].String.Should().Be("bar"); converted["level2"]["list"][0].Int.Should().Be(1); converted["level2"]["list"][1].Double.Should().Be(3.14); converted["level2"]["list"][2].String.Should().Be("s"); converted["$type"].String.Should().Be("JSON .NET Object"); }
/// <inheritdoc /> public long GetLong(int index) => DataOps.ConvertToLong(GetObject(_array, index, _threadSafety));
/// <inheritdoc /> public int GetInt(int index) => DataOps.ConvertToInt(GetObject(_array, index, _threadSafety));
/// <inheritdoc /> public float GetFloat(int index) => DataOps.ConvertToFloat(GetObject(_array, index, _threadSafety));
/// <inheritdoc /> public double GetDouble(int index) => DataOps.ConvertToDouble(GetObject(_array, index, _threadSafety));
public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config) { if (config == null) { throw new ArgumentNullException("config"); } if (string.IsNullOrEmpty(name)) { name = "FRACMembershipProvider"; } if (string.IsNullOrEmpty(config["description"])) { config.Remove("description"); config.Add("description", "FRAC Membership Provider"); } //Initialize the base class base.Initialize(name, config); // Initialize default values _ApplicationName = "DefaultApp"; _ConnectionString = @"Data Source=ROBERTO;Initial Catalog=Kong;Integrated Security=True"; _Description = "DefaultApp"; _MinRequiredPasswordLength = SecUtility.GetIntValue(config, "minRequiredPasswordLength", 7, false, 128); _MinRequiredNonalphanumericCharacters = SecUtility.GetIntValue(config, "minRequiredNonalphanumericCharacters", 1, true, 128); _EnablePasswordRetrieval = SecUtility.GetBooleanValue(config, "enablePasswordRetrieval", false); _EnablePasswordReset = SecUtility.GetBooleanValue(config, "enablePasswordReset", true); _Name = name; // Now go through the properties and initialize custom values foreach (string key in config.Keys) { switch (key.ToLower()) { case "applicationname": _ApplicationName = config[key]; break; case "connectionstring": _ConnectionString = config[key]; break; case "description": _Description = config[key]; break; case "requiresquestionandanswer": _RequiresQuestionAndAnswer = SecUtility.GetBooleanValue(config, key, true); break; case "requiresuniqueemail": _RequiresUniqueEmail = SecUtility.GetBooleanValue(config, key, true); break; } } string strTemp = string.IsNullOrEmpty(config["passwordFormat"]) ? "Hashed" : config["passwordFormat"]; switch (strTemp) { case "Clear": _PasswordFormat = MembershipPasswordFormat.Clear; break; case "Encrypted": _PasswordFormat = MembershipPasswordFormat.Encrypted; break; case "Hashed": _PasswordFormat = MembershipPasswordFormat.Hashed; break; default: throw new ProviderException("Bad password format"); } _HashAlgorithmType = config["hashAlgorithmType"]; if (String.IsNullOrEmpty(_HashAlgorithmType)) { _HashAlgorithmType = "SHA1"; } if (_PasswordStrengthRegularExpression != null) { _PasswordStrengthRegularExpression = _PasswordStrengthRegularExpression.Trim(); if (_PasswordStrengthRegularExpression.Length != 0) { try { Regex regex = new Regex(_PasswordStrengthRegularExpression); } catch (ArgumentException e) { throw new ProviderException(e.Message, e); } } } else { _PasswordStrengthRegularExpression = string.Empty; } if (_PasswordFormat == MembershipPasswordFormat.Hashed && _EnablePasswordRetrieval) throw new ProviderException("Provider cannot retrieve hashed password"); //Setup the dataops -- We probably want to change the 'connection string' to a connection string key //pointing to a web.config connection strings section _dops = new DataOps(); _dops.ConnectionString = _ConnectionString; }