public ActionResult CreationConfirmationPage(string username, string email, string password,
                                                     string address, string phonenumber, AccountType users)
        {
            CreateAccount account = new CreateAccount();

            account.username    = username;
            account.password    = password;
            account.address     = address;
            account.phonenumber = phonenumber;
            account.email       = email;
            account.type        = users;

            CreateAccountRequest request = new CreateAccountRequest(account);
            ServiceBusResponse   response;
            ServiceBusConnection connection = ConnectionManager.getConnectionObject(Globals.getUser());

            if (connection == null)
            {
                response = ConnectionManager.sendNewAccountInfo(request);
            }
            else
            {
                response = connection.sendNewAccountInfo(request);
            }
            if (response.result)
            {
                return(View("Index"));
            }
            else
            {
                ViewBag.CreationMessage = response.response;
                return(View("CreateAccount"));
            }
        }
Beispiel #2
0
        public ActionResult SaveAccount(CreateAccount account)
        {
            //Save this account info
            CreateAccountRequest request = new CreateAccountRequest(account);
            ServiceBusResponse   response;
            ServiceBusConnection connection = ConnectionManager.getConnectionObject(Globals.getUser());

            if (connection == null)
            {
                response = ConnectionManager.sendNewAccountInfo(request);
            }
            else
            {
                response = connection.sendNewAccountInfo(request);
            }

            ViewBag.AsIsResponse = response.response;

            if (response.response.Contains("Duplicate"))
            {
                return(View("CreateAccount"));
            }

            return(View("Index"));
        }
Beispiel #3
0
        public ActionResult CreateAccountPost(string usernameData, string passwordData,
                                              string addressData, string cityData, string provinceData, string emailData, string phoneData)
        {
            //Get form data from HTML web page
            CreateAccount        accountInfo = new CreateAccount();
            ServiceBusResponse   SBR;
            ServiceBusConnection SBC = ConnectionManager.getConnectionObject(Globals.getUser());

            accountInfo.username    = usernameData;
            accountInfo.password    = passwordData;
            accountInfo.address     = addressData;
            accountInfo.city        = cityData;
            accountInfo.province    = provinceData;
            accountInfo.email       = emailData;
            accountInfo.phonenumber = phoneData;
            accountInfo.type        = (AccountType)System.Enum.Parse(typeof(AccountType), Request.Form["accountType"]);

            //Send account info to bus
            CreateAccountRequest CAR = new CreateAccountRequest(accountInfo);

            if (SBC == null)
            {
                SBR = ConnectionManager.sendNewAccountInfo(CAR);
            }
            else
            {
                SBR = SBC.sendNewAccountInfo(CAR);
            }

            //Check if account created successfull
            string message = "Account created successfully.";

            if (SBR.result == true)
            {
                Response.Write("<script>alert('" + message + "')</script>");
                return(View("Index"));
            }
            else
            {
                message = "Failed to create account.";
                Response.Write("<script>alert('" + message + "')</script>");
                return(View("CreateAccount"));
            }
        }