private void dgvStaffExUser_CellClick(object sender, DataGridViewCellEventArgs e) { try { DAL.StaffClass staffClass = new DAL.StaffClass(int.Parse(dgvStaff.SelectedRows[0].Cells[0].Value.ToString())); var values = bll.SelectForUpdateStaffExUser(staffClass); txtStaffNumber.Text = values.Rows[0].Table.Rows[0].ItemArray[1].ToString(); txtName.Text = values.Rows[0].Table.Rows[0].ItemArray[2].ToString(); txtSurname.Text = values.Rows[0].Table.Rows[0].ItemArray[3].ToString(); txtEmailAddress.Text = values.Rows[0].Table.Rows[0].ItemArray[4].ToString(); txtContactNo.Text = values.Rows[0].Table.Rows[0].ItemArray[5].ToString(); cmbStaffType.SelectedItem = values.Rows[0].Table.Rows[0].ItemArray[6].ToString(); cmbDepartmentCode.SelectedValue = values.Rows[0].Table.Rows[0].ItemArray[7]; if (values.Rows[0].Table.Rows[0].ItemArray[10].ToString() == "True") { cmbStatus.SelectedItem = "Active"; } else { cmbStatus.SelectedItem = "Inactive"; } txtUsername.Text = values.Rows[0].Table.Rows[0].ItemArray[8].ToString(); txtPassword.Text = values.Rows[0].Table.Rows[0].ItemArray[9].ToString(); } #pragma warning disable CS0168 // The variable 'b' is declared but never used catch (Exception b) #pragma warning restore CS0168 // The variable 'b' is declared but never used { MessageBox.Show(b.Message); } }
protected void btnManageUpdate(object sender, EventArgs e) { try { DAL.StaffClass staff = new DAL.StaffClass(txtStaffNo.Text, txtFirstName.Text, txtLastName.Text, txtEmail.Text, int.Parse(txtContactNumber.Text), cmbStaffType.SelectedValue.ToString(), int.Parse(cmbDepartmentCode.SelectedValue.ToString()), txtUsername.Text, txtPassword.Text, cmbActiveStatus.SelectedValue.ToString()); int x = bll.UpdateStaff(staff); if (x > 0) { txtStaffNo.Text = ""; txtFirstName.Text = ""; txtLastName.Text = ""; txtEmail.Text = ""; txtContactNumber.Text = ""; cmbStaffType.Text = " "; cmbDepartmentCode.Text = " "; txtUsername.Text = ""; txtPassword.Text = ""; cmbActiveStatus.Text = " "; } else { } } catch (Exception b) { } dgStaff.DataSource = bll.GetStaff(); dgStaff.DataBind(); }
protected void cmbStaffTypeStaff_SelectedIndexChanged(object sender, EventArgs e) { try { DAL.StaffClass staff = new DAL.StaffClass { StaffType = cmbStaffTypeStaff.SelectedItem.ToString() }; dgStaff.DataSource = bll.Report_DisplayStaffByStaffType(staff); dgStaff.DataBind(); } #pragma warning disable CS0168 // The variable 'b' is declared but never used catch (Exception b) #pragma warning restore CS0168 // The variable 'b' is declared but never used { } }
private void BtnManageAdd_Click(object sender, EventArgs e) { try { string activeStatus = ""; if (cmbStatus.SelectedItem.ToString() == "Active") { activeStatus = "True"; } else { activeStatus = "False"; } DAL.StaffClass staff = new DAL.StaffClass(txtStaffNumber.Text, txtName.Text, txtSurname.Text, txtEmailAddress.Text, int.Parse(txtContactNo.Text), cmbStaffType.SelectedItem.ToString(), int.Parse(cmbDepartmentCode.SelectedValue.ToString()), txtUsername.Text, txtPassword.Text, activeStatus); int x = bll.AddStaff(staff); if (x > 0) { txtStaffNumber.Clear(); txtName.Clear(); txtSurname.Clear(); txtEmailAddress.Clear(); txtContactNo.Clear(); cmbStaffType.Text = " "; cmbDepartmentCode.Text = " "; cmbStatus.Text = " "; txtUsername.Clear(); txtPassword.Clear(); } else { MessageBox.Show("Please input valid data."); } } #pragma warning disable CS0168 // The variable 'b' is declared but never used catch (Exception b) #pragma warning restore CS0168 // The variable 'b' is declared but never used { MessageBox.Show("Please input valid data."); } dgvStaff.DataSource = bll.GetStaff(); }
private void cmbDepartmentCode_SelectedIndexChanged(object sender, EventArgs e) { try { if (cmbDepartmentCode.ValueMember != "") { DAL.StaffClass staff = new DAL.StaffClass { DepartmentCode = int.Parse(cmbDepartmentCode.SelectedValue.ToString()) }; dgvStaffReport.DataSource = bll.Report_DisplayStaffByDepartment(staff); } } #pragma warning disable CS0168 // The variable 'b' is declared but never used catch (Exception b) #pragma warning restore CS0168 // The variable 'b' is declared but never used { } }
private void cmbStaffType_SelectedIndexChanged(object sender, EventArgs e) { try { if (cmbStaffType.SelectedText != "") { DAL.StaffClass staff = new DAL.StaffClass { StaffType = cmbStaffType.SelectedItem.ToString() }; dgvStaffReport.DataSource = bll.Report_DisplayStaffByStaffType(staff); } } #pragma warning disable CS0168 // The variable 'b' is declared but never used catch (Exception b) #pragma warning restore CS0168 // The variable 'b' is declared but never used { } }
protected void dgStaff_SelectedIndexChanged(object sender, EventArgs e) { try { DAL.StaffClass staffClass = new DAL.StaffClass(int.Parse(dgStaff.SelectedItem.Cells[1].Text.ToString())); var values = bll.SelectForUpdateStaffExUser(staffClass); txtStaffNo.Text = values.Rows[0].Table.Rows[0].ItemArray[1].ToString(); txtFirstName.Text = values.Rows[0].Table.Rows[0].ItemArray[2].ToString(); txtLastName.Text = values.Rows[0].Table.Rows[0].ItemArray[3].ToString(); txtEmail.Text = values.Rows[0].Table.Rows[0].ItemArray[4].ToString(); txtContactNumber.Text = values.Rows[0].Table.Rows[0].ItemArray[5].ToString(); cmbStaffType.SelectedValue = values.Rows[0].Table.Rows[0].ItemArray[6].ToString(); cmbDepartmentCode.SelectedValue = values.Rows[0].Table.Rows[0].ItemArray[7].ToString(); } catch (Exception b) { } }