Example #1
0
        private void metroTextBox6_TextChanged(object sender, EventArgs e)
        {
            string mo = metroTextBox6.Text;
            int    no = mo.Length;

            if (no > 10)
            {
                errorProvider1.SetError(metroTextBox6, "can contain only 10 Numbers");
                metroButton4.Enabled = false;
                metroButton5.Enabled = false;
            }

            else if (ValidateEmployee.isNumber(mo))
            {
                errorProvider1.SetError(metroTextBox6, "can contain only numbers");
                metroButton4.Enabled = false;
                metroButton5.Enabled = false;
            }
            else
            {
                errorProvider1.Clear();
                metroButton4.Enabled = true;
                metroButton5.Enabled = true;
            }
        }
Example #2
0
        private void metroDateTime1_ValueChanged(object sender, EventArgs e)
        {
            DateTime startDate = metroDateTime1.Value;
            DateTime endDate   = metroDateTime2.Value;

            if (ValidateEmployee.isInvalidStartDate(startDate.Date))
            {
                errorProvider1.SetError(metroDateTime1, "Invalid Date");
                metroButton1.Enabled = false;
                return;
            }
            else
            {
                errorProvider1.Clear();
                metroButton1.Enabled = true;
            }
            if (ValidateEmployee.isInvalidEndDate(endDate.Date, startDate.Date))
            {
                errorProvider1.SetError(metroDateTime2, "Invalid Date");
                metroButton1.Enabled = false;
            }
            else
            {
                errorProvider1.Clear();
                metroButton1.Enabled = true;
            }
        }
Example #3
0
        private void metroTextBox7_TextChanged(object sender, EventArgs e)
        {
            string m2 = metroTextBox6.Text;

            if (ValidateEmployee.EmailIsValid(m2))
            {
                errorProvider1.Clear();
            }
            else
            {
                errorProvider1.SetError(metroTextBox6, "Enter correct E-mail");
            }
        }
Example #4
0
        private void metroTextBox4_TextChanged(object sender, EventArgs e)
        {
            string ni  = metroTextBox4.Text;
            int    nic = ni.Length;

            if (nic < 10)
            {
                if (ValidateEmployee.isNumber(ni))
                {
                    errorProvider1.SetError(metroTextBox4, "can contain only numbers");
                    metroButton4.Enabled = false;
                    metroButton5.Enabled = false;
                }
                else
                {
                    errorProvider1.Clear();
                    metroButton4.Enabled = true;
                    metroButton5.Enabled = true;
                }
            }
            else if (nic == 10)
            {
                if (!(ni[9].Equals('v') || ni[9].Equals('V')))
                {
                    errorProvider1.SetError(metroTextBox4, "last character should be V");
                    metroButton4.Enabled = false;
                    metroButton5.Enabled = false;
                }
                else
                {
                    errorProvider1.Clear();
                    metroButton4.Enabled = true;
                    metroButton5.Enabled = true;
                }
            }

            else
            if (ValidateEmployee.isMaxLength(nic))
            {
                errorProvider1.SetError(metroTextBox4, "can contain only 10 Characters");
                metroButton4.Enabled = false;
                metroButton5.Enabled = false;
            }
            else
            {
                errorProvider1.Clear();
                metroButton4.Enabled = true;
                metroButton5.Enabled = true;
            }
        }
Example #5
0
        private void metroTextBox1_TextChanged(object sender, EventArgs e)
        {
            string sal = metroTextBox1.Text;

            if (ValidateEmployee.isNumber(sal))
            {
                errorProvider1.SetError(metroTextBox1, "can contain only numbers");
                // metroButton1.Enabled = false;
            }
            else
            {
                errorProvider1.Clear();
                // metroButton1.Enabled = true;
                calcGross();
            }
        }
Example #6
0
        private void metroTextBox2_TextChanged(object sender, EventArgs e)
        {
            string ded = metroTextBox2.Text;

            if (ValidateEmployee.isNumber(ded))
            {
                errorProvider1.SetError(metroTextBox2, "can contain only numbers");
                // metroButton1.Enabled = false;
            }
            else
            {
                errorProvider1.Clear();
                // metroButton1.Enabled = true;
                calcDeduction();
                calcNetPay();
            }
        }
Example #7
0
        private void metroTextBox2_TextChanged(object sender, EventArgs e)
        {
            string lname = metroTextBox2.Text;

            if (ValidateEmployee.isLetter(lname))
            {
                errorProvider1.SetError(metroTextBox2, "Can contain only letters");
                metroButton4.Enabled = false;
                metroButton5.Enabled = false;
            }
            else
            {
                errorProvider1.Clear();
                metroButton4.Enabled = true;
                metroButton5.Enabled = true;
            }
        }