Example #1
0
        private void hostEditBtn_Click(object sender, EventArgs e)
        {
            if (ratingsLB.SelectedItem != null)
            {
                Rating updRate = (Rating)ratingsLB.SelectedItem;

                using (HostAndScoreAdd hostAndScoreAdd = new HostAndScoreAdd(updRate))
                {
                    if (hostAndScoreAdd.ShowDialog() == DialogResult.OK)
                    {
                        updRate = hostAndScoreAdd.GetRating();

                        //once it comes back, update it
                        for (int i = 0; i < newRatings.Count; i++)
                        {
                            if (newRatings[i].tempId == updRate.tempId)
                            {
                                newRatings[i] = updRate;
                            }
                        }
                        writeRatings();
                    }
                }
            }
        }
Example #2
0
        private void hostAddBtn_Click(object sender, EventArgs e)
        {
            Rating rating = null;

            using (HostAndScoreAdd hostAndScoreAdd = new HostAndScoreAdd(newRatings))
            {
                if (hostAndScoreAdd.ShowDialog() == DialogResult.OK)
                {
                    rating        = hostAndScoreAdd.GetRating();
                    rating.tempId = getAndIncTempId();
                    newRatings.Add(rating);
                    writeRatings();
                }
            }
        }
Example #3
0
        private void podHostRateAddBtn_Click(object sender, EventArgs e)
        {
            Rating rating = null;

            using (HostAndScoreAdd hostAndScoreAdd = new HostAndScoreAdd(selPod.ratings.Cast <Rating>().ToList()))
            {
                if (hostAndScoreAdd.ShowDialog() == DialogResult.OK)
                {
                    rating        = hostAndScoreAdd.GetRating();
                    rating.tempId = getAndIncTempId();
                    if (rating.podcastId == 0)
                    {
                        rating.podcastId = selPod.id;
                    }
                    selPod.ratings.Add(rating);
                    setHostRatings();
                }
            }
        }
Example #4
0
        private void podHostRateEditBtn_Click(object sender, EventArgs e)
        {
            if (podHostRatingsLB.SelectedItem != null)
            {
                Rating updRate    = (Rating)podHostRatingsLB.SelectedItem;
                bool   updNewRate = false;

                using (HostAndScoreAdd hostAndScoreAdd = new HostAndScoreAdd(updRate))
                {
                    if (hostAndScoreAdd.ShowDialog() == DialogResult.OK)
                    {
                        updRate = hostAndScoreAdd.GetRating();

                        //once it comes back, update selPod
                        for (int i = 0; i < selPod.ratings.Count; i++)
                        {
                            if (((Rating)selPod.ratings[i]).tempId == updRate.tempId)
                            {
                                selPod.ratings[i] = updRate;
                            }
                        }

                        //for(int i = 0; i < newRatings.Count; i++)
                        //{
                        //    if(((Rating)newRatings[i]).id == updRate.id)
                        //    {
                        //        newRatings[i] = updRate;
                        //        updNewRate = true;
                        //    }
                        //}

                        //if(!updNewRate)
                        //    updRatings.Add(updRate);

                        setHostRatings();
                    }
                }
            }
        }