Exemplo n.º 1
0
        /// <summary>
        /// valid employee data edit
        /// </summary>
        public bool ValidData()
        {
            bool valid = true;

            error.Clear();
            // partner
            if (string.IsNullOrWhiteSpace(txtName.Text))
            {
                error.SetError(txtName, "Employee's name must not be blank!");
                valid = false;
            }
            if (string.IsNullOrWhiteSpace(txtAddress.Text))
            {
                error.SetError(txtAddress, "Employee's address must not be blank!");
                valid = false;
            }
            if (birthday.Value >= DateTime.Now)
            {
                error.SetError(birthday, "Not valid!");
                valid = false;
            }
            if (!FormatData.FormatPhone(txtPhone.Text))
            {
                error.SetError(txtPhone, "Wrong format!");
                valid = false;
            }
            if (!FormatData.FormatEmail(txtEmail.Text))
            {
                error.SetError(txtEmail, "Wrong format!");
                valid = false;
            }
            if (!FormatData.FormatFloat(txtSalary.Text))
            {
                error.SetError(txtSalary, "Wrong format!");
                valid = false;
            }
            return(valid);
        }
Exemplo n.º 2
0
        public bool ValidData()
        {
            bool valid = true;

            error.Clear();
            // partner
            if (string.IsNullOrWhiteSpace(txtPartnerName.Text))
            {
                error.SetError(txtPartnerName, "Partner's name must not be blank!");
                valid = false;
            }
            if (string.IsNullOrWhiteSpace(txtPosition.Text))
            {
                error.SetError(txtPosition, "Partner's postiton must not be blank!");
                valid = false;
            }
            if (string.IsNullOrWhiteSpace(txtPartnerPhone.Text))
            {
                error.SetError(txtPartnerPhone, "Partner's phone must not be blank!");
                valid = false;
            }
            else
            {
                if (!FormatData.FormatNumber(txtPartnerPhone.Text))
                {
                    error.SetError(txtPartnerPhone, "Wrong format!");
                    valid = false;
                }
            }
            if (string.IsNullOrWhiteSpace(txtPartnerEmail.Text))
            {
                error.SetError(txtPartnerEmail, "Partner's email must not be blank!");
                valid = false;
            }
            else
            {
                if (!FormatData.FormatEmail(txtPartnerEmail.Text.Trim()))
                {
                    error.SetError(txtPartnerEmail, "Wrong format!");
                    valid = false;
                }
            }
            // company
            if (string.IsNullOrWhiteSpace(txtCompanyName.Text))
            {
                error.SetError(txtCompanyName, "Company's name must not be blank!");
                valid = false;
            }
            if (string.IsNullOrWhiteSpace(txtCompanyEmail.Text))
            {
                error.SetError(txtCompanyEmail, "Company's email must not be blank!");
                valid = false;
            }
            else
            {
                if (!FormatData.FormatEmail(txtCompanyEmail.Text.Trim()))
                {
                    error.SetError(txtCompanyEmail, "Wrong format!");
                    valid = false;
                }
            }
            if (string.IsNullOrWhiteSpace(txtComAddress.Text))
            {
                error.SetError(txtComAddress, "Company's address must not be blank!");
                valid = false;
            }
            if (string.IsNullOrWhiteSpace(txtBankNumber.Text))
            {
                error.SetError(txtBankNumber, "Company's bank number must not be blank!");
                valid = false;
            }
            else
            {
                if (!FormatData.FormatNumber(txtBankNumber.Text))
                {
                    error.SetError(txtBankNumber, "Wrong format!");
                    valid = false;
                }
            }
            return(valid);
        }