public override bool MapData(DataRow row) { try { int requirementId = GetInt(row, "RequirementId"); this.RequirementId = requirementId; this.DriverLicense = GetBool(row, "DriverLicense"); this.Owncar = GetBool(row, "Owncar"); this.TravelNJ = GetBool(row, "TravelNJ"); this.TravelWestchester = GetBool(row, "TravelWestchester"); this.Limitation = GetBool(row, "Limitation"); this.LimitationExplanation = GetString(row, "LimitationExplanation"); this.Semester = GetString(row, "Semester"); this.ResidenceStatus = (ResidenceStatus)Enum.Parse(typeof(ResidenceStatus), GetString(row, "ResidenceStatus")); this.InternshipType = (InternshipType)Enum.Parse(typeof(InternshipType), GetString(row, "InternshipType")); this.ModulesTaken = ModuleTakenCollection.Load(requirementId); this.PreferenceRanks = PreferenceRankCollection.Load(requirementId); // this.studentContent = StudentContent.LoadItAll(_SCrequirementId); return(true); } catch (Exception) { throw; } }
public InternshipRequirement() { _requirementId = -1; studentContent = new StudentContent(); ModulesTaken = new ModuleTakenCollection(); PreferenceRanks = new PreferenceRankCollection(); _limitationExplanation = ""; }
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); }