Example #1
0
        private bool IsFormValid()
        {
            if (FullNameTextBox.Text.Trim() == string.Empty)
            {
                JIMessageBox.ShowErrorMessage("Full Name is required.");
                FullNameTextBox.Focus();
                return(false);
            }

            if (NICTextBox.Text.Trim() == string.Empty)
            {
                JIMessageBox.ShowErrorMessage("NIC is required");
                NICTextBox.Focus();
                return(false);
            }

            if ((MobileETextBox.Text.Trim() == string.Empty) && (TelephoneTextBox.Text.Trim() == string.Empty))
            {
                JIMessageBox.ShowErrorMessage("Number is required");
                return(false);
            }

            if (GenderComboBox.SelectedIndex == -1)
            {
                JIMessageBox.ShowErrorMessage("Gender is required");
                GenderComboBox.Focus();
                return(false);
            }

            if (AddressLineTextBox.Text.Trim() == string.Empty)
            {
                JIMessageBox.ShowErrorMessage("Address is required");
                AddressLineTextBox.Focus();
                return(false);
            }

            if (CityComboBox.Text.Trim() == string.Empty)
            {
                JIMessageBox.ShowErrorMessage("City is required");
                CityComboBox.Focus();
                return(false);
            }

            if (DistrictComboBox.Text.Trim() == string.Empty)
            {
                JIMessageBox.ShowErrorMessage("District is required");
                DistrictComboBox.Focus();
                return(false);
            }

            if (PostCodeBox.Text.Trim() == string.Empty)
            {
                JIMessageBox.ShowErrorMessage("Post Code is required");
                PostCodeBox.Focus();
                return(false);
            }

            if (JobTitleComboBox.Text.Trim() == string.Empty)
            {
                JIMessageBox.ShowErrorMessage("Job Title is required");
                JobTitleComboBox.Focus();
                return(false);
            }

            if (CurrentSalaryTextBox.Text.Trim() == string.Empty)
            {
                JIMessageBox.ShowErrorMessage("Current Salary is required");
                CurrentSalaryTextBox.Focus();
                return(false);
            }

            else
            {
                if (Convert.ToDecimal(CurrentSalaryTextBox.Text.Trim()) < 1)
                {
                    JIMessageBox.ShowErrorMessage("Current Salary Cannot be Zero or Less");
                    CurrentSalaryTextBox.Focus();
                    return(false);
                }
            }

            if (StartingSalaryTextBox.Text.Trim() == string.Empty)
            {
                JIMessageBox.ShowErrorMessage("Starting Salary is required");
                StartingSalaryTextBox.Focus();
                return(false);
            }

            else
            {
                if (Convert.ToDecimal(StartingSalaryTextBox.Text.Trim()) < 1)
                {
                    JIMessageBox.ShowErrorMessage("Starting Salary Cannot be Zero or Less");
                    StartingSalaryTextBox.Focus();
                    return(false);
                }
            }

            return(true);
        }
