示例#1
0
文件: cokbook.cs 项目: M3dic/Cokbook-
 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);
         }
     }
 }
示例#2
0
文件: cokbook.cs 项目: M3dic/Cokbook-
 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)
     {
     }
 }
示例#3
0
文件: cokbook.cs 项目: M3dic/Cokbook-
        private bool CheckifChefisalreadyvoted(string chef, string text)
        {
            VoteRecipe checkforVote = new VoteRecipe();

            return(checkforVote.AlreadyVoted(chef, text));
        }
示例#4
0
文件: Tests.cs 项目: M3dic/Cokbook-
        public void Takenegativevotes()
        {
            VoteRecipe Takenegativevotes = new VoteRecipe();

            Assert.That(Takenegativevotes.Takenegativevotes("1"), Is.EqualTo(0), "Some useful error message");
        }
示例#5
0
文件: Tests.cs 项目: M3dic/Cokbook-
        public void VotePositive()
        {
            VoteRecipe VotePositive = new VoteRecipe();

            Assert.That(VotePositive.Takepositivevotes("1"), Is.EqualTo(0), "Some useful error message");
        }
示例#6
0
文件: Tests.cs 项目: M3dic/Cokbook-
        public void RecipeVoted()
        {
            VoteRecipe TopRecipeVoteed = new VoteRecipe();

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