Esempio n. 1
0
 private void Bad_Click(object sender, EventArgs e)//vote for disike
 {
     if (label23.Text != "-")
     {
         if (!CheckifChefisalreadyvoted(this.chef, this.label23.Text))
         {
             VoteRecipe GiveVote = new VoteRecipe();
             GiveVote.VoteNegative(this.chef, this.label23.Text);
             MessageBox.Show("Successfully voted for this recipe", "Voted", MessageBoxButtons.OK, MessageBoxIcon.Information);
             label25.Text = (int.Parse(label25.Text) + 1).ToString();
         }
         else
         {
             MessageBox.Show("You have already voted for this recipe", "Already voted", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
 }
Esempio n. 2
0
 private void Toprecipegrid_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (toprecipegrid.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null)
         {
             toprecipegrid.CurrentRow.Selected = true;
             textBox10.Text = toprecipegrid.Rows[e.RowIndex].Cells["Product Name"].FormattedValue.ToString();
             textBox9.Text  = toprecipegrid.Rows[e.RowIndex].Cells["Instructions"].FormattedValue.ToString();
             label23.Text   = toprecipegrid.Rows[e.RowIndex].Cells["Number"].FormattedValue.ToString();
             VoteRecipe takevotes = new VoteRecipe();
             int        positive  = takevotes.Takepositivevotes(label23.Text);
             int        negative  = takevotes.Takenegativevotes(label23.Text);
             label24.Text = positive.ToString();
             label25.Text = negative.ToString();
         }
     }
     catch (Exception)
     {
     }
 }
Esempio n. 3
0
        private bool CheckifChefisalreadyvoted(string chef, string text)
        {
            VoteRecipe checkforVote = new VoteRecipe();

            return(checkforVote.AlreadyVoted(chef, text));
        }
Esempio n. 4
0
        public void Takenegativevotes()
        {
            VoteRecipe Takenegativevotes = new VoteRecipe();

            Assert.That(Takenegativevotes.Takenegativevotes("1"), Is.EqualTo(0), "Some useful error message");
        }
Esempio n. 5
0
        public void VotePositive()
        {
            VoteRecipe VotePositive = new VoteRecipe();

            Assert.That(VotePositive.Takepositivevotes("1"), Is.EqualTo(0), "Some useful error message");
        }
Esempio n. 6
0
        public void RecipeVoted()
        {
            VoteRecipe TopRecipeVoteed = new VoteRecipe();

            Assert.That(TopRecipeVoteed.AlreadyVoted("Ivo", "1"), Is.EqualTo(false), "Some useful error message");
        }