private void btn_Skill_Search_Click(object sender, RoutedEventArgs e) { try { int skillId = Convert.ToInt32(textBox_SearchSkill.Text); DataTable sEd = Skill_BL.SearchSkillById_BL(skillId); DataRow dr = sEd.Rows[0]; if (!dr.IsNull("Skill_Id")) { textBox_Skill_ID.Text = dr["Skill_Id"].ToString(); textBox_Skill_Name.Text = dr["Skill_Name"].ToString(); textBox_Skill_Description.Text = dr["Skill_Description"].ToString(); cmb_Category_ID.SelectedValue = dr["Category_Id"].ToString(); } else { MessageBox.Show("No Records found with Skill Id : " + skillId); } } catch (HRMSException ex) { MessageBox.Show(ex.Message); } catch (SqlException ex) { MessageBox.Show(ex.Message); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btn_Skill_Reset_Click(object sender, RoutedEventArgs e) { textBox_Skill_ID.Text = Skill_BL.GetAutogeneratedSkillID_BL().ToString(); textBox_SearchSkill.Clear(); textBox_Skill_Name.Clear(); textBox_Skill_Description.Clear(); }
private void btn_Skill_Update_Click(object sender, RoutedEventArgs e) { try { Skill newSkill = new Skill(); newSkill.SkillId = Convert.ToInt32(textBox_Skill_ID.Text); newSkill.SkillName = textBox_Skill_Name.Text; newSkill.SkillDescription = textBox_Skill_Description.Text; newSkill.CategoryId = int.Parse(cmb_Category_ID.SelectedValue.ToString()); int rowsAffected = Skill_BL.UpdateSkill_BL(newSkill); if (rowsAffected > 0) { MessageBox.Show("Skill Updated !!"); } else { MessageBox.Show("Error!!! Skill Record not Updated"); } } catch (HRMSException ex) { MessageBox.Show(ex.Message); } catch (SqlException ex) { MessageBox.Show(ex.Message); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btn_Skill_Delete_Click(object sender, RoutedEventArgs e) { try { int skillId = Convert.ToInt32(textBox_SearchSkill.Text); int rowsAffected = Skill_BL.DeleteSkill_BL(skillId); if (rowsAffected > 0) { MessageBox.Show("Skill Details Deleted !!"); } else { MessageBox.Show("Error!!! Skill Record not found"); } } catch (HRMSException ex) { MessageBox.Show(ex.Message); } catch (SqlException ex) { MessageBox.Show(ex.Message); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btn_Skill_Display_Click(object sender, RoutedEventArgs e) { try { DataTable dtSkill = Skill_BL.DisplaySkill_BL(); dg_Skill_Details.ItemsSource = dtSkill.DefaultView; } catch (HRMSException ex) { MessageBox.Show(ex.Message); } catch (SqlException ex) { MessageBox.Show(ex.Message); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
//OnLoad Event private void Window_Loaded(object sender, RoutedEventArgs e) { textBox_Employee_Id.Text = EmployeeValidation.GetAutogeneratedEmployeeID_BL().ToString(); textBox_Project_ID.Text = Project_BL.GetAutogeneratedProjectID_BL().ToString(); textBox_Category_ID.Text = Category_BL.GetAutogeneratedCategoryID_BL().ToString(); textBox_Skill_ID.Text = Skill_BL.GetAutogeneratedSkillID_BL().ToString(); //Load Civil Status Data from Database DataTable dtCivil = EmployeeValidation.LoadCivilStatus_BL(); if (dtCivil.Rows.Count >= 0) { cmb_Employee_CivilStatus.ItemsSource = dtCivil.DefaultView; cmb_Employee_CivilStatus.DisplayMemberPath = "Status_Description"; cmb_Employee_CivilStatus.SelectedValuePath = "Status_Id"; } //Load Level Data from Database DataTable dtLvl = EmployeeValidation.LoadLevel_BL(); if (dtLvl.Rows.Count >= 0) { cmb_Employee_LevelID.ItemsSource = dtLvl.DefaultView; cmb_Employee_LevelID.DisplayMemberPath = "Level_Description"; cmb_Employee_LevelID.SelectedValuePath = "Level_Id"; } //Load Projects Data from Database DataTable dtProj = EmployeeValidation.LoadProject_BL(); if (dtProj.Rows.Count >= 0) { cmb_Employee_ProjectID.ItemsSource = dtProj.DefaultView; cmb_Employee_ProjectID.DisplayMemberPath = "Project_Name"; cmb_Employee_ProjectID.SelectedValuePath = "Project_Id"; } //Load Speciality Data from Database DataTable dtSpec = EmployeeValidation.LoadSeciality_BL(); if (dtSpec.Rows.Count >= 0) { cmb_Employee_Speciality.ItemsSource = dtSpec.DefaultView; cmb_Employee_Speciality.DisplayMemberPath = "Speciality_Name"; cmb_Employee_Speciality.SelectedValuePath = "Speciality_Id"; } //Load Skills Data from Database DataTable dtSkill = EmployeeValidation.LoadSkill_BL(); if (dtSkill.Rows.Count >= 0) { cmb_Employee_SkillID.ItemsSource = dtSkill.DefaultView; cmb_Employee_SkillID.DisplayMemberPath = "Skill_Name"; cmb_Employee_SkillID.SelectedValuePath = "Skill_Id"; } //Load Category Data from Database DataTable dtCat = Skill_BL.LoadCatSkill_BL(); if (dtCat.Rows.Count >= 0) { cmb_Category_ID.ItemsSource = dtCat.DefaultView; cmb_Category_ID.DisplayMemberPath = "Category_Name"; cmb_Category_ID.SelectedValuePath = "Category_Id"; } }