Example #2
0
        private bool IsFormValidate()
        {
            if (FullNameTextBox.Text.Trim() == "")
            {
                MessageBox.Show("Full Name is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                FullNameTextBox.Clear();
                FullNameTextBox.Focus();
                return(false);
            }
            if (EmailAddressTextBox.Text.Trim() == "")
            {
                MessageBox.Show("Email is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                EmailAddressTextBox.Clear();
                EmailAddressTextBox.Focus();
                return(false);
            }
            if ((TelephoneTextBox.Text.Trim() == "") && (MobileTextBox.Text.Trim() == ""))
            {
                MessageBox.Show("Mobile or Telephone Number is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                TelephoneTextBox.Clear();
                TelephoneTextBox.Focus();
                return(false);
            }
            if (NICTextBox.Text.Trim() == "")
            {
                MessageBox.Show("NIC is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                NICTextBox.Clear();
                NICTextBox.Focus();
                return(false);
            }
            if (GenderComboBox.SelectedIndex == -1)
            {
                MessageBox.Show("Gender is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }

            if (AddressLineTextBox.Text.Trim() == "")
            {
                MessageBox.Show("Address is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                AddressLineTextBox.Clear();
                AddressLineTextBox.Focus();
                return(false);
            }
            if (CityComboBox.SelectedIndex == -1)
            {
                MessageBox.Show("City is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            if (DistrictComboBox.SelectedIndex == -1)
            {
                MessageBox.Show("District is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            if (PostCodeTextBox.Text.Trim() == "")
            {
                MessageBox.Show("PostCode is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                PostCodeTextBox.Clear();
                PostCodeTextBox.Focus();
                return(false);
            }
            if (JobTitleComboBox.SelectedIndex == -1)
            {
                MessageBox.Show("Job Title is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            if (CurrentSalaryTextBox1.Text.Trim() == "")
            {
                MessageBox.Show("Current Salary is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                CurrentSalaryTextBox1.Clear();
                CurrentSalaryTextBox1.Focus();
                return(false);
            }
            else
            {
                if (Convert.ToDecimal(CurrentSalaryTextBox1.Text.Trim()) < 1)
                {
                    MessageBox.Show("Current Salary can not be Zero or less than zero");
                    CurrentSalaryTextBox1.Focus();
                    return(false);
                }
            }
            if (StartingSalaryTextBox.Text.Trim() == "")
            {
                MessageBox.Show("Starting Salary is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                StartingSalaryTextBox.Clear();
                StartingSalaryTextBox.Focus();
                return(false);
            }
            else
            {
                if (Convert.ToDecimal(StartingSalaryTextBox.Text.Trim()) < 1)
                {
                    MessageBox.Show("Starting Salary can not be Zero or less than zero");
                    StartingSalaryTextBox.Focus();
                    return(false);
                }
            }

            return(true);
        }
 private bool IsFormValid()
 {
     if (EmployeeNameTextBox.Text.Trim() == string.Empty)
     {
         Messages.ShowErrorMessage("Name is required");
         EmployeeNameTextBox.Focus();
         return(false);
     }
     if (CNICTextBox.Text.Trim() == string.Empty)
     {
         Messages.ShowErrorMessage("CNIC is required");
         CNICTextBox.Focus();
         return(false);
     }
     if ((TelephoneTextBox.Text.Trim() == string.Empty) && (MobileTextBox.Text.Trim() == string.Empty))
     {
         Messages.ShowErrorMessage("Mobile number or Telephone number is required");
         MobileTextBox.Focus();
         return(false);
     }
     if (GenderComboBox.SelectedIndex == -1)
     {
         Messages.ShowErrorMessage("Gender is required");
         GenderComboBox.Focus();
         return(false);
     }
     //if (BranchComboBox.SelectedIndex == -1)
     //{
     //	Messages.ShowErrorMessage("Branch is required");
     //	BranchComboBox.Focus();
     //	return false;
     //}
     if (AddressLineTextBox.Text.Trim() == string.Empty)
     {
         Messages.ShowErrorMessage("Address Line is required");
         AddressLineTextBox.Focus();
         return(false);
     }
     if (CityComboBox.SelectedIndex == -1)
     {
         Messages.ShowErrorMessage("City is required");
         CityComboBox.Focus();
         return(false);
     }
     if (DistrictComboBox.SelectedIndex == -1)
     {
         Messages.ShowErrorMessage("District is required");
         DistrictComboBox.Focus();
         return(false);
     }
     if (PostalCodeTextBox.Text.Trim() == string.Empty)
     {
         Messages.ShowErrorMessage("Postal Code is required");
         PostalCodeTextBox.Focus();
         return(false);
     }
     if (JobTitleComboBox.SelectedIndex == -1)
     {
         Messages.ShowErrorMessage("Job Title is required");
         JobTitleComboBox.Focus();
         return(false);
     }
     if (StartingSalaryTextBox.Text.Trim() == string.Empty)
     {
         Messages.ShowErrorMessage("Starting Salary is required");
         StartingSalaryTextBox.Focus();
         return(false);
     }
     else
     {
         if (Convert.ToDecimal(StartingSalaryTextBox.Text) <= 0)
         {
             Messages.ShowErrorMessage("Starting Salary cannot be zero or less than zero");
             StartingSalaryTextBox.Focus();
             return(false);
         }
     }
     if (CurrentSalaryTextBox.Text.Trim() == string.Empty)
     {
         Messages.ShowErrorMessage("Current Salary is required");
         CurrentSalaryTextBox.Focus();
         return(false);
     }
     else
     {
         if (Convert.ToDecimal(CurrentSalaryTextBox.Text) <= 0)
         {
             Messages.ShowErrorMessage("Current Salary cannot be zero or less than zero");
             CurrentSalaryTextBox.Focus();
             return(false);
         }
     }
     return(true);
 }
Example #4
0
        private bool isFormValid()
        {
            if (FullNameTextBox.Text.Trim() == string.Empty)
            {
                SMSMessageBox.ShowErrorMessage("Full Name is required");
                FullNameTextBox.Focus();
                return(false);
            }

            if (DateOfBirthDateTimePicker.Text.Trim() == string.Empty)
            {
                SMSMessageBox.ShowErrorMessage("Date of Birth is required");
                DateOfBirthDateTimePicker.Focus();
                return(false);
            }

            if (CNICTextBox.Text.Trim() == string.Empty)
            {
                SMSMessageBox.ShowErrorMessage("CNIC is required");
                FullNameTextBox.Focus();
                return(false);
            }

            if ((MobileTextBox.Text.Trim() == string.Empty) && (TelephoneTextBox.Text.Trim() == string.Empty))
            {
                SMSMessageBox.ShowErrorMessage("Mobile or Telephone number is required");
                MobileTextBox.Focus();
                return(false);
            }

            if (GenderComboBox.SelectedIndex == -1)
            {
                SMSMessageBox.ShowErrorMessage("Gender is required");
                return(false);
            }

            if (EmploymentDateDateTimePicker.Text.Trim() == string.Empty)
            {
                SMSMessageBox.ShowErrorMessage("Employment Date is required");
                EmploymentDateDateTimePicker.Focus();
                return(false);
            }

            if (AddressLineTextBox.Text.Trim() == string.Empty)
            {
                SMSMessageBox.ShowErrorMessage("Address Line is required");
                AddressLineTextBox.Focus();
                return(false);
            }

            if (CityComboBox.SelectedIndex == -1)
            {
                SMSMessageBox.ShowErrorMessage("City is required");
                return(false);
            }

            if (DistrictComboBox.SelectedIndex == -1)
            {
                SMSMessageBox.ShowErrorMessage("District is required");
                return(false);
            }

            if (PostralCodeTextBox.Text.Trim() == string.Empty)
            {
                SMSMessageBox.ShowErrorMessage("Postral code is required");
                PostralCodeTextBox.Focus();
                return(false);
            }

            if (JobTitleComboBox.Text.Trim() == string.Empty)
            {
                SMSMessageBox.ShowErrorMessage("Job Title is required");
                JobTitleComboBox.Focus();
                return(false);
            }

            if (CurrentSalaryTextBox.Text.Trim() == string.Empty)
            {
                SMSMessageBox.ShowErrorMessage("Current Salary is required");
                CurrentSalaryTextBox.Focus();
                return(false);
            }
            else
            {
                if (Convert.ToDecimal(CurrentSalaryTextBox.Text.Trim()) < 1)
                {
                    SMSMessageBox.ShowErrorMessage("Current Salary can not be zero or less than zero");
                    CurrentSalaryTextBox.Focus();
                    return(false);
                }
            }

            if (StartingSalaryTextBox.Text.Trim() == string.Empty)
            {
                SMSMessageBox.ShowErrorMessage("Starting Salary is required");
                StartingSalaryTextBox.Focus();
                return(false);
            }
            else
            {
                if (Convert.ToDecimal(StartingSalaryTextBox.Text.Trim()) < 1)
                {
                    SMSMessageBox.ShowErrorMessage("Starting Salary can not be zero or less than zero");
                    StartingSalaryTextBox.Focus();
                    return(false);
                }
            }

            if (HasLeftComboBox.Text == "Yes")
            {
                if (DateLeftDateTimePicker.Text.Trim() == string.Empty)
                {
                    SMSMessageBox.ShowErrorMessage("Date Left is required");
                    DateLeftDateTimePicker.Focus();
                    return(false);
                }

                if (ReasonLeftComboBox.Text.Trim() == string.Empty)
                {
                    SMSMessageBox.ShowErrorMessage("Leaving reason is required");
                    ReasonLeftComboBox.Focus();
                    return(false);
                }

                if (CommentsTextBox.Text.Trim() == string.Empty)
                {
                    SMSMessageBox.ShowErrorMessage("Leaving Comments are required");
                    CommentsTextBox.Focus();
                    return(false);
                }
            }
            return(true);
        }