private Participant InitializeParticipant() { int collegeID = -1; if (DDLCollege.SelectedItem.Value == "-1") { collegeID = Participant.AddNewCollege(TxtBxCollege.Text); } else { collegeID = int.Parse(DDLCollege.SelectedValue); } int partnerID; if (TxtBxPartnerID.Text == "") { partnerID = 0; } else { partnerID = int.Parse(TxtBxPartnerID.Text.Substring(2)); } Participant participant = new Participant { Name = TxtBxName.Text, CollegeID = collegeID, WantAccomodation = CBWantAccomodation.Checked, Branch = (BranchType)Enum.Parse(typeof(BranchType), DDLBranch.SelectedValue), ContactNo = TxtBxContactNo.Text, EmailID = TxtBxEmail.Text, Gender = (GenderType)Enum.Parse(typeof(GenderType), RBLGender.SelectedValue), PartnerID = partnerID, Password = GeneratePassword(), StudentNo = TxtBxStudentNo.Text, WantTShirt = CBWantTShirt.Checked, Year = int.Parse(DDLYear.SelectedValue) }; return(participant); }