예제 #1
0
        public static string StudentInsert()
        {
            Console.WriteLine("Loading Modules from the Database");
            ModuleCollection objModules = ModuleCollection.GetAll();

            foreach (var m in objModules)
            {
                Console.WriteLine("ModuleId: {0} Description: {1}", m.ModuleId, m.Description);
            }

            Console.WriteLine();


            Console.WriteLine("Loading Preference from the Database");
            PreferenceOptionCollection objPrefrences = PreferenceOptionCollection.GetAll();

            foreach (var p in objPrefrences)
            {
                Console.WriteLine("PrefernceId: {0} Description: {1}", p.PreferenceId, p.Description);
            }


            Console.WriteLine();

            PreferenceRankCollection objPrefernceRanks = new PreferenceRankCollection()
            {
                new PreferenceRank(objPrefrences[0], 1),
                new PreferenceRank(objPrefrences[1], 5),
                new PreferenceRank(objPrefrences[2], 3),
                new PreferenceRank(objPrefrences[3], 4),
            };



            ModuleTakenCollection objModulesTaken = new ModuleTakenCollection
            {
                new ModuleTaken(objModules[0]),
                new ModuleTaken(objModules[1]),
                new ModuleTaken(objModules[2]),
            };



            StudentContent objFileUpload = new StudentContent
            {
                Resume     = @"\\somewhere\Resume",
                Transcript = @"\\somewhere\Transcript",
            };

            InternshipRequirement objRequirement = new InternshipRequirement
            {
                DriverLicense         = true,
                InternshipType        = InternshipType.Project,
                Owncar                = true,
                TravelNJ              = true,
                TravelWestchester     = true,
                ResidenceStatus       = ResidenceStatus.PermanentResident,
                Limitation            = true,
                LimitationExplanation = "Explanation goes here",
                Semester              = "Fall 2013",
                PreferenceRanks       = objPrefernceRanks,
                ModulesTaken          = objModulesTaken,
                studentContent        = objFileUpload
            };

            Employer objEmployer = new Employer
            {
                Title          = "Programmer",
                CompanyName    = "Sunrise",
                Department     = "IT",
                SupervisorName = "Roger Razim",
                Address        = "76 Stone St",
                City           = "New York",
                State          = "NY",
                Zipcode        = "11368",
                PhoneNumber    = "917-487-5876",
                Duties         = "Debuger"
            };

            var objStudent = new Student
            {
                StudentID             = "89498196",
                FirstName             = "Joe",
                LastName              = "Smith",
                Last4SSN              = "1234",
                Address               = "333 Flatbush Avenue",
                City                  = "Brooklyn",
                State                 = "NY",
                Zipcode               = "11201",
                PhoneDay              = "7182605555",
                PhoneEvening          = "7182605551",
                PhoneCell             = "9172605552",
                Email                 = "*****@*****.**",
                GraduationDate        = new DateTime(2012, 01, 01),
                GPA                   = 3.9m,
                InternshipRequirement = objRequirement,
                Employer              = objEmployer
            };

            objStudent.Insert();



            return(objStudent.StudentID);
        }