private void btn_AdminSpeciality_Search_Click(object sender, RoutedEventArgs e) { try { int specId = Convert.ToInt32(textBox_AdminSpeciality_ID.Text); DataTable sEd = Speciality_BL.SearchSpecialityById_BL(specId); DataRow dr = sEd.Rows[0]; if (!dr.IsNull("Speciality_Id")) { textBox_AdminSpeciality_ID.Text = dr["Speciality_Id"].ToString(); textBox_AdminSpeciality_Name.Text = dr["Speciality_Name"].ToString(); } else { MessageBox.Show("No Records found with Speciality Id : " + specId); } } catch (HRMSException ex) { MessageBox.Show(ex.Message); } catch (SqlException ex) { MessageBox.Show(ex.Message); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btn_AdminSpeciality_Update_Click(object sender, RoutedEventArgs e) { try { Speciality newSpec = new Speciality(); newSpec.SpecialityId = Convert.ToInt32(textBox_AdminSpeciality_ID.Text); newSpec.SpecialityName = textBox_AdminSpeciality_Name.Text; int rowsAffected = Speciality_BL.UpdateSpeciality_BL(newSpec); if (rowsAffected > 0) { MessageBox.Show("Speciality Updated !!"); } else { MessageBox.Show("Error!!! Speciality 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_AdminSpeciality_Delete_Click(object sender, RoutedEventArgs e) { try { int specId = Convert.ToInt32(textBox_AdminSpeciality_ID.Text); int rowsAffected = Speciality_BL.DeleteSpeciality_BL(specId); if (rowsAffected > 0) { MessageBox.Show("Speciality Details Deleted !!"); } else { MessageBox.Show("Error!!! Speciality 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_AdminSpeciality_Display_Click(object sender, RoutedEventArgs e) { try { DataTable dtSpec = Speciality_BL.DisplaySpeciality_BL(); dg_AdminSpeciality_Details.ItemsSource = dtSpec.DefaultView; } catch (HRMSException ex) { MessageBox.Show(ex.Message); } catch (SqlException ex) { MessageBox.Show(ex.Message); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
//Window Loaded private void Window_Loaded(object sender, RoutedEventArgs e) { textBox_AdminSpeciality_ID.Text = Speciality_BL.GetAutogeneratedSpecialityID_BL().ToString(); }
private void btn_AdminSpeciality_Reset_Click(object sender, RoutedEventArgs e) { textBox_AdminSpeciality_ID.Text = Speciality_BL.GetAutogeneratedSpecialityID_BL().ToString(); textBox_AdminSpeciality_Name.Clear(); }