예제 #1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            using (var db = new RSIJudgingSystemEntities())
            {
                var judge = db.JudgeProfile.FirstOrDefault(r => r.Username == txtBoxUsername.Text);

                if (judge != null)
                {
                    MainWindow form = new MainWindow(judge);

                    form.Show();
                }
                else
                {
                    MessageBox.Show("Invalid Username", "Login Error");
                }
            }
        }
예제 #2
0
        public static void SaveTop10(string _beauty, string _intelligence, string _delivery, string judgeNo,
                                     string _contestantNo, out string message)
        {
            message = "";

            try
            {
                using (var db = new RSIJudgingSystemEntities())
                {
                    if (judgeNo == "1")
                    {
                        Top10Judge1 newJ = new Top10Judge1
                        {
                            ContestantNo = _contestantNo,
                            Beauty       = decimal.Parse(_beauty),
                            Delivery     = decimal.Parse(_delivery),
                            Intelligence = decimal.Parse(_intelligence)
                        };

                        db.Entry(newJ).State = EntityState.Added;
                    }
                    else if (judgeNo == "2")
                    {
                        Top10Judge2 newJ = new Top10Judge2
                        {
                            ContestantNo = _contestantNo,
                            Beauty       = decimal.Parse(_beauty),
                            Delivery     = decimal.Parse(_delivery),
                            Intelligence = decimal.Parse(_intelligence)
                        };

                        db.Entry(newJ).State = EntityState.Added;
                    }
                    else if (judgeNo == "3")
                    {
                        Top10Judge3 newJ = new Top10Judge3
                        {
                            ContestantNo = _contestantNo,
                            Beauty       = decimal.Parse(_beauty),
                            Delivery     = decimal.Parse(_delivery),
                            Intelligence = decimal.Parse(_intelligence)
                        };

                        db.Entry(newJ).State = EntityState.Added;
                    }
                    else if (judgeNo == "4")
                    {
                        Top10Judge4 newJ = new Top10Judge4
                        {
                            ContestantNo = _contestantNo,
                            Beauty       = decimal.Parse(_beauty),
                            Delivery     = decimal.Parse(_delivery),
                            Intelligence = decimal.Parse(_intelligence)
                        };

                        db.Entry(newJ).State = EntityState.Added;
                    }
                    else if (judgeNo == "5")
                    {
                        Top10Judge5 newJ = new Top10Judge5
                        {
                            ContestantNo = _contestantNo,
                            Beauty       = decimal.Parse(_beauty),
                            Delivery     = decimal.Parse(_delivery),
                            Intelligence = decimal.Parse(_intelligence)
                        };

                        db.Entry(newJ).State = EntityState.Added;
                    }
                    else if (judgeNo == "6")
                    {
                        Top10Judge6 newJ = new Top10Judge6
                        {
                            ContestantNo = _contestantNo,
                            Beauty       = decimal.Parse(_beauty),
                            Delivery     = decimal.Parse(_delivery),
                            Intelligence = decimal.Parse(_intelligence)
                        };

                        db.Entry(newJ).State = EntityState.Added;
                    }
                    else if (judgeNo == "7")
                    {
                        Top10Judge7 newJ = new Top10Judge7
                        {
                            ContestanceNo = _contestantNo,
                            Beauty        = decimal.Parse(_beauty),
                            Delivery      = decimal.Parse(_delivery),
                            Intelligence  = decimal.Parse(_intelligence)
                        };

                        db.Entry(newJ).State = EntityState.Added;
                    }


                    db.SaveChanges();
                }
            }
            catch (Exception error)
            {
                message = error.Message;
            }
        }
