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;
            }
        }
示例#3
0
        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);
        }
        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);
            }
        }
示例#5
0
        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";
        }
示例#6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string id     = Saved.Code.BMS.PurifySQL(Request.QueryString["id"].ToNonNullString(), 50);
            string action = Saved.Code.BMS.PurifySQL(Request.QueryString["action"].ToNonNullString(), 50);
            string claim  = Saved.Code.BMS.PurifySQL(Request.QueryString["claim"].ToNonNullString(), 50);
            string faucet = Request.QueryString["faucet"].ToNonNullString();

            if (Debugger.IsAttached)
            {
                CoerceUser(Session);
            }

            if (faucet == "1")
            {
                if (!gUser(this).LoggedIn)
                {
                    MsgBox("Logged Out", "Sorry, you must be logged in to claim the faucet reward.  Please join our forum <a href=https://forum.biblepay.org>from here, then come back and claim the reward</a>.", this);
                    return;
                }
                if (gUser(this).Require2FA != 1)
                {
                    MsgBox("2FA Required", "Sorry, you must have 2FA enabled to claim the faucet reward.", this);
                    return;
                }
                string sIP = (HttpContext.Current.Request.UserHostAddress ?? "").ToString();
                sIP = sIP.Replace("::ffff:", "");

                string sql      = "Select Claimed from Users where id='" + gUser(this).UserId.ToString() + "' OR ip='" + sIP + "'";
                double dClaimed = gData.GetScalarDouble(sql, "Claimed");
                if (dClaimed == 0)
                {
                    double nReward = 100;

                    sql = "Update Users set Claimed = 1,ip='" + sIP + "' where id = '" + gUser(this).UserId.ToString() + "'";
                    DataOps.AdjBalance(nReward, gUser(this).UserId.ToString(), "New User Faucet Bonus");
                    gData.Exec(sql);
                    MsgBox("Claimed", "Congratulations, your account has been credited with " + nReward.ToString() + " BBP!<br>  Thank you for becoming part of our community.<br><br>NOTE:  To see your balance, navigate to ACCOUNT.  To withdraw, navigate to the DEPOSIT/WITHDRAW page.  ", this);
                }
                else
                {
                    MsgBox("Already Claimed", "Sorry, this reward was already claimed.", this);
                }
                return;
            }
            if (id != "")
            {
                string sql = "Update Leads set Landed=getdate() where id = '" + id + "'";
                gData.Exec(sql);
            }
            else
            {
                // Probably a user from google
                string sql = "update system set value=value+1 where systemkey='googlead'";
                gData.Exec(sql);
            }

            if (action == "unsubscribe")
            {
                string sql = "Update Leads set verification='Unsubscribed' where id = '" + id + "'";
                gData.Exec(sql);
                MsgBox("Unsubscribed", "We are sorry to see you go.  We respect your privacy and wish you the richest blessings of Abraham, Isaac & Jacob.  <br><br>You have been unsubscribed from our mailing list.  <br>Thank you.<br>", this);
                return;
            }


            if (claim == "1")
            {
                if (!gUser(this).LoggedIn)
                {
                    MsgBox("Logged Out", "Sorry, you must be logged in to claim the reward.  Please join our forum <a href=https://forum.biblepay.org>from here, then come back and claim the reward</a>.", this);
                    return;
                }
                // Claim
                string sql = "Select count(*) ct from Leads where id='" + GetId() + "' and RewardClaimed is null";
                double dCt = gData.GetScalarDouble(sql, "ct");
                if (dCt == 0)
                {
                    MsgBox("Error", "Sorry, this reward has either been claimed already, or no longer exists.", this);
                    return;
                }
                else
                {
                    // Claim it
                    DataOps.AdjBalance(Common.nCampaignRewardAmount, gUser(this).UserId.ToString(), "New User Welcome Bonus");
                    sql = "Update Leads set RewardClaimed=getdate() where id='" + GetId() + "'";
                    gData.Exec(sql);

                    MsgBox("Welcome Aboard!", "Welcome aboard!  You have successfully claimed the new user welcome bonus.  "
                           + " Feel free to look around at our gospel videos.  <br><br>Also, please check out our <a href='https://forum.biblepay.org/index.php?topic=517.0'>forum thread here.</a>"
                           + " <br>NOTE:  To withdraw your free BBP coins, you must enable 2FA.  You can see your balance by going to Account | Edit.  Thank you for joining BiblePay!", this);

                    return;
                }
            }
        }
