private void btn_Project_Search_Click(object sender, RoutedEventArgs e) { try { int projId = Convert.ToInt32(txt_SrchProject.Text); DataTable sEd = Project_BL.SearchProjectById_BL(projId); DataRow dr = sEd.Rows[0]; if (!dr.IsNull("Project_Id")) { textBox_Project_ID.Text = dr["Project_Id"].ToString(); textBox_Project_Name.Text = dr["Project_Name"].ToString(); textBox_Project_Description.Text = dr["Project_Description"].ToString(); textBox_Project_Client.Text = dr["Project_Client"].ToString(); dtpkr_Project_StartDate.Text = dr["Project_Start_Date"].ToString(); dtpkr_Project_EndDate.Text = dr["Project_Start_Date"].ToString(); } else { MessageBox.Show("No Records found with Project Id : " + projId); } } catch (HRMSException ex) { MessageBox.Show(ex.Message); } catch (SqlException ex) { MessageBox.Show(ex.Message); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btn_Project_Delete_Click(object sender, RoutedEventArgs e) { try { int projId = Convert.ToInt32(txt_SrchProject.Text); int rowsAffected = Project_BL.DeleteProject_BL(projId); if (rowsAffected > 0) { MessageBox.Show("Project Details Deleted !!"); } else { MessageBox.Show("Error!!! Project 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_Project_Reset_Click(object sender, RoutedEventArgs e) { textBox_Project_ID.Text = Project_BL.GetAutogeneratedProjectID_BL().ToString(); txt_SrchProject.Clear(); textBox_Project_Name.Clear(); textBox_Project_Description.Clear(); textBox_Project_Client.Clear(); dtpkr_Project_StartDate.SelectedDate = null; dtpkr_Project_EndDate.SelectedDate = null; }
private void btn_Project_Display_Click(object sender, RoutedEventArgs e) { try { DataTable dtProj = Project_BL.DisplayProject_BL(); dg_UserProject_Details.ItemsSource = dtProj.DefaultView; } catch (HRMSException ex) { MessageBox.Show(ex.Message); } catch (SqlException ex) { MessageBox.Show(ex.Message); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btn_Project_Update_Click(object sender, RoutedEventArgs e) { try { Project newProj = new Project(); newProj.ProjectId = Convert.ToInt32(textBox_Project_ID.Text); newProj.ProjectName = textBox_Project_Name.Text; newProj.ProjectDescription = textBox_Project_Description.Text; newProj.ProjectClient = textBox_Project_Client.Text; newProj.ProjectStartDate = Convert.ToDateTime(dtpkr_Project_StartDate.Text); newProj.ProjectEndDate = Convert.ToDateTime(dtpkr_Project_EndDate.Text); int rowsAffected = Project_BL.UpdateProject_BL(newProj); if (rowsAffected > 0) { MessageBox.Show("Project Updated !!"); } else { MessageBox.Show("Error!!! Project Record not Updated"); } } 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"; } }