/// <summary> /// Purpose: Displays an employees data values /// </summary> /// <param name="emp">Employee Object</param> private void DisplayEmployeeObject(Employee emp) { RTxtDisplay.AppendText(CRLF); RTxtDisplay.AppendText(emp.EmpID + CRLF); RTxtDisplay.AppendText(emp.EmpName + CRLF); RTxtDisplay.AppendText(emp.EmpType + CRLF); switch (emp.EmpType) { case ETYPE.SAL: RTxtDisplay.AppendText(emp.MonthlySalary + CRLF); break; case ETYPE.HRLY: RTxtDisplay.AppendText(emp.HourlyRate + CRLF); RTxtDisplay.AppendText(emp.HoursWorked + CRLF); break; case ETYPE.SLS: RTxtDisplay.AppendText(emp.MonthlySalary + CRLF); RTxtDisplay.AppendText(emp.ComSales + CRLF); RTxtDisplay.AppendText(emp.GrossSales + CRLF); break; case ETYPE.CNCT: RTxtDisplay.AppendText(emp.HoursWorked + CRLF); break; } }
//-------------------------------- GUI Support Methods -------------------------------------- /// <summary> /// Purpose: To clear GUI Interface /// </summary> public void ClearGUI() { _count = 0; RBtnSalary.Checked = false; RBtnHourly.Checked = false; RBtnSales.Checked = false; RBtnContract.Checked = false; TxtEmpID.Text = EMPID; TxtName.Text = EMPNAME; TxtEmpType.Text = EMPTY + ETYPE.NONE; LblValue0.Text = LABEL0; TxtValue0.Text = DZERO; LblValue0.Show(); TxtValue0.Show(); LblValue1.Text = LABEL1; TxtValue1.Text = DZERO; LblValue1.Show(); TxtValue1.Show(); LblValue2.Text = LABEL2; TxtValue2.Text = DZERO; LblValue2.Show(); TxtValue2.Show(); RTxtDisplay.Clear(); RTxtDisplay.AppendText(MSG0); }
}//End MenuExit() /// <summary> /// Event to grab stuff from textboxes and ending on an empty string. /// </summary> public bool GetInput() { bl.GrabName = TxtName.Text; bl.GrabScore = TxtScore.Text; bl.Grab4Split = TxtName.Text + "," + TxtScore.Text; if (bl.GrabName == "") { return false; } else { try { RTxtDisplay.Clear(); bl.AddNewPlayer(); bl.DisplayResults(); //RTxtDisplay.SelectionAlignment = HorizontalAlignment.Center; RTxtDisplay.AppendText(bl.DisplayResults()); bl.SplitIsStupidInGui(); // THIS IS ONLY TO MEET SPEC, AND IS A HUGE WASTE OF TIME. } catch (IndexOutOfRangeException a) { RTxtDisplay.Clear(); RTxtDisplay.AppendText(a.Message); return false; } catch (Exception b) { RTxtDisplay.Clear(); RTxtDisplay.AppendText(b.Message); } } return true; }//End GetInput()
}//End GetInput() /// <summary> /// An Event to fill the array, and on full or empty string, display the results. /// </summary> /// <param name="sender">BtnAdd_Clic</param> /// <param name="e">Not Used</param> private void BtnAdd_Click(object sender, EventArgs e) { if (GetInput() == false) { RTxtDisplay.AppendText(bl.DisplayResults()); } TxtName.Focus(); TxtName.SelectAll(); }//End BtnAdd()
/// <summary> /// Purpose: To Display A Test Data Object /// </summary> public void DisplayTextEmployee() { if (_count >= _eList.Count) { BtnClear_Click(BtnTestData, null); return; } RTxtDisplay.AppendText(CRLF); TxtEmpID.Text = "" + _eList[_count].EmpID; RTxtDisplay.AppendText(_eList[_count].EmpID + CRLF); TxtName.Text = _eList[_count].EmpName; RTxtDisplay.AppendText(_eList[_count].EmpName + CRLF); TxtEmpType.Text = "" + _eList[_count].EmpType; RTxtDisplay.AppendText(_eList[_count].EmpType + CRLF); SetGUIState(_eList[_count].EmpType); }
/// <summary> /// Purpose: To set and display the GUI Interface to the proper Employee Type /// </summary> /// <param name="type">ETYPE - Sal, SLS, HRLY, CNCT, NONE, BAD</param> public void SetGUIState(ETYPE type) { switch (type) { case ETYPE.SAL: RBtnSalary.Checked = true; LblValue0.Text = SALY; TxtValue0.Text = string.Format(FMTC, _eList[_count].MonthlySalary); RTxtDisplay.AppendText(TxtValue0.Text + CRLF); LblValue1.Hide(); TxtValue1.Hide(); LblValue2.Hide(); TxtValue2.Hide(); _count++; break; case ETYPE.HRLY: RBtnHourly.Checked = true; LblValue0.Text = HRLYRATE; TxtValue0.Text = string.Format(FMTC, _eList[_count].HourlyRate); RTxtDisplay.AppendText(TxtValue0.Text + CRLF); LblValue1.Text = HRSWORK; LblValue1.Show(); TxtValue1.Text = string.Format(FMTF, _eList[_count].HoursWorked); RTxtDisplay.AppendText(TxtValue1.Text + CRLF); TxtValue1.Show(); LblValue2.Hide(); TxtValue2.Hide(); _count++; break; case ETYPE.SLS: RBtnSales.Checked = true; LblValue0.Text = SALEMP; TxtValue0.Text = string.Format(FMTC, _eList[_count].MonthlySalary); LblValue1.Text = COMMSALES; LblValue1.Show(); TxtValue1.Text = string.Format(FMTP, _eList[_count].ComSales); RTxtDisplay.AppendText(TxtValue1.Text + CRLF); TxtValue1.Show(); LblValue2.Text = GROSSALES; TxtValue2.Text = string.Format(FMTC, _eList[_count].GrossSales); LblValue2.Show(); RTxtDisplay.AppendText(TxtValue2.Text + CRLF); TxtValue2.Show(); _count++; break; case ETYPE.CNCT: RBtnContract.Checked = true; LblValue0.Text = "Salary:"; TxtValue0.Text = string.Format(FMTC, _eList[_count].ContractSalary); RTxtDisplay.AppendText(TxtValue0.Text + CRLF); LblValue1.Hide(); TxtValue1.Hide(); LblValue2.Hide(); TxtValue2.Hide(); _count++; break; case ETYPE.NONE: RBtnSalary.Checked = false; RBtnHourly.Checked = false; RBtnSales.Checked = false; RBtnContract.Checked = false; TxtEmpID.Text = "" + _eList[_count].EmpID; TxtName.Text = _eList[_count].EmpName; TxtValue0.Text = string.Format(FMTC, _eList[_count].MonthlySalary); LblValue1.Hide(); TxtValue1.Hide(); LblValue2.Hide(); TxtValue2.Hide(); _count++; //goto case ETYPE.SAL; break; default: RBtnSalary.Checked = false; RBtnHourly.Checked = false; RBtnSales.Checked = false; RBtnContract.Checked = false; MessageBox.Show(MSG_IVT, MSG_IT, MessageBoxButtons.OKCancel, MessageBoxIcon.Error); TxtEmpID.Clear(); TxtName.Clear(); TxtEmpType.Text = "" + _eList[_count].EmpType; LblValue0.Text = LABELN; TxtValue0.Clear(); LblValue1.Hide(); TxtValue1.Hide(); LblValue2.Hide(); TxtValue2.Hide(); _count++; //goto case ETYPE.SAL; break; } }
}//End MnuAbout() /// <summary> /// An event used to dispay instruction about the program to the user via the RichTextBox /// </summary> /// <param name="sender">MnuInstructions_Click</param> /// <param name="e">Not Used</param> private void MnuInstructions_Click(object sender, EventArgs e) { RTxtDisplay.Clear(); RTxtDisplay.AppendText(NoMagicThings.INSTRUCTIONS_MSG); }//End MnuInstructions()
}//End FrmLoad() /// <summary> /// An event used to display information about the author in the RichTextBox /// </summary> /// <param name="sender">MnuAbout_Clic</param> /// <param name="e">Not Used</param> private void MnuAbout_Click(object sender, EventArgs e) { RTxtDisplay.Clear(); RTxtDisplay.AppendText(NoMagicThings.DIALOG_ABOUT); RTxtDisplay.AppendText(NoMagicThings.DIALOG_ABOUT_MSG); }//End MnuAbout()