Beispiel #1
0
        public static void InternShipRequirementsClassTest()
        {
          
            //IntershipRequirement Section.
         

            //Testing default constructor

            InternshipRequirement objRequirement = new InternshipRequirement();
            //Testing Default Constructor
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("RequirementId= " + objRequirement.RequirementId);
            // Console.WriteLine("Intership StudentID is = " + objRequirement.StudentID);


            Console.WriteLine("DriverLicense is = " + objRequirement.DriverLicense);
            Console.WriteLine("Type is = " + objRequirement.InternshipType);

            Console.WriteLine("Owncar is = " + objRequirement.Owncar);
            Console.WriteLine("Travelnj is = " + objRequirement.TravelNJ);

            Console.WriteLine("TravelWestchesterNY is = " + objRequirement.TravelWestchester);
            Console.WriteLine("ResidenceStatus is = " + objRequirement.ResidenceStatus);
            Console.WriteLine("AnyLimitation is = " + objRequirement.Limitation);

            Console.WriteLine("LimitationExplain is = " + objRequirement.LimitationExplanation);
            Console.WriteLine("PrefernceRanks is null = " + objRequirement.PreferenceRanks == null);
            Console.WriteLine("ModulesTaken is null = " + objRequirement.ModulesTaken == null);


            //Testing PROPERTIES BY SETTING & GETTING PROPERTIES
            Console.WriteLine("Testing Property SET");
            Console.WriteLine();

            objRequirement.RequirementId = 40;
            objRequirement.DriverLicense = true;
            objRequirement.InternshipType = InternshipType.Project;
            objRequirement.Owncar = true;
            objRequirement.TravelNJ = true;
            objRequirement.TravelWestchester = true;
            objRequirement.ResidenceStatus = ResidenceStatus.PermanentResident;
            objRequirement.Limitation = true;
            objRequirement.LimitationExplanation = "Explanation goes here";

            objRequirement.ModulesTaken = new ModuleTakenCollection();
            objRequirement.PreferenceRanks = new PreferenceRankCollection();

            Console.WriteLine();
            Console.WriteLine();



            //Testing property SET by performing a PROPERTY GET. If what you GET is what you SET, properties are working
            
            Console.WriteLine("RequirementId= " + objRequirement.RequirementId);
            // Console.WriteLine("Intership StudentID is = " + objRequirement.StudentID);


            Console.WriteLine("DriverLicense is = " + objRequirement.DriverLicense);
            Console.WriteLine("Type is = " + objRequirement.InternshipType);

            Console.WriteLine("Owncar is = " + objRequirement.Owncar);
            Console.WriteLine("Travelnj is = " + objRequirement.TravelNJ);

            Console.WriteLine("TravelWestchesterNY is = " + objRequirement.TravelWestchester);
            Console.WriteLine("ResidenceStatus is = " + objRequirement.ResidenceStatus);
            Console.WriteLine("AnyLimitation is = " + objRequirement.Limitation);

            Console.WriteLine("LimitationExplain is = " + objRequirement.LimitationExplanation);
            Console.WriteLine("PrefernceRanks is null = " + objRequirement.PreferenceRanks == null);
            Console.WriteLine("ModulesTaken is null = " + objRequirement.ModulesTaken == null);


            Console.WriteLine();
            Console.WriteLine();

        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        ///
        public bool Edit(string strStudentID, string strLast4, string strFName, string strLName, string strAddress, string strCity, string strState, string strZip,
                         string strCell, string strDay, string strEvening, decimal decGPA, string strEMail, DateTime dt, InternshipRequirement intReq, Employer emp)
        {
            try
            {
                Student objItem = new Student();

                // Get a Reference of pointer to the actual object inside the collection.
                // Use CType() function to convert object retrieved from list to clsCustomer

                if (objItem == null)
                {
                    return(false);
                }

                else
                {
                    objItem.StudentID             = strStudentID;
                    objItem.Last4SSN              = strLast4;
                    objItem.FirstName             = strFName;
                    objItem.LastName              = strLName;
                    objItem.Address               = strAddress;
                    objItem.City                  = strCity;
                    objItem.State                 = strState;
                    objItem.Zipcode               = strZip;
                    objItem.PhoneCell             = strCell;
                    objItem.PhoneDay              = strDay;
                    objItem.PhoneEvening          = strEvening;
                    objItem.GPA                   = decGPA;
                    objItem.Email                 = strEMail;
                    objItem.GraduationDate        = dt;
                    objItem.InternshipRequirement = intReq;
                    objItem.Employer              = emp;

                    return(true);
                }
            }

            catch (ArgumentNullException ex)
            {
                throw new System.ArgumentNullException("Invalid Key Error: " + ex.Message);
            }

            catch (ArgumentException ex)
            {
                throw new System.ArgumentException("Duplicate Key Error: " + ex.Message);
            }

            catch (Exception ex)
            {
                throw new System.Exception("Exception: '" + ex.Message + "' occured while adding student data via 'public void Add(string key, Student objStudent)' method");
            }
        }
Beispiel #3
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);
        }