//Get skills Request Button private void getSkillsKnownButton_Click(object sender, EventArgs e) { try { IStudentSkillsSet _studentSkillSet = new StudentSkillsSet(); _studentID = 700; Technlogies _resultTechDetails = _studentSkillSet.getStudentSkillSetById(_studentID); displayUIProgLangLabel.Text = (_resultTechDetails.UIProgramming); displayProgrammingLangsLable.Text = _resultTechDetails.ProgrammingLang; displayDBLangLabel.Text = _resultTechDetails.DbProgramming; tools1TextBox.Text = _resultTechDetails.Tools; Certifications1TextBox.Text = _resultTechDetails.Certificates; commentsTextBox.Text = _resultTechDetails.Comments; OthersTextBox.Text = _resultTechDetails.Others; programmingCheckedListBox.ClearSelected(); uiLanguagesCheckedListBox.ClearSelected(); dbLanguagesCheckedListBox.ClearSelected(); } catch (Exception Ex) { MessageBox.Show(Ex.Message); } }
public string UpDateTechDetails(Technlogies studentTechDetail) { try { SqlCommand _userSqlCommand = new SqlCommand(); string _userCommandText = @"Update Technologies Set UIProgramming = @UIProgramming, ProgrammingLang = @ProgrammingLang, DbProgramming = @DbProgramming, Tools = @Tools, Certificates = @Certificates, TotalScore = @TotalScore, Others = @Others , Comments = @Comments where StudentId = @StudentId "; _userSqlCommand.Connection = _studentDatabaseConnection.OpenSQlDatabaseConnection(); _userSqlCommand.CommandText = _userCommandText; studentTechDetail.StudentId = 700; _userSqlCommand.Parameters.AddWithValue("@StudentID", studentTechDetail.StudentId); _userSqlCommand.Parameters.AddWithValue("@UIProgramming", studentTechDetail.UIProgramming); _userSqlCommand.Parameters.AddWithValue("@ProgrammingLang", studentTechDetail.ProgrammingLang); _userSqlCommand.Parameters.AddWithValue("@DbProgramming", studentTechDetail.DbProgramming); _userSqlCommand.Parameters.AddWithValue("@Tools", studentTechDetail.Tools); _userSqlCommand.Parameters.AddWithValue("@Certificates", studentTechDetail.Certificates); _userSqlCommand.Parameters.AddWithValue("@TotalScore", studentTechDetail.TotalScore); _userSqlCommand.Parameters.AddWithValue("@Others", studentTechDetail.Others); _userSqlCommand.Parameters.AddWithValue("@Comments", studentTechDetail.Comments); _userSqlCommand.ExecuteNonQuery(); return("Details added Successfully"); } catch (Exception Ex) { return(Ex.Message); } finally { _studentDatabaseConnection.CloseSqlDatabaseConnection(); } }
public Technlogies getStudentSkillSetById(int Id) { try { SqlCommand _userSqlCommand = new SqlCommand(); string _userCommandText = @"select *from Technologies where StudentId = @StudentId "; _userSqlCommand.Connection = _studentDatabaseConnection.OpenSQlDatabaseConnection(); _userSqlCommand.CommandText = _userCommandText; _userSqlCommand.Parameters.AddWithValue("@StudentId", Id); SqlDataReader _resultSkillsDetails = _userSqlCommand.ExecuteReader(); Technlogies _studentSkillsDetails = new Technlogies(); while (_resultSkillsDetails.Read()) { _studentSkillsDetails.UIProgramming = _resultSkillsDetails["UIProgramming"].ToString(); _studentSkillsDetails.ProgrammingLang = _resultSkillsDetails["ProgrammingLang"].ToString(); _studentSkillsDetails.DbProgramming = _resultSkillsDetails["DbProgramming"].ToString(); _studentSkillsDetails.Tools = _resultSkillsDetails["Tools"].ToString(); _studentSkillsDetails.Certificates = _resultSkillsDetails["Certificates"].ToString(); _studentSkillsDetails.Others = _resultSkillsDetails["Others"].ToString(); } return(_studentSkillsDetails); } catch (Exception Ex) { throw Ex; } finally { _studentDatabaseConnection.CloseSqlDatabaseConnection(); } }
public string insertStudentSkillsSet(Technlogies tech) { try { SqlCommand _userSqlCommand = new SqlCommand(); string _userCommandText = @"Insert INTO Technologies (StudentId, UIProgramming, ProgrammingLang, DbProgramming, Tools, Certificates, TotalScore, Others, Comments) values(@StudentId, @UIProgramming, @ProgrammingLang, @DbProgramming, @Tools,@Certificates, @TotalScore, @Others, @Comments) "; _userSqlCommand.Connection = _studentDatabaseConnection.OpenSQlDatabaseConnection(); _userSqlCommand.CommandText = _userCommandText; tech.StudentId = 700; _userSqlCommand.Parameters.AddWithValue("@StudentID", tech.StudentId); _userSqlCommand.Parameters.AddWithValue("@UIProgramming", tech.UIProgramming); _userSqlCommand.Parameters.AddWithValue("@ProgrammingLang", tech.ProgrammingLang); _userSqlCommand.Parameters.AddWithValue("@DbProgramming", tech.DbProgramming); _userSqlCommand.Parameters.AddWithValue("@Tools", tech.Tools); _userSqlCommand.Parameters.AddWithValue("@Certificates", tech.Certificates); _userSqlCommand.Parameters.AddWithValue("@TotalScore", tech.TotalScore); _userSqlCommand.Parameters.AddWithValue("@Others", tech.Others); _userSqlCommand.Parameters.AddWithValue("@Comments", tech.Comments); _userSqlCommand.ExecuteNonQuery(); return("Details added Successfully"); } catch (Exception Ex) { return(Ex.Message); } finally { _studentDatabaseConnection.CloseSqlDatabaseConnection(); } }
//Function to update Skills Button private void updateSkillsButton_Click(object sender, EventArgs e) { try { IStudentSkillsSet _skills = new StudentSkillsSet(); Technlogies tech = new Technlogies(); StringBuilder _stringBuild = new StringBuilder(); int count = 0; tech.StudentId = _studentID; foreach (var programmlangs in programmingCheckedListBox.CheckedItems) { count++; _stringBuild.Append(programmlangs); } if (_stringBuild.Length > 0) { tech.ProgrammingLang = _stringBuild.ToString(); } else { tech.ProgrammingLang = "None"; } _stringBuild.Clear(); foreach (var clientLangs in uiLanguagesCheckedListBox.CheckedItems) { count++; _stringBuild.Append(clientLangs); } if (_stringBuild.Length > 0) { tech.UIProgramming = _stringBuild.ToString(); } else { tech.UIProgramming = "None"; } _stringBuild.Clear(); foreach (var dbLangs in dbLanguagesCheckedListBox.CheckedItems) { count++; _stringBuild.Append(dbLangs); } if (_stringBuild.Length > 0) { tech.DbProgramming = _stringBuild.ToString(); } else { tech.DbProgramming = " None"; } _stringBuild.Clear(); if (!string.IsNullOrEmpty(tools1TextBox.Text)) { count++; _stringBuild.Append(tools1TextBox.Text); if (!string.IsNullOrEmpty(tools2TextBox.Text)) { count++; _stringBuild.Append(","); _stringBuild.Append(tools2TextBox.Text); } } if (_stringBuild.Length > 0) { tech.Tools = _stringBuild.ToString(); } else { tech.Tools = " None"; } _stringBuild.Clear(); if (!string.IsNullOrEmpty(Certifications1TextBox.Text)) { count++; _stringBuild.Append(Certifications1TextBox.Text); if (!string.IsNullOrEmpty(certification2TextBox.Text)) { count++; _stringBuild.Append(certification2TextBox.Text); } tech.Certificates = _stringBuild.ToString(); _stringBuild.Clear(); } else { tech.Certificates = "None"; } if (!string.IsNullOrEmpty(OthersTextBox.Text)) { tech.Others = OthersTextBox.Text; } else { tech.Others = "none"; } if (!string.IsNullOrEmpty(commentsTextBox.Text)) { tech.Comments = commentsTextBox.Text; } else { tech.Comments = "none"; } tech.TotalScore = count; string _result = _skills.UpDateTechDetails(tech); MessageBox.Show(_result); } catch (Exception Ex) { MessageBox.Show(Ex.Message); } }