示例#7
0
        protected void btnBuy_Click(object sender, EventArgs e)
        {
            string    sID = Request.QueryString["buyid"].ToNonNullString();
            string    sql = "Select * from Products Where id='" + BMS.PurifySQL(sID, 200) + "' and deleted=0";
            DataTable dt  = gData.GetDataTable2(sql);

            if (dt.Rows.Count < 1)
            {
                MsgBox("Error", "Item no longer available.", this);
            }
            double dPriceUSD   = GetDouble(dt.Rows[0]["Price"].ToString()) / 100;
            double nSaleAmount = GetDouble(GetBMSConfigurationKeyValue("amazonsale"));

            double nPriceBBP = GetBBPAmountDouble(dPriceUSD, nSaleAmount);

            if (dPriceUSD < 1)
            {
                MsgBox("Error", "This items price is not correct.  ", this);
            }

            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 spend unless you enable two factor authorization.  Please go to the Account Edit page to enable 2FA. ", this);
                return;
            }

            // Amazon Promotion $5
            double nUnlockAmazon = gData.GetScalarDoubleFromObject("Users", "UnlockAmazon", gUser(this).UserId);
            double nMax          = GetBBPAmountDouble(5);

            double nBal = DataOps.GetUserBalance(gUser(this).UserId.ToString());

            if (nUnlockAmazon == 1 && (nPriceBBP <= nMax || nBal + nMax >= nPriceBBP))
            {
                string sql2 = "Update Users set unlockamazon=2 where id = '" + gUser(this).UserId.ToString() + "'";
                gData.Exec(sql2);
                // End of promotion
                if (nPriceBBP < nMax)
                {
                    nMax = nPriceBBP;
                }
                string sNarr = "Promotional Store Credit";
                DataOps.AdjBalance(nMax + 100, gUser(this).UserId.ToString(), sNarr);
                Log("Giving away promotional store credit to " + gUser(this).EmailAddress);
            }

            if (nBal == 0 || nBal < 1 || nPriceBBP > nBal || nPriceBBP > 20000000)
            {
                MsgBox("Insufficient Funds", "Sorry, the amount requested exceeds your balance.", this);
                return;
            }

            // Buy then adjust
            string deliveryid = ddDeliveryAddress.SelectedValue;

            ZincOps.zinc_address zTo = ZincOps.GetDeliveryAddress(deliveryid);
            string sProductID        = dt.Rows[0]["product_id"].ToNonNullString();

            if (sProductID == "")
            {
                MsgBox("Error", "Unable to find item.", this);
            }
            string sOrderID  = Guid.NewGuid().ToString();
            double nMaxPrice = Math.Round(dPriceUSD + 5, 0);



            DACResult r = ZincOps.Zinc_CreateOrder(zTo, nMaxPrice, sProductID, sOrderID);

            if (r.sError != "")
            {
                MsgBox("Buying Error", "Sorry, the purchase Failed.  Exception: " + r.sError + ".  You have not been charged.  ", this);
            }
            else
            {
                string sNotes = "Store purchase: " + dt.Rows[0]["Title"] + ", Item: " + dt.Rows[0]["product_id"] + ", Amount: $" + DoFormat(dPriceUSD);

                DataOps.AdjBalance(-1 * nPriceBBP, gUser(this).UserId.ToString(), sNotes);
                string sStatus = "PROCESSING";
                string sql1    = "Insert into Orders (id, retailer, productid, addressbookid, status, added, updated, notes, zincid, userid, bbpprice) values ('"
                                 + sOrderID + "','AMAZON','"
                                 + BMS.PurifySQL(sID, 256) + "','"
                                 + BMS.PurifySQL(ddDeliveryAddress.SelectedValue.ToString(), 100) + "','"
                                 + sStatus + "',getdate(),getdate(),null,'" + r.sResult + "','" + gUser(this).UserId.ToString() + "','" + nPriceBBP.ToString() + "')";
                gData.Exec(sql1);

                MsgBox("Success", "You have successfully purchased the item [" + dt.Rows[0]["Title"]
                       + "].  To track this order, simply navigate to <a href='MyOrders'>My Orders</a>.  Thank you for shopping with BiblePay.  ", this);
            }
        }