Exemplo n.º 1
0
        private int CreateIBSAccount()
        {
            var service = new WebAccount3Service
            {
                Url = "http://apcurium.drivelinq.com:16928/IBSCab/IBSCab.dll/soap/IWebAccount3"
            };

            var account = new TBookAccount3
            {
                WEBID       = Guid.NewGuid().ToString().Substring(0, 5),
                Address     = new TWEBAddress(),
                Email2      = "*****@*****.**",
                Title       = "",
                FirstName   = "Apcurium",
                LastName    = "Test",
                Phone       = "5141234569",
                MobilePhone = "5141234569",
                WEBPassword = "******",
                AccType     = TAccountType.actWebAccount,
            };

            var ibsAcccountId = service.SaveAccount3("taxi", "test", account);

            Trace.WriteLine("IBS account created: " + ibsAcccountId);

            return(ibsAcccountId);
        }
Exemplo n.º 2
0
 /// <remarks/>
 public System.IAsyncResult BeginSaveAccount3(string Login, string Password, TBookAccount3 Account, System.AsyncCallback callback, object asyncState)
 {
     return(this.BeginInvoke("SaveAccount3", new object[] {
         Login,
         Password,
         Account
     }, callback, asyncState));
 }
Exemplo n.º 3
0
    public int SaveAccount3(string Login, string Password, TBookAccount3 Account)
    {
        object[] results = this.Invoke("SaveAccount3", new object[] {
            Login,
            Password,
            Account
        });

        return((int)(results[0]));
    }
Exemplo n.º 4
0
 /// <remarks/>
 public void SaveAccount3Async(string Login, string Password, TBookAccount3 Account, object userState)
 {
     if ((this.SaveAccount3OperationCompleted == null))
     {
         this.SaveAccount3OperationCompleted = new System.Threading.SendOrPostCallback(this.OnSaveAccount3OperationCompleted);
     }
     this.InvokeAsync("SaveAccount3", new object[] {
         Login,
         Password,
         Account
     }, this.SaveAccount3OperationCompleted, userState);
 }
Exemplo n.º 5
0
        private bool CreatingAccount(string url, string username, string password, ref StringBuilder result)
        {
            var account = new TBookAccount3();

            account.ServiceProviderID = _defaultProvider;
            account.WEBID             = Guid.NewGuid().ToString();
            account.WEBPassword       = "******";
            account.LastName          = "Test LastName";
            account.Phone             = "5145551212";
            account.Email2            = "*****@*****.**";
            account.MobilePhone       = account.Phone;
            account.Address           = new TWEBAddress();

            result.AppendLine("Calling SaveAccount3 for url :" + url + "IWebAccount3");

            var account3Service = new WebAccount3Service {
                Url = url + "IWebAccount3"
            };

            try
            {
                var id = account3Service.SaveAccount3(username, password, account);
                if (id > 0)
                {
                    result.AppendLine("Call sucessfull, account with id #" + id + " created");
                }
                else
                {
                    result.AppendLine("Unable to create account, no id returned, error code return = " + id);
                }
                return(id > 0);
            }
            catch (Exception ex)
            {
                result.AppendLine("Error calling SaveAccount3 : " + ex.Message);
                result.AppendLine("Error details : " + ex.StackTrace);
            }
            return(false);
        }
        public int CreateAccount(Guid accountId, string email, string firstName, string lastName, string phone)
        {
            // we don't care about the ibs password, it's never used, but create an account
            // using the home password since anyway the ibs account will not be used under another company
            var password      = _serverSettings.ServerData.IBS.DefaultAccountPassword;
            var isSuccess     = false;
            var ibsAcccountId = 0;
            var regEx         = new Regex(@"\D");
            var phoneClean    = regEx.Replace(phone, string.Empty);

            // webId must be unique (and must not be too long)
            var webId = accountId.ToString().Substring(0, 10) + DateTime.Now.Ticks;

            UseService(service =>
            {
                var account = new TBookAccount3
                {
                    WEBID       = webId,
                    Address     = new TWEBAddress(),
                    Email2      = email,
                    Title       = string.Empty,
                    FirstName   = firstName,
                    LastName    = lastName,
                    Phone       = phoneClean,
                    MobilePhone = phoneClean,
                    WEBPassword = password
                };

                ibsAcccountId = service.SaveAccount3(UserNameApp, PasswordApp, account);
                isSuccess     = ibsAcccountId > 0;
            });

            if (!isSuccess)
            {
                throw new InvalidOperationException(string.Format("Error while trying to create IBS account. IBS error code: {0}", ibsAcccountId));
            }
            return(ibsAcccountId);
        }
        public void when_creating_an_account()
        {
            // Arrange
            var accountId = Guid.NewGuid().ToString().Substring(0, 5);
            var email     = "*****@*****.**";
            var account   = new TBookAccount3
            {
                WEBID       = accountId,
                Address     = new TWEBAddress(),
                Email2      = email,
                Title       = "",
                FirstName   = "Apcurium",
                LastName    = "Test",
                Phone       = "5141234569",
                MobilePhone = "5141234569",
                WEBPassword = "******"
            };

            // Act
            var ibsAcccountId = Sut.SaveAccount3("taxi", "test", account);

            // Assert
            Assert.Greater(ibsAcccountId, 0);
        }
Exemplo n.º 8
0
 /// <remarks/>
 public void SaveAccount3Async(string Login, string Password, TBookAccount3 Account)
 {
     this.SaveAccount3Async(Login, Password, Account, null);
 }