예제 #3
0
        public static void SaveRanking(string _personality, string _wit, string _judgeNo, string _contestantNo, out string message)
        {
            message = "";

            try
            {
                using (var db = new RSIJudgingSystemEntities())
                {
                    if (_judgeNo == "1")
                    {
                        RankingJudge1 newTop5 = new RankingJudge1
                        {
                            ContestantNo = _contestantNo,
                            Personality  = decimal.Parse(_personality),
                            Wit          = decimal.Parse(_wit)
                        };

                        db.Entry(newTop5).State = EntityState.Added;
                    }
                    else if (_judgeNo == "2")
                    {
                        RankingJudge2 newTop5 = new RankingJudge2
                        {
                            ContestantNo = _contestantNo,
                            Personality  = decimal.Parse(_personality),
                            Wit          = decimal.Parse(_wit)
                        };

                        db.Entry(newTop5).State = EntityState.Added;
                    }
                    else if (_judgeNo == "3")
                    {
                        RankingJudge3 newTop5 = new RankingJudge3
                        {
                            ContestantNo = _contestantNo,
                            Personality  = decimal.Parse(_personality),
                            Wit          = decimal.Parse(_wit)
                        };

                        db.Entry(newTop5).State = EntityState.Added;
                    }
                    else if (_judgeNo == "4")
                    {
                        RankingJudge4 newTop5 = new RankingJudge4
                        {
                            ContestantNo = _contestantNo,
                            Personality  = decimal.Parse(_personality),
                            Wit          = decimal.Parse(_wit)
                        };

                        db.Entry(newTop5).State = EntityState.Added;
                    }
                    else if (_judgeNo == "5")
                    {
                        RankingJudge5 newTop5 = new RankingJudge5
                        {
                            ContestantNo = _contestantNo,
                            Personality  = decimal.Parse(_personality),
                            Wit          = decimal.Parse(_wit)
                        };

                        db.Entry(newTop5).State = EntityState.Added;
                    }
                    else if (_judgeNo == "6")
                    {
                        RankingJudge6 newTop5 = new RankingJudge6
                        {
                            ContestantNo = _contestantNo,
                            Personality  = decimal.Parse(_personality),
                            Wit          = decimal.Parse(_wit)
                        };

                        db.Entry(newTop5).State = EntityState.Added;
                    }
                    else if (_judgeNo == "7")
                    {
                        RankingJudge7 newTop5 = new RankingJudge7
                        {
                            ContestantNo = _contestantNo,
                            Personality  = decimal.Parse(_personality),
                            Wit          = decimal.Parse(_wit)
                        };

                        db.Entry(newTop5).State = EntityState.Added;
                    }

                    db.SaveChanges();
                }
            }
            catch (Exception error)
            {
                message = error.Message;
            }
        }
예제 #4
0
        public static void SaveTop5(string _beauty, string _intelligence, string _poise, string _judgeNo, string _contestantNo, out string message)
        {
            message = "";

            try
            {
                using (var db = new RSIJudgingSystemEntities())
                {
                    if (_judgeNo == "1")
                    {
                        Top5Judge1 j = new Top5Judge1
                        {
                            CandidateNo  = _contestantNo,
                            Beauty       = decimal.Parse(_beauty),
                            Intelligence = decimal.Parse(_intelligence),
                            Poise        = decimal.Parse(_poise)
                        };

                        db.Entry(j).State = EntityState.Added;
                    }
                    else if (_judgeNo == "2")
                    {
                        Top5Judge2 j = new Top5Judge2
                        {
                            CandidateNo  = _contestantNo,
                            Beauty       = decimal.Parse(_beauty),
                            Intelligence = decimal.Parse(_intelligence),
                            Poise        = decimal.Parse(_poise)
                        };

                        db.Entry(j).State = EntityState.Added;
                    }
                    else if (_judgeNo == "3")
                    {
                        Top5Judge3 j = new Top5Judge3
                        {
                            CandidateNo  = _contestantNo,
                            Beauty       = decimal.Parse(_beauty),
                            Intelligence = decimal.Parse(_intelligence),
                            Poise        = decimal.Parse(_poise)
                        };

                        db.Entry(j).State = EntityState.Added;
                    }

                    else if (_judgeNo == "4")
                    {
                        Top5Judge4 j = new Top5Judge4
                        {
                            CandidateNo  = _contestantNo,
                            Beauty       = decimal.Parse(_beauty),
                            Intelligence = decimal.Parse(_intelligence),
                            Poise        = decimal.Parse(_poise)
                        };

                        db.Entry(j).State = EntityState.Added;
                    }

                    else if (_judgeNo == "5")
                    {
                        Top5Judge5 j = new Top5Judge5
                        {
                            CandidateNo  = _contestantNo,
                            Beauty       = decimal.Parse(_beauty),
                            Intelligence = decimal.Parse(_intelligence),
                            Poise        = decimal.Parse(_poise)
                        };

                        db.Entry(j).State = EntityState.Added;
                    }

                    else if (_judgeNo == "6")
                    {
                        Top5Judge6 j = new Top5Judge6
                        {
                            CandidateNo  = _contestantNo,
                            Beauty       = decimal.Parse(_beauty),
                            Intelligence = decimal.Parse(_intelligence),
                            Poise        = decimal.Parse(_poise)
                        };

                        db.Entry(j).State = EntityState.Added;
                    }

                    else if (_judgeNo == "7")
                    {
                        Top5Judge7 j = new Top5Judge7
                        {
                            CandidateNo  = _contestantNo,
                            Beauty       = decimal.Parse(_beauty),
                            Intelligence = decimal.Parse(_intelligence),
                            Poise        = decimal.Parse(_poise)
                        };

                        db.Entry(j).State = EntityState.Added;
                    }

                    db.SaveChanges();
                }
            }
            catch (Exception error)
            {
                message = error.Message;
            }
        }
