Documente Academic
Documente Profesional
Documente Cultură
* Created by SharpDevelop.
* User: User
* Date: 29/01/2019
* Time: 11:08 AM
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
namespace santosjacob_cpe1_2
{
/// <summary>
/// Description of MainForm.
/// </summary>
public partial class MainForm : Form
{
public MainForm()
{
//
// The InitializeComponent() call is required for Windows Forms
designer support.
//
InitializeComponent();
//
// TODO: Add constructor code after the InitializeComponent()
call.
//
}
void MainFormLoad(object sender, EventArgs e)
{
}
void ClearClick(object sender, EventArgs e)
{
EmpNameBox.Clear();
EmpNumBox.Clear();
PosCodeBox.Clear();
DaysWorkBox.Clear();
BasicPayBox.Clear();
SSSBox.Clear();
TaxBox.Clear();
NetPayBox.Clear();
Single.Checked=false;
Married.Checked=false;
Widow.Checked=false;
}
void ExitClick(object sender, EventArgs e)
{
this.Close();
}
void ComputeClick(object sender, EventArgs e)
{
if(Single.Checked==false && Married.Checked==false &&
Widow.Checked==false)
{
MessageBox.Show("Error!!! Choose your Civil Status");
}
}
else if(PosCode == 'B' || PosCode == 'b')
{
RateDay = 400.00;
}
else if(PosCode == 'C' || PosCode == 'c')
{
RateDay = 300.00;
}
else
{
MessageBox.Show("Invalid Position Code, Choose from A, B,
and C");
}
BasicPayBox.Text = string.Format("{0:F2}",(basicPay));
SSSBox.Text = string.Format("{0:F2}",(basicPay*sssrate));
TaxBox.Text = string.Format("{0:F2}",(basicPay*taxrate));
NetPayBox.Text = string.Format("{0:F2}",(basicPay -
(basicPay*sssrate) - (basicPay*taxrate)));
}
void EmpNumBoxTextChanged(object sender, EventArgs e)
{
EmpNumBox.MaxLength=6;
int numbox;
if(!int.TryParse(EmpNumBox.Text, out numbox))
{
MessageBox.Show("You have entered an invalid Employee
Number!");
EmpNumBox.Clear();
}
}
void EmpNameBoxTextChanged(object sender, EventArgs e)
{
int namebox;
if(int.TryParse(EmpNameBox.Text, out namebox))
{
MessageBox.Show("You have entered an invalid Employee
Name!");
EmpNameBox.Clear();
}
}
void PosCodeBoxTextChanged(object sender, EventArgs e)
{
PosCodeBox.MaxLength = 1;
if(PosCodeBox.Text == "A" || PosCodeBox.Text == "B" ||
PosCodeBox.Text == "C" || PosCodeBox.Text == "a" || PosCodeBox.Text == "b" ||
PosCodeBox.Text == "c")
{
}
else{
MessageBox.Show("You have entered an invalid Position
Code!");
PosCodeBox.Clear();
}
}
void DaysWorkBoxTextChanged(object sender, EventArgs e)
{
int days;
if(!int.TryParse(DaysWorkBox.Text, out days))
{
MessageBox.Show("You have entered an invalid Number of Days
Worked!");
DaysWorkBox.Clear();
}
}
}
}