Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CST4900Panel.Visible = false;
            CST4905Panel.Visible = false;

            StudentTestPanel1.Visible = false;

            //graduation date
            CompValidatorGradDte2.ValueToCompare = DateTime.Now.ToString("MM/dd/yyyy");
            //semester date
            // CompValidatorSemesterYear.ValueToCompare = DateTime.Now.ToString("yyyy");

            /* ASP.NET CODE REQUIRED TO DETERMINE IF THIS IS FIRST TIME PAGE IS LOADED (FIRST TRIP POSTBACK = False) OR IS THIS SECOND TRIP AND
             * FORWARD (POSTBACK = True) or POSTBACK/REVISIT OF THE PAGE AFTER IT HAS TRAVELLED BACK FROM CLIENT BROWSER.
             */
            if (!IsPostBack)
            {
                //One call to the database to load the moduels into the dropdown
                var modules = ModuleCollection.GetAll();

                ddlModule1.DataSource     = modules;
                ddlModule1.DataTextField  = "Description";
                ddlModule1.DataValueField = "ModuleId";
                ddlModule1.DataBind();

                ddlModule2.DataSource     = modules;
                ddlModule2.DataTextField  = "Description";
                ddlModule2.DataValueField = "ModuleId";
                ddlModule2.DataBind();

                ddlModule3.DataSource     = modules;
                ddlModule3.DataTextField  = "Description";
                ddlModule3.DataValueField = "ModuleId";
                ddlModule3.DataBind();

                // StudentCollection.Load();

                // Session.Add("objStudentList", objStudentList);
            }

            else
            {
                // >= SECOND TRIPS (PostBack = True)
                // Get Pointer to Collection stored in Session Object for USE Trought
                //Session.Add("objStudentList", objStudentList);
            }
        }
Beispiel #2
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);
        }