Ejemplo n.º 1
0
        public void CompanyProvision(Company company, User initialUser)
        {
            if (string.IsNullOrEmpty(company.CompanyName))
            {
                Utilities.ErrorMessage("Company Name should not be empty");
            }

            if (string.IsNullOrEmpty(initialUser.FirstName))
            {
                Utilities.ErrorMessage("First Name is Required");
            }
            if (string.IsNullOrEmpty(initialUser.LastName))
            {
                Utilities.ErrorMessage("Last Name is Required");
            }
            if (string.IsNullOrEmpty(initialUser.LogonEmailAddress))
            {
                Utilities.ErrorMessage("Logon Email Address is Required");
            }
            if (string.IsNullOrEmpty(initialUser.Password))
            {
                Utilities.ErrorMessage("Password is Required");
            }
            this.CreateCommand(
                company.CompanyName,
                initialUser.FirstName,
                initialUser.LastName,
                initialUser.LogonEmailAddress,
                initialUser.Password
                );
        }
Ejemplo n.º 2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            // validation here
            rfvFirstName.ControlToValidate = TextBox1.Text;
            rfvFirstName.ErrorMessage = "First Name is Required";
            rfvLastName.ControlToValidate = TextBox2.Text;
            rfvLastName.ErrorMessage = "last Name is Reuired";
            rfvCompanyName.ControlToValidate = TextBox3.Text;
            rfvCompanyName.ErrorMessage = "Company Name is Required";
            revEmailAddress.ControlToValidate = TextBox4.Text;
            revEmailAddress.ErrorMessage = "Please provide valid email address";
            cvConfirmEmailAddress.ControlToCompare = TextBox4.Text;
            cvConfirmEmailAddress.ControlToValidate = TextBox5.Text;
            cvConfirmEmailAddress.ErrorMessage = "Email addresses do not match";
            rvPassword.ControlToValidate = TextBox7.Text;
            rvPassword.ErrorMessage = "Password must be between 6-25 characters long";
            cvConfirmPassword.ControlToCompare = TextBox7.Text;
            cvConfirmPassword.ControlToValidate = TextBox8.Text;
            cvConfirmPassword.ErrorMessage = "passwords do not match";

            // Construct company object
            Company company = new Company();
            company.CompanyName = TextBox3.Text;

            // Construct user object
            User user = new User();
            user.FirstName = TextBox1.Text;
            user.LastName = TextBox2.Text;
            user.LogonEmailAddress = TextBox4.Text;
            user.Telephone = TextBox6.Text;
            user.Password = TextBox7.Text;

            // Call activation
            CompanyActivation activation = new CompanyActivation();
            activation.CompanyProvision(company, user);
        }