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);
 }
Esempio n. 2
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);
        }
Esempio n. 3
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);
        }