示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Debugger.IsAttached)
            {
                CoerceUser(Session);
            }


            string sSave   = Request.Form["btnSaveComment"].ToNonNullString();
            string mediaid = Request.QueryString["mediaid"] ?? "";
            double dReward = GetDouble(Request.QueryString["reward"].ToNonNullString());

            if (sSave != "" && mediaid.Length > 1)
            {
                if (gUser(this).UserName == "")
                {
                    MsgBox("Nick Name must be populated", "Sorry, you must have a username to save a tweet reply.  Please navigate to Account Settings | Edit to set your UserName.", this);
                    return;
                }
                string     sql     = "Insert into Comments (id,added,userid,body,parentid) values (newid(), getdate(), @userid, @body, @parentid)";
                SqlCommand command = new SqlCommand(sql);
                command.Parameters.AddWithValue("@userid", gUser(this).UserId);
                command.Parameters.AddWithValue("@body", Request.Form["txtComment"]);
                command.Parameters.AddWithValue("@parentid", mediaid);
                gData.ExecCmd(command);
            }
            double dWatching = GetDouble(Request.QueryString["watching"].ToNonNullString());

            // Respect the category (Current, Historical, Rapture, Guest-Pastor, etc).
            //string id = Request.QueryString["id"].ToNonNullString();
            if (dReward == 1 && mediaid != "" && false)
            {
                if (!gUser(this).LoggedIn || gUser(this).UserId == "" || gUser(this).UserId == null)
                {
                    MsgBox("Logged Out", "Sorry, you must be logged in to use this feature.", this);
                    return;
                }

                if (gUser(this).RandomXBBPAddress.ToNonNullString() == "")
                {
                    MsgBox("Value not populated", "Sorry, your RandomX BBP Address is not populated on your user account.  Please paste your RX mining address in your User Account first. ", this);
                    return;
                }


                if (DataOps.GetHPS(gUser(this).RandomXBBPAddress.ToNonNullString()) < 1 && !Debugger.IsAttached)
                {
                    MsgBox("Hash Power too low", "Sorry, you must be mining in the leaderboard to use this feature.  Your HPS is too low.", this);
                    return;
                }

                if (mediaid != "" && dWatching == 1 && dReward == 1)
                {
                    string sql1 = "Update Tip set Watching=getdate(),watchcount=watchcount+1 where videoid='" + mediaid + "' and userid='" + gUser(this).UserId.ToString() + "' and starttime > getdate()-1";
                    gData.Exec(sql1);
                    return;
                }

                string     sql = "select count(*) ct from Tip where UserId=@userid and Added > getdate()-1";
                SqlCommand cmd = new SqlCommand(sql);
                cmd.Parameters.AddWithValue("@userid", gUser(this).UserId);
                double nCt = gData.GetScalarDouble(cmd, "ct");
                if (nCt > 0 && !Debugger.IsAttached)
                {
                    MsgBox("Budget Depleted", "Sorry, the budget has been depleted for this video.", this);
                    return;
                }
            }
        }