Exemplo n.º 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            ResponseMessage message = new ResponseMessage();

            try
            {
                HomeBusiness homeBusiness = new HomeBusiness(txbHomeName.Text, ddlHomeType.SelectedValue);
                int          homeId       = homeBusiness.AddHome();
                if (IsPasswordMatched())
                {
                    UserRegistration registerUser = new UserRegistration(txbUserName.Text, txbFirstName.Text, txbLastName.Text, txbPassword.Text, "Admin", homeId);
                    registerUser.AddUserToHome();
                    message.PrintSuccessMessage(spnMessage, "Admin user and home successfully created");
                }
                else
                {
                    message.PrintFailureMessage(spnMessage, "Password didn't matched!");
                }
            }
            catch (Exception ex)
            {
                message.PrintFailureMessage(spnMessage, ex.Message);
            }
        }