Пример #1
0
        static void Main(string[] args)
        {
            /* TODO:以下を実装
             * 実績登録
             * 実績出力
             * 実績削除
             * 人出力
             * 人登録
             * 人削除
             * 会登録
             * 会表示
             * 会削除
             * */

            IDbConnection conn = GetConnection();

            conn.Open();
            MeetingRepository meetingRepository = new MeetingRepository(conn);
            MeetingInputSequence meetingInputSequence = new MeetingInputSequence(meetingRepository);
            meetingInputSequence.Start();
            conn.Close();

            conn.Open();
            meetingRepository = new MeetingRepository(conn);
            OutputMeetingListSequence outputMeetingListSequence = new OutputMeetingListSequence(meetingRepository);
            outputMeetingListSequence.Start();
            conn.Close();

            Console.Write("会ID:");
            string meetingID = Console.ReadLine();
            Console.WriteLine("");

            conn.Open();

            PeopleRepository peopleRepository = new PeopleRepository(conn);
            IEnumerable<Person> people = peopleRepository.GetAll();

            foreach (Person p in people)
            {
                Console.WriteLine(p.PersonId + "-" + p.Name + "-" + p.Kana);
            }

            conn.Close();

            Console.Write("参加者(カンマ区切り):");
            string InParticipant = Console.ReadLine();
            Console.WriteLine("");

            Console.Write("実績時間(分):");
            string time = Console.ReadLine();
            Console.WriteLine("");

            Participant participant = new Participant(InParticipant);
            List<int> particiantList = participant.CreateParticiantList();
            Achievement achivement = null;

            foreach (int l in particiantList)
            {
                achivement = new Achievement();
                achivement.PersonId = l;
                //achivement.Date = DateTime.Parse(date);
                if (meetingID == "")
                {
                    achivement.MeetingId = 0;
                }
                else
                {
                    achivement.MeetingId = int.Parse(meetingID);
                }
                achivement.Time = int.Parse(time);

                conn.Open();

                AchievementRepository achivementRepository = new AchievementRepository(conn);
                achivementRepository.Insert(achivement);

                conn.Close();
            }
        }