Exemple #1
0
    protected void handlingVotingButtons(int userId)
    {
        //get the voting status of the user
        VotingCheck votestatus = doVotingCheck(userId);

        //there is a record
        if (votestatus != null)
        {
            //check for up and down
            if (votestatus.voted)
            {
                btnUpVote.Enabled   = false;
                btnDownVote.Enabled = false;
            }
            else
            {
                btnUpVote.Enabled   = true;
                btnDownVote.Enabled = true;
            }

            //check the flag
            if (votestatus.flagged)
            {
                btnFlag.Enabled = false;
            }
            else
            {
                btnFlag.Enabled = true;
            }
        }
    }
Exemple #2
0
    protected void voteRecord(int userId, int nId)
    {
        var         dc         = new DulyDBDataContext();
        VotingCheck votestatus = doVotingCheck(userId);

        //if there is no record, create new one
        if (votestatus == null)
        {
            var newVotingRec = new VotingCheck
            {
                userId  = userId,
                noteId  = nId,
                flagged = false,
                voted   = false
            };

            dc.VotingChecks.InsertOnSubmit(newVotingRec);
            dc.SubmitChanges();
        }
    }