예제 #1
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);
        }
예제 #2
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);
        }
예제 #3
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();
            }
        }