예제 #5
0
        private void GetTop5()
        {
            using (var db = new RSIJudgingSystemEntities())
            {
                //var query1 = from c in db.ContestantProfile
                //             join j in db.Top10Winners on c.ContestantNo equals j.ContestantNo
                //            //join fj1 in db.Top10Judge1 on c.ContestantNo equals fj1.ContestantNo
                //            //join fj2 in db.Top10Judge2 on c.ContestantNo equals fj2.ContestantNo
                //            //join fj3 in db.Top10Judge3 on c.ContestantNo equals fj3.ContestantNo
                //            //join fj4 in db.Top10Judge4 on c.ContestantNo equals fj4.ContestantNo
                //            //join fj5 in db.Top10Judge5 on c.ContestantNo equals fj5.ContestantNo
                //            //join fj6 in db.Top10Judge6 on c.ContestantNo equals fj6.ContestantNo
                //            //join fj7 in db.Top10Judge7 on c.ContestantNo equals fj7.ContestanceNo
                //            select new Top5Model
                //            {
                //                contestantNo = c.ContestantNo,
                //                TotalScoreLinq = j.FinalScore
                //            };

                //var top10List1 = query1.OrderByDescending(r => r.TotalScoreLinq).ToList();

                //for (int x = 0; x < top10List1.Count; x++)
                //{
                //    if (x >= 10)
                //        RemoveTab(top10List1[x].contestantNo);
                //}

                var query = from c in db.ContestantProfile
                            join j in db.Top5Winners on c.ContestantNo equals j.ContestantNo
                            //join fj1 in db.Top10Judge1 on c.ContestantNo equals fj1.ContestantNo
                            //join fj2 in db.Top10Judge2 on c.ContestantNo equals fj2.ContestantNo
                            //join fj3 in db.Top10Judge3 on c.ContestantNo equals fj3.ContestantNo
                            //join fj4 in db.Top10Judge4 on c.ContestantNo equals fj4.ContestantNo
                            //join fj5 in db.Top10Judge5 on c.ContestantNo equals fj5.ContestantNo
                            //join fj6 in db.Top10Judge6 on c.ContestantNo equals fj6.ContestantNo
                            //join fj7 in db.Top10Judge7 on c.ContestantNo equals fj7.ContestanceNo
                            select new Top5Model
                {
                    contestantNo   = c.ContestantNo,
                    panelInterview = c.PanelInterview,
                    TotalScoreLinq = j.FinalScore
                                     //TotalScoreLinq = j.TotalScore1 + j.TotalScore2 +
                                     //j.TotalScore3 + j.TotalScore4 + j.TotalScore5 +
                                     //j.TotalScore6 + j.TotalScore7
                };


                var temp = query.OrderByDescending(r => r.TotalScoreLinq).Take(5).ToList();

                List <int> tempInt = new List <int>();

                temp.ForEach(x =>
                {
                    tempInt.Add(int.Parse(x.contestantNo));
                });

                for (int x = 1; x <= 20; x++)
                {
                    if (!tempInt.Contains(x))
                    {
                        RemoveTab(x.ToString());
                    }
                }

                //for(int x = 0; x < temp.Count; x++)
                //{
                //    if (x >= 5)
                //    {
                //        RemoveTab(temp[x].contestantNo);
                //    }
                //}
            }
        }