예제 #1
0
 //-------------------------------- 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);
 }
예제 #2
0
        /// <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;
            }
        }