protected void BtnSubmitNewSkill_Click(object sender, EventArgs e) { Debug.WriteLine("Entering BtnSubmitNewSkill_Click"); ventureObj = (Venture)Session["ventureObj"]; int test = 0; int result; if (string.IsNullOrWhiteSpace(txtAddNewSkill.Text) == false) { //search expert's skillset to see if the skill added already exsists //search all skill to see if the skill added exsists //if not to both, add a new skill foreach (Tuple <int, String> skill in ventureObj.AllVentureSkills)//test if skill added is already in Expert's Skill Set { if (skill.Item2.Equals(txtAddNewSkill.Text, StringComparison.OrdinalIgnoreCase)) { test = -1; break; } } if (test != -1) { List <Skills> allSkills = DbMethodsObj.GetSkills(); foreach (Skills skill in allSkills)//handle adding the skill { if (skill.SkillName.Equals(txtAddNewSkill.Text, StringComparison.OrdinalIgnoreCase)) { result = DbMethodsObj.AddSkillToVenture(ventureObj.ventureID, skill.SkillID);//adding excisting skill to expert if (result != -1) { lblAddSkillTest.Text = "Success! New Skill was added to Skills and Expert_Skills Tables."; test = -2; break; } else { lblAddSkillTest.Text = "Error: Process did not execute successfully. :("; } break; } } if (test != -2) { result = DbMethodsObj.AddNewSkillToVenture(ventureObj.ventureID, txtAddNewSkill.Text);//adding brandnew skill if (result != -1) { lblAddSkillTest.Text = "Success! A New Skill was added to the Ventures wanted Skills."; } else { lblAddSkillTest.Text = "Error: Process did not execute successfully. :("; } } sm.storeVentureDataInSession(ventureObj.ventureID);//now get the whole expert object ventureObj = (Venture)Session["ventureObj"]; FillControls(); } else { lblAddSkillTest.Text = "Cannot add this skill. you already have this skill in your skill set."; } }//end if statement for textBoxes else { lblAddSkillTest.Text = "Error: Invalid input."; } }