예제 #1
0
        private static IList <Certification> Certification_ReadFromCSV(string location)
        {
            var sr = new StreamReader(location);

            var certificationList = new List <Certification>();

            string s          = sr.ReadLine();
            var    foreignKey = new ForeignKeys();

            while (s != null)
            {
                var newCert = new Certification
                {
                    CandidateNumber   = foreignKey.GetRandomCandidate(),
                    QualificationId   = foreignKey.GetRandomQualification(),
                    CertificationDate = Convert.ToDateTime(s)
                };

                certificationList.Add(newCert);

                s = sr.ReadLine();
            }

            return(certificationList);
        }
예제 #2
0
        private static IList <Opening> GetOpenings(string location)
        {
            var sr = new StreamReader(location);

            var openings = new List <Opening>();

            var    foreignKey = new ForeignKeys();
            string s          = sr.ReadLine();

            while (s != null)
            {
                var split = s.Split(',');

                var newOpening = new Opening
                {
                    StartingDate       = Convert.ToDateTime(split[0]),
                    AnticipatedEndDate = Convert.ToDateTime(split[1]),
                    HourlyPay          = Convert.ToDouble(split[2]),
                    QualificationId    = foreignKey.GetRandomQualification(),
                    CompanyId          = foreignKey.GetRandomCompany()
                };

                openings.Add(newOpening);

                s = sr.ReadLine();
            }

            return(openings);
        }
예제 #3
0
        public static void GeneratePrerequisites()
        {
            using var context = new TecContext();
            var foreignKey = new ForeignKeys();

            for (int i = 0; i < 200; i++)
            {
                var newCoursePrerequisite = new Prerequisite()
                {
                    CourseId        = foreignKey.GetRandomCourse(),
                    QualificationId = foreignKey.GetRandomQualification(),
                    RequirementFor  = context.Prerequisites.Count() % 2 == 0 ?
                                      "Course" : "Qualification"
                };


                context.Add(newCoursePrerequisite);
                context.SaveChanges();
            }
        }