public bool BLL_AddStudentSkill(AddStudentSkill addStudentSkill) { return(dBAccess.AddStudentSkill(addStudentSkill)); }
protected void btnCreateSProfile_Click(object sender, EventArgs e) { AddStudent addStudent = new AddStudent(); AddStudentSkill addStudentSkill = new AddStudentSkill(); AddStudentQual addStudentQual = new AddStudentQual(); string pathhh = ""; HttpPostedFile profilePicture1; //HttpPostedFile cv1; //foreach (TableRow r in tblSkillIDs.Rows) //{ // addStudentSkill.studentNo = int.Parse(txtStudentNo.Text); // addStudentSkill.skillID = int.Parse(r.ToString()); //} int o = 0; int p = 0; foreach (TableRow s in tblSkillIDs.Rows) { foreach (TableCell c in s.Cells) { o = Convert.ToInt32(c.Text); //if you want to get the string //int s = o = tblSkillIDs.Rows[i]; addStudentSkill.studentNo = int.Parse(txtStudentNo.Text); addStudentSkill.skillID = o; } BLL_handler.BLL_AddStudentSkill(addStudentSkill); } foreach (TableRow s in tblQualIDs.Rows) { foreach (TableCell c in s.Cells) { p = Convert.ToInt32(c.Text); addStudentQual.studentNo = int.Parse(txtStudentNo.Text); addStudentQual.qualID = p; } BLL_handler.BLL_AddStudentQual(addStudentQual); } if (uploadCV.HasFile) { string f1 = Path.GetFileNameWithoutExtension(uploadCV.FileName); string f2 = Path.GetExtension(uploadCV.FileName); f1 = txtStudentNo.Text; pathhh = "CV/" + f1; uploadCV.PostedFile.SaveAs(Server.MapPath("CV/" + f1 + f2)); //uploadCV.SaveAs(Server.MapPath("CV\\" + uploadCV.FileName)); //Page.ClientScript.RegisterStartupScript(this.GetType(), "Scripts", "<script>alert('yes');</script>"); } try { addStudent.studentNo = int.Parse(txtStudentNo.Text); //addStudent.studentNo = 215333608; addStudent.studentFirstName = txtFisrtName.Text; addStudent.studentLastName = txtLastName.Text; addStudent.studentDateOfBirth = DateTime.Parse(txtDateofBirth.Text); addStudent.countryID = Convert.ToInt32(ddlCountries.SelectedItem.Value); addStudent.cityID = Convert.ToInt32(ddlCities.SelectedItem.Value); addStudent.studentEmail = txtEmail.Text; //addStudent.studentEmail = "[email protected]"; addStudent.studentContactNo = txtContactNo.Text; //addStudent.industryID = Convert.ToInt32(ddlIndustry.SelectedItem.Value); addStudent.industryID = Convert.ToInt32(txtChosenIndID.Text); addStudent.qualificationID = 1; addStudent.skillID = 1; if (rbtnDriversYes.Checked == true) { addStudent.driversLicence = "yes"; } else { addStudent.driversLicence = "no"; } ///end image add profilePicture1 = uploadImage.PostedFile; int profilepictureint = profilePicture1.ContentLength; byte[] bytImg = new byte[profilepictureint]; addStudent.profilePicture = bytImg; addStudent.studentUsername = txtStudUsername.Text; addStudent.studentPassword = txtStudPassword.Text; //addStudent.studentPassword = "******"; // CV // cv1 = uploadCV.PostedFile; addStudent.cv = pathhh; addStudent.cvDate = DateTime.Now; addStudent.statusID = 1; addStudent.lastUpdate = DateTime.Now; ///////////////////////////////////////SKILLS////////////////////////////////// //foreach(TableRow r in tblSkillIDs.Rows) //{ // addStudentSkill.studentNo = int.Parse(txtStudentNo.Text); // addStudentSkill.skillID = int.Parse(r.ToString()); //} //BLL_handler.BLL_AddStudentSkill(addStudentSkill); BLL_handler.BLL_AddStudent(addStudent); Page.ClientScript.RegisterStartupScript(this.GetType(), "Scripts", "<script>alert('You have successfully created your profile');</script>"); } catch (Exception ex) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Scripts", "<script>alert('There was a problem with creating your profile. Please retype all the fields');</script>"); txtStudentNo.Text = ""; txtFisrtName.Text = ""; txtLastName.Text = ""; txtDateofBirth.Text = ""; /////////////////////////////////add city txtEmail.Text = ""; txtContactNo.Text = ""; txtStudUsername.Text = ""; txtStudPassword.Text = ""; } Response.Redirect("View_Student_Profile.aspx?studentNumber=" + txtStudentNo.Text, false); }