private void btnDisplay_Click(object sender, EventArgs e) { string[] disp_list = null; try { disp_list = listBoxEmployees.SelectedItem.ToString().Split('\t'); update_index = listBoxEmployees.SelectedIndex; // Fill the fields txtFirstName.Text = disp_list[1]; txtLastName.Text = disp_list[2]; txtSIN.Text = disp_list[3]; tempsin = disp_list[3]; // Saving in case of choice modify option temp_id = Convert.ToInt16(disp_list[0]); // Saving ID in case of choice modify option cmbDept.Text = disp_list[4]; cmbCategory.Text = disp_list[5]; txtHDay.Text = disp_list[6]; txtHMonth.Text = disp_list[7]; txtHYear.Text = disp_list[8]; txtBDay.Text = disp_list[9]; txtBMonth.Text = disp_list[10]; txtBYear.Text = disp_list[11]; txtAddStrNo.Text = disp_list[12]; txtAddStrName.Text = disp_list[13]; txtAddApt.Text = disp_list[14]; txtAddCity.Text = disp_list[15]; txtAddState.Text = disp_list[16]; txtAddCountry.Text = disp_list[17]; txtAddZipCode.Text = disp_list[18]; txtHCountCode.Text = disp_list[19]; txtHCityCode.Text = disp_list[20]; txtHLocalCode.Text = disp_list[21]; txtCCountCode.Text = disp_list[23]; txtCCityCode.Text = disp_list[24]; txtCLocalCode.Text = disp_list[25]; txtEmail.Text = disp_list[27]; txtTwoWeeksSal.Text = disp_list[28]; txtKey.Text = disp_list[29]; if (cmbCategory.Text == "FullTime") { cmbFTPosition.Text = disp_list[30]; txtFTAnnualSalary.Text = disp_list[31]; } else if (cmbCategory.Text == "PartTime") { // Show Part Time Options cmbPTContractType.Show(); PTContTypelabel.Show(); txtPTContractMonth.Show(); PTContractMlabel.Show(); cmbPTContractType.Text = disp_list[30]; txtPTContractMonth.Text = disp_list[31]; if (cmbPTContractType.Text == "Consultant_Trainers") { // Show Consultant_Trainers Options txtPTContractMonth.ReadOnly = false; PTCTHourlySallabel.Show(); PTCTWeekHlabel.Show(); txtPTCTWeekHours.Show(); txtPTTCHourlySal.Show(); txtPTTCHourlySal.Text = disp_list[32]; txtPTCTWeekHours.Text = disp_list[33]; } else if (cmbPTContractType.Text == "Internship_Student") { // Show a Fixed Contract Internship Month txtPTContractMonth.ReadOnly = true; PTInternTrimlabel.Show(); txtPTInternSal.Show(); txtPTInternSal.Text = disp_list[32]; } } } catch { MessageBox.Show("It must to add or select an item and display it, use Display Option", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void cmbCategory_SelectedIndexChanged(object sender, EventArgs e) { if (cmbCategory.Text == "FullTime") { // Show Corresponding Full Time Options cmbFTPosition.Show(); FTAnualSallabel.Show(); txtFTAnnualSalary.Show(); FTPOSlabel.Show(); FTlab01.Show(); // Hide Others PTContractMlabel.Hide(); cmbPTContractType.Hide(); PTContTypelabel.Hide(); PTCTHourlySallabel.Hide(); PTCTWeekHlabel.Hide(); PTInternTrimlabel.Hide(); txtPTContractMonth.Hide(); txtPTCTWeekHours.Hide(); txtPTInternSal.Hide(); txtPTTCHourlySal.Hide(); PTTClab01.Hide(); PTINlab01.Hide(); } else if (cmbCategory.Text == "PartTime") { // Hide Corresponding Full Time Options cmbFTPosition.Hide(); FTAnualSallabel.Hide(); txtFTAnnualSalary.Hide(); FTPOSlabel.Hide(); FTlab01.Show(); // Show Part Time Options cmbPTContractType.Show(); PTContTypelabel.Show(); // Wait for selection of Contract Type combo PTContractMlabel.Hide(); PTCTHourlySallabel.Hide(); PTCTWeekHlabel.Hide(); PTInternTrimlabel.Hide(); txtPTContractMonth.Hide(); txtPTCTWeekHours.Hide(); txtPTInternSal.Hide(); txtPTTCHourlySal.Hide(); PTTClab01.Hide(); PTINlab01.Hide(); } else if (cmbCategory.Text == "Undefined") { // Hide all cmbFTPosition.Hide(); FTAnualSallabel.Hide(); txtFTAnnualSalary.Hide(); FTPOSlabel.Hide(); FTlab01.Hide(); PTContractMlabel.Hide(); cmbPTContractType.Hide(); PTContTypelabel.Hide(); PTCTHourlySallabel.Hide(); PTCTWeekHlabel.Hide(); PTInternTrimlabel.Hide(); txtPTContractMonth.Hide(); txtPTCTWeekHours.Hide(); txtPTInternSal.Hide(); txtPTTCHourlySal.Hide(); PTTClab01.Hide(); PTINlab01.Hide(); } }
private void cmbPTContractType_SelectedIndexChanged(object sender, EventArgs e) { if (cmbPTContractType.Text == "Consultant_Trainers") { // Hide Corresponding Full Time Options cmbFTPosition.Hide(); FTAnualSallabel.Hide(); txtFTAnnualSalary.Hide(); FTPOSlabel.Hide(); FTlab01.Hide(); // Show Part Time Options cmbPTContractType.Show(); PTContTypelabel.Show(); // Show Consultant_Trainers Options PTContractMlabel.Show(); PTCTHourlySallabel.Show(); PTCTWeekHlabel.Show(); txtPTContractMonth.Show(); txtPTContractMonth.Text = ""; txtPTContractMonth.ReadOnly = false; txtPTCTWeekHours.Show(); txtPTTCHourlySal.Show(); PTTClab01.Show(); // Hide Internship Options txtPTInternSal.Hide(); PTInternTrimlabel.Hide(); PTINlab01.Hide(); } else if (cmbPTContractType.Text == "Internship_Student") { // Hide Corresponding Full Time Options cmbFTPosition.Hide(); FTAnualSallabel.Hide(); txtFTAnnualSalary.Hide(); FTPOSlabel.Hide(); FTlab01.Hide(); // Show Part Time Options cmbPTContractType.Show(); PTContTypelabel.Show(); // Hide Consultant_Trainers Options PTCTHourlySallabel.Hide(); PTCTWeekHlabel.Hide(); txtPTCTWeekHours.Hide(); txtPTTCHourlySal.Hide(); PTTClab01.Hide(); // Show a Fixed Contract Internship Month txtPTContractMonth.Show(); txtPTContractMonth.Text = "3"; txtPTContractMonth.ReadOnly = true; PTContractMlabel.Show(); // Show Internship Options txtPTInternSal.Show(); PTInternTrimlabel.Show(); PTINlab01.Show(); } else if (cmbPTContractType.Text == "Undefined") { // Hide Corresponding Full Time Options cmbFTPosition.Hide(); FTAnualSallabel.Hide(); txtFTAnnualSalary.Hide(); FTPOSlabel.Hide(); // Hide Consultant_Trainers Options PTCTHourlySallabel.Hide(); PTCTWeekHlabel.Hide(); txtPTCTWeekHours.Hide(); txtPTTCHourlySal.Hide(); // Hide a Fixed Contract Internship Month txtPTContractMonth.Hide(); PTContractMlabel.Hide(); // Hide Internship Options txtPTInternSal.Hide(); PTInternTrimlabel.Hide(); } }