Ejemplo n.º 1
0
        private bool GetValidationStatus()
        {
            bool isValid = true;

            if (txtFirstName.Text.Trim().Length < 3)
            {
                errSale.SetError(txtFirstName, "Customer Contact first name should be 3 letters at least");
                isValid = false;
            }
            if (txtLastName.Text.Trim().Length < 3)
            {
                errSale.SetError(txtLastName, "Customer Contact last name should be 3 letters at least");
                isValid = false;
            }

            if (!DBMethod.IsValidEmail(txtEmail.Text.Trim()))
            {
                errSale.SetError(txtEmail, "Entred Customer Email is not a valid email address");
                isValid = false;
            }
            if (txtPhone.Text.Trim().Length != 14)
            {
                errSale.SetError(txtPhone, "Entred Phone is not a valid phone number");
                isValid = false;
            }
            return(isValid);
        }
Ejemplo n.º 2
0
        private bool GetValidationStatus()
        {
            bool isValid = true;

            if (txtName.Text.Trim().Length < 3)
            {
                errNmae.SetError(txtName, "Supplier name should be 3 letters at least");
                isValid = false;
            }
            if (txtSupplierFirstName.Text.Trim().Length < 3)
            {
                errFname.SetError(txtSupplierFirstName, "Supplier Contact first name should be 3 letters at least");
                isValid = false;
            }
            if (txtSupplierLastName.Text.Trim().Length < 3)
            {
                errLname.SetError(txtSupplierLastName, "Supplier Contact last name should be 3 letters at least");
                isValid = false;
            }

            if (!DBMethod.IsValidEmail(txtEmail.Text.Trim()))
            {
                errNmae.SetError(txtEmail, "Entred Supplier Email is not a valid email address");
                isValid = false;
            }
            if (txtPhone.Text.Trim().Length != 14)
            {
                errPhone.SetError(txtPhone, "Entred Phone is not a valid phone number");
                isValid = false;
            }
            if (txtCity.Text.Trim().Length < 3)
            {
                errLname.SetError(txtCity, " City should be 3 letters at least");
                isValid = false;
            }
            if (cmbProvinces.Text.Trim().Length == 0)
            {
                errProvince.SetError(cmbProvinces, " Province could not be empty");
                isValid = false;
            }
            if (txtPostalCode.Text.Trim().Length != 6)
            {
                errPostal.SetError(txtPostalCode, "Entred Postalcode is not a valid postalcode");
                isValid = false;
            }


            return(isValid);
        }
Ejemplo n.º 3
0
        private bool GetValidationStatus()
        {
            bool isValid = true;

            if (txtFirstName.Text.Trim().Length < 3)
            {
                erPEmployeeForm.SetError(txtFirstName, "Employee Contact first name should be 3 letters at least");
                isValid = false;
            }
            if (txtLastName.Text.Trim().Length < 3)
            {
                erPEmployeeForm.SetError(txtLastName, "Employee Contact last name should be 3 letters at least");
                isValid = false;
            }

            if (!DBMethod.IsValidEmail(txtEmail.Text.Trim()))
            {
                erPEmployeeForm.SetError(txtEmail, "Entred Employee Email is not a valid email address");
                isValid = false;
            }
            if (txtPhone.Text.Trim().Length != 14)
            {
                erPEmployeeForm.SetError(txtPhone, "Entred Phone is not a valid phone number");
                isValid = false;
            }
            if (txtCity.Text.Trim().Length < 3)
            {
                erPEmployeeForm.SetError(txtCity, " City should be 3 letters at least");
                isValid = false;
            }
            if (cmbProvinces.Text.Trim().Length == 0)
            {
                erPEmployeeForm.SetError(cmbProvinces, " Province could not be empty");
                isValid = false;
            }
            if (txtPostalCode.Text.Trim().Length != 6)
            {
                erPEmployeeForm.SetError(txtPostalCode, "Entred Postalcode is not a valid postalcode");
                isValid = false;
            }
            if (cmbRole.Text.Trim().Length == 0)
            {
                erPEmployeeForm.SetError(cmbRole, "Choose the employee role");
                isValid = false;
            }
            if (EmpType == "F")
            {
                if (dtpEmploymentDate.Value.Date > DateTime.Today.Date)
                {
                    erPEmployeeForm.SetError(dtpEmploymentDate, "Please check the employment date, the date could not be after today date");
                    isValid = false;
                }
                double x;
                if (!double.TryParse(txtsalary.Text, out x))
                {
                    erPEmployeeForm.SetError(txtsalary, "Please check the salary value, , it should be numeric");
                    isValid = false;
                }
            }

            return(isValid);
        }