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

            var    applicationsList = new List <Application>();
            var    foreignKey       = new ForeignKeys();
            string s = sr.ReadLine();

            while (s != null)
            {
                var application = new Application
                {
                    ApplicationDate = Convert.ToDateTime(s),
                    CandidateNumber = foreignKey.GetRandomCandidate(),
                    OpeningNumber   = foreignKey.GetRandomOpening(),
                };
                application.ApplicationStatus =
                    applicationsList.Count % 3 == 0 ? "Pending" : "Qualified";

                applicationsList.Add(application);

                s = sr.ReadLine();
            }

            return(applicationsList);
        }
예제 #2
0
        private static IList <JobHistory> GetJobHistories(string location)
        {
            var sr = new StreamReader(location);

            var historyList = new List <JobHistory>();

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

            while (s != null)
            {
                var split      = s.Split(',');
                var newHistory = new JobHistory
                {
                    CandidateNumber = foreignKey.GetRandomCandidate(),
                    CompanyId       = foreignKey.GetRandomCompany(),
                    WorkedHours     = Convert.ToDouble(split[0]),
                    WorkedFrom      = Convert.ToDateTime(split[1])
                };
                if (split[2] != "")
                {
                    newHistory.WorkedTo = Convert.ToDateTime(split[2]);
                }


                historyList.Add(newHistory);

                s = sr.ReadLine();
            }

            return(historyList);
        }
예제 #3
0
        private static IList <Placement> GetPlacements(string location)
        {
            var sr         = new StreamReader(location);
            var placements = new List <Placement>();

            var foreignKey = new ForeignKeys();

            string s = sr.ReadLine();

            while (s != null)
            {
                var newPlacement = new Placement
                {
                    OpeningNumber   = foreignKey.GetRandomOpening(),
                    CandidateNumber = foreignKey.GetRandomCandidate(),
                    //TotalWorkHours = Convert.ToDouble(s)
                };
                newPlacement.PlacementStatus =
                    placements.Count % 5 != 0 ? "Qualified" : "Pending";


                placements.Add(newPlacement);

                s = sr.ReadLine();
            }

            return(placements);
        }
예제 #4
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);
        }
예제 #5
0
        public static void GeneratePlacements()
        {
            using var context = new TecContext();
            var foreignKey = new ForeignKeys();

            for (int i = 0; i < 200; i++)
            {
                var newPlacement = new Placement
                {
                    CandidateNumber = foreignKey.GetRandomCandidate(),
                    OpeningNumber   = foreignKey.GetRandomOpening(),
                    PlacementStatus = i % 5 != 0 ? "Qualified" : "Pending"
                };

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