Example #1
0
        public override List <ErrorType> GetErrors()
        {
            List <ErrorType> list = base.GetErrors();

            if (AccountName.NullOrEmpty() || AccountName == CONSTANTS.INVALID)
            {
                list.Add(ErrorType.AccountName);
            }
            if (AccountPassword.NullOrEmpty() || AccountPassword == CONSTANTS.INVALID)
            {
                list.Add(ErrorType.AccountPassword);
            }
            if (StartTime == null || StartTime == CONSTANTS.INVALID_DATE)
            {
                list.Add(ErrorType.StartTime);
            }
            if (AssessmentLength <= 0)
            {
                list.Add(ErrorType.AssessmentLength);
            }
            if (ReadingTime < 0)
            {
                list.Add(ErrorType.ReadingTime);
            }

            return(list);
        }
Example #2
0
        public List <ErrorType> GetErrors(string deployTarget)
        {
            List <ErrorType> list = base.GetErrors();

            if (AccountName.NullOrEmpty() || !Directory.Exists(Path.Combine(deployTarget, AccountName)))
            {
                list.Add(ErrorType.AccountName);
            }
            if (AccountPassword.NullOrEmpty() || AccountPassword == CONSTANTS.INVALID)
            {
                list.Add(ErrorType.AccountPassword);
            }
            if (StartTime == null || StartTime == CONSTANTS.INVALID_DATE)
            {
                list.Add(ErrorType.StartTime);
            }
            if (AssessmentLength <= 0)
            {
                list.Add(ErrorType.AssessmentLength);
            }
            if (ReadingTime < 0)
            {
                list.Add(ErrorType.ReadingTime);
            }

            return(list);
        }
Example #3
0
        private AccountDto BuildAccountDto()
        {
            AccountDto dto = new AccountDto()
            {
                AccountKind = AccountTypeOption.GetValue(Account.DEFAULT_ACCOUNT_KIND),
                Description = DescriptionOption.GetValue(String.Empty),
                Name        = AccountName.GetValue(String.Empty),
                Priority    = PriorityOption.GetValue(Account.DEFAULT_PRIORITY)
            };

            if (CategoryNameOption.IsDataValid)
            {
                dto.CategoryId = Repositories.AccountRepository.GetIdByName(CategoryNameOption.GetValue(null));
            }
            else
            {
                dto.CategoryId = null;
            }

            if (AccountId.IsDataValid)
            {
                dto.Id = AccountId.GetValue(-1);
            }
            else
            {
                dto.Id = null;
            }

            return(dto);
        }
        public string GetFileFolder(AccountName accountName, DocumentIndexSetup documentIndexSetup)
        {
            string basePath = string.IsNullOrEmpty(documentIndexSetup.IndexPath) ? string.Format("{0}\\{1}", IndexFileRootPath, "index") : documentIndexSetup.IndexPath;
            var    isOnSite = accountName == AccountName.Empty;

            return(Path.Combine(basePath, isOnSite ? basePath : string.Format("{0}\\{1}", basePath, accountName.Value)));
        }
Example #5
0
        public override bool Equals(object o)
        {
            if (!(o is ApiAccess))
            {
                return(false);
            }
            ApiAccess v = o as ApiAccess;

            if (!AccountName.Equals(v.AccountName))
            {
                return(false);
            }
            if (!ApiKey.Equals(v.ApiKey))
            {
                return(false);
            }
            if (!ApiSecret.Equals(v.ApiSecret))
            {
                return(false);
            }
            if (!ProviderName.Equals(v.ProviderName))
            {
                return(false);
            }

            return(true);
        }
Example #6
0
        public IEnumerable <IResult> Save()
        {
            IsBusy = true;
            yield return(new SingleResult {
                Action = () =>
                {
                    if (IsEditMode)
                    {
                        if (AccountId.HasValue)
                        {
                            accounts.Update(AccountId.Value, AccountName.Trim());
                        }
                        else
                        {
                            throw new Exception("Category ID is not specified for \"Update\" operation.");
                        }
                    }
                    else
                    {
                        int assetTypeId = ((AssetTypeDTO)Assets.CurrentItem).Id;
                        accounts.Create(AccountName.Trim(), assetTypeId);
                    }
                }
            });

            IsBusy = false;

            Close();
        }
Example #7
0
        public void WriteOnceReadTwice()
        {
            int beforeProfileAdd  = 0;
            int afterProfileAdded = 0;
            var account1Name      = new AccountName("account1");

            AccountCollection.GetOrCreate(account1Name);
            ExecuteConcurrently(() =>
            {
                Interlocked.Increment(ref beforeProfileAdd);
                IAccount account = AccountCollection.GetOrCreate(account1Name);
                account.Profiles.Add(new ProfileCreationArgs(new ProfileName("~"), new object()));
                Interlocked.Increment(ref afterProfileAdded);
            }, () =>
            {
                var accountFirstVersion  = AccountCollection.GetOrCreate(account1Name);
                var accountSecondVersion = AccountCollection.GetOrCreate(account1Name);
                bool sameVersion         = false;
                if (Interlocked.Increment(ref beforeProfileAdd) == 1)
                {
                    sameVersion = (accountFirstVersion == accountSecondVersion);
                    sameVersion.Should(Be.True);
                }
                if (Interlocked.Increment(ref afterProfileAdded) == 2)
                {
                    IAccount latestAccountVersion = AccountCollection.GetOrCreate(account1Name);
                    latestAccountVersion.Profiles.Count().Should(Be.EqualTo(1));
                    if (sameVersion)
                    {
                        (latestAccountVersion == accountFirstVersion).Should(Be.False);
                    }
                }
            });
            AccountCollection.GetOrCreate(account1Name).Profiles.Count().Should(Be.EqualTo(1));
        }
Example #8
0
        private string GetIndexPath(DocumentIndexSetup documentIndexSetup, AccountName accountName)
        {
            string basePath = string.IsNullOrEmpty(documentIndexSetup.IndexPath) ? string.Format("{0}\\{1}", BasePath, "index") : documentIndexSetup.IndexPath;
            var    isOnSite = accountName == AccountName.Empty;

            return(Path.Combine(basePath, isOnSite ? basePath : string.Format("{0}\\{1}", basePath, accountName.Value)));
        }
Example #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IdentificationLine"/> class.
 /// </summary>
 /// <param name="creationDate">The creation date.</param>
 /// <param name="bankIdentificationNumber">The bank identification number or zeros.</param>
 /// <param name="isDuplicate">Indication for duplicity.</param>
 /// <param name="applicationCode">The application code</param>
 /// <param name="fileReference">File reference as determined by the bank or blank</param>
 /// <param name="accountName">Name addressee</param>
 /// <param name="accountBic">Bic of the bank holding the account.</param>
 /// <param name="accountCompanyIdentificationNumber">Identification number of the Belgium-based account holder</param>
 /// <param name="externalApplicationCode">code "seperate application"</param>
 /// <param name="transactionReference">Transaction reference or blank.</param>
 /// <param name="relatedReference">Related reference or blank.</param>
 /// <param name="versionCode">The version code.</param>
 public IdentificationLine(
     Date creationDate,
     BankIdentificationNumber bankIdentificationNumber,
     bool isDuplicate,
     ApplicationCode applicationCode,
     FileReference fileReference,
     AccountName accountName,
     Bic accountBic,
     CompanyIdentificationNumber accountCompanyIdentificationNumber,
     ExternalApplicationCode externalApplicationCode,
     TransactionReference transactionReference,
     RelatedReference relatedReference,
     VersionCode versionCode)
 {
     CreationDate             = creationDate;
     BankIdentificationNumber = bankIdentificationNumber;
     IsDuplicate     = isDuplicate;
     ApplicationCode = applicationCode;
     FileReference   = fileReference;
     AccountName     = accountName;
     AccountBic      = accountBic;
     AccountCompanyIdentificationNumber = accountCompanyIdentificationNumber;
     ExternalApplicationCode            = externalApplicationCode;
     TransactionReference = transactionReference;
     RelatedReference     = relatedReference;
     VersionCode          = versionCode;
 }
Example #10
0
 public IEnumerable <Profile> GetAll(AccountName accountName)
 {
     using (var context = CreateDataContext())
     {
         return(SelectAccount(context.Accounts, accountName).Single().Profiles);
     }
 }
Example #11
0
        public bool SetPassword(string oldPassword, string newPassword, string account = null)
        {
            AccountName accountKey = Account;

            if (account != null && Enum.IsDefined(typeof(AccountName), account))
            {
                AccountName name = (AccountName)Enum.Parse(typeof(AccountName), account);

                if (Account <= name)
                {
                    accountKey = name;
                }
                else
                {
                    return(false);
                }
            }

            if (AccountInfo[accountKey] == oldPassword)
            {
                AccountInfo[accountKey] = newPassword;

                FileStream      fstream = new FileStream(AccountFileName, FileMode.Create);
                BinaryFormatter bf      = new BinaryFormatter();
                bf.Serialize(fstream, AccountInfo);
                fstream.Close();

                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #12
0
 /// <summary>
 ///     Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         if (AccountName != null)
         {
             hashCode = hashCode * 59 + AccountName.GetHashCode();
         }
         if (AccountNumber != null)
         {
             hashCode = hashCode * 59 + AccountNumber.GetHashCode();
         }
         if (SortCode != null)
         {
             hashCode = hashCode * 59 + SortCode.GetHashCode();
         }
         if (Balance != null)
         {
             hashCode = hashCode * 59 + Balance.GetHashCode();
         }
         if (AvailableBalance != null)
         {
             hashCode = hashCode * 59 + AvailableBalance.GetHashCode();
         }
         if (Overdraft != null)
         {
             hashCode = hashCode * 59 + Overdraft.GetHashCode();
         }
         return(hashCode);
     }
 }
Example #13
0
        public override string ToString()
        {
            string m = String.Format("[SavingsAccount:accountNumber={0},accountHolder={1},balance={2}]",
                                     AccountNumber, AccountName.Show(), Balance);

            return(m);
        }
Example #14
0
        public async Task <AccountNameData> getAccountName(string id, string acctnum)
        {
            string          resultContent = string.Empty;
            string          _ContentType  = "application/json";
            string          authToken     = settings.Value.authToken;
            AccountNameData accountdet    = new AccountNameData();
            AccountName     acctname      = new AccountName();

            try
            {
                ServicePointManager.Expect100Continue = true;
                ServicePointManager.SecurityProtocol  = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

                using (var client = new HttpClient())
                {
                    client.DefaultRequestHeaders.Accept.Clear();
                    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(_ContentType));

                    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", authToken);
                    var result = await client.GetAsync(settings.Value.payStackBaseURL + "bank/resolve?account_number=" + acctnum + "&bank_code=" + id);

                    resultContent = await result.Content.ReadAsStringAsync();
                }
                acctname   = JsonHelper.fromJson <AccountName>(resultContent);
                accountdet = acctname.data;
            }
            catch (Exception ex)
            {
                //u.LogError(ex, "DAC -- getSBUs: ");
            }
            return(accountdet);
        }
        public override int GetHashCode()
        {
            int hash = 1;

            if (debitAmount_ != null)
            {
                hash ^= DebitAmount.GetHashCode();
            }
            if (creditAmount_ != null)
            {
                hash ^= CreditAmount.GetHashCode();
            }
            if (Narration.Length != 0)
            {
                hash ^= Narration.GetHashCode();
            }
            if (account_ != null)
            {
                hash ^= Account.GetHashCode();
            }
            if (AccountName.Length != 0)
            {
                hash ^= AccountName.GetHashCode();
            }
            if (AccountType != 0)
            {
                hash ^= AccountType.GetHashCode();
            }
            if (entityId_ != null)
            {
                hash ^= EntityId.GetHashCode();
            }
            return(hash);
        }
Example #16
0
        internal Account ToDomain()
        {
            var accountId     = new AccountId(this.AccountNumber);
            var validatedName = AccountName.TryCreate(this.Name);

            if (IsNoLeaveAccount())
            {
                if (validatedName.IsInvalid)
                {
                    throw new ValidationException(validatedName.Errors);
                }

                return(new NoLeaveAccount(accountId, validatedName.Value));
            }

            var validatedAcquisitionPeriod = Period.TryCreate(this.AcquisitionStart.Value, this.AcquisitionEnd.Value);


            var validatedConsommationPeriod = Period.TryCreate(this.ConsommationStart.Value, this.ConsommationEnd.Value);


            Validation.EnsureIsValid(validatedName, validatedAcquisitionPeriod, validatedConsommationPeriod);

            var validatedLeaveAccount = LeaveAccount.TryCreate(
                accountId,
                validatedName.Value,
                validatedAcquisitionPeriod.Value,
                validatedConsommationPeriod.Value,
                this.AmountGainedPerFrequency.Value,
                (Frequency)Enum.Parse(typeof(Frequency), this.Frequency));


            return(validatedLeaveAccount.Value);
        }
Example #17
0
 public MashupScriptStorage(IPluginContext context, IMashupLocalFolder folder, ILogManager logManager, IMashupLoader mashupLoader)
 {
     _folder       = folder;
     _mashupLoader = mashupLoader;
     _log          = logManager.GetLogger(GetType());
     _accountName  = context.AccountName;
 }
Example #18
0
        public void GivenValidBindOption_WhenBuild_ShouldSucceed()
        {
            var args = new string[]
            {
                "Bind",
                "modelName=model-temp",
                "VersionId=v1000",
                "VsProject=c:\\folder\\installPath\\testproject.csproj",
                "Store:ContainerName=containerName",
                "Store:AccountName=accountName",
                "Store:AccountKey=dummyKey",
            };

            IOption option = new OptionBuilder()
                             .SetArgs(args)
                             .Build();

            option.ModelName.Should().Be("model-temp");
            option.VersionId.Should().Be("v1000");

            option.Store.Should().NotBeNull();
            option.Store !.ContainerName.Should().Be("containerName");
            option.Store !.AccountName.Should().Be("accountName");
            option.Store !.AccountKey.Should().Be("dummyKey");
        }
Example #19
0
        public void GivenValidDeleteOption_WhenBuild_ShouldSucceed()
        {
            var args = new string[]
            {
                "Delete",
                "modelName=mymodel-temp",
                "VersionId=v1000",
                "Store:ContainerName=containerName",
                "Store:AccountName=accountName",
                "Store:AccountKey=dummyKey",
            };

            IOption option = new OptionBuilder()
                             .SetArgs(args)
                             .Build();

            option.Delete.Should().BeTrue();
            option.ModelName.Should().Be("mymodel-temp");
            option.VersionId.Should().Be("v1000");

            option.Store.Should().NotBeNull();
            option.Store !.ContainerName.Should().Be("containerName");
            option.Store !.AccountName.Should().Be("accountName");
            option.Store !.AccountKey.Should().Be("dummyKey");
        }
Example #20
0
 public Account(Wallet wallet, string name)
 {
     this.Id       = Guid.NewGuid();
     this.Name     = AccountName.Create(name);
     _transactions = new List <Transaction>();
     Wallet        = wallet;
 }
        /// <summary>
        /// Adds a profile for an account
        /// </summary>
        /// <param name="profileName"></param>
        /// <param name="accountName"></param>
        /// <param name="profileSettings"></param>
        /// <returns></returns>
        public IProfile AddProfile(ProfileName profileName, AccountName accountName, object profileSettings)
        {
            var command = new ExecutePluginCommandCommand
            {
                CommandName = EmbeddedPluginCommands.AddProfile,
                Arguments   = new PluginProfileDto {
                    Name = profileName.Value, Settings = profileSettings
                }.Serialize()
            };

            HandleMessageFromTp(
                new List <HeaderInfo> {
                new HeaderInfo {
                    Key = BusExtensions.ACCOUNTNAME_KEY, Value = accountName.Value
                }
            }, command);

            var account = ObjectFactory.GetInstance <IAccountCollection>().GetOrCreate(accountName);
            var profile = account.Profiles[profileName];

            if (profile == null)
            {
                throw new ApplicationException(
                          string.Format(
                              "Profile '{0}' was not found in account '{1}'. Probably it's because profile did not pass validation -- check TpQueue for errors",
                              profileName.Value, accountName.Value));
            }

            return(profile);
        }
 public ProfileGateway(IProfileReadonly profile, AccountName accountName, ITpBus bus)
 {
     _profile     = profile;
     _accountName = accountName;
     _bus         = bus;
     _storage     = _profile.Get <ITargetProcessMessage>();
 }
Example #23
0
 void ReleaseDesignerOutlets()
 {
     if (AccountLatitude != null)
     {
         AccountLatitude.Dispose();
         AccountLatitude = null;
     }
     if (AccountLongitude != null)
     {
         AccountLongitude.Dispose();
         AccountLongitude = null;
     }
     if (AccountName != null)
     {
         AccountName.Dispose();
         AccountName = null;
     }
     if (CurrentLatitude != null)
     {
         CurrentLatitude.Dispose();
         CurrentLatitude = null;
     }
     if (CurrentLongitude != null)
     {
         CurrentLongitude.Dispose();
         CurrentLongitude = null;
     }
     if (mapView != null)
     {
         mapView.Dispose();
         mapView = null;
     }
 }
Example #24
0
 public ProfileCollection(AccountName accountName, IEnumerable <ProfileDomainObject> profiles)
 {
     _accountName      = accountName;
     _profiles         = profiles.ToDictionary(p => p.Name);
     ProfileRepository = null;
     EventAggregator   = null;
 }
Example #25
0
 public ProfileCollection(ProfileCollection other)
 {
     _accountName      = other._accountName;
     _profiles         = other.Profiles.Values.Select(p => new ProfileDomainObject(p)).ToDictionary(p => p.Name);
     ProfileRepository = other.ProfileRepository;
     EventAggregator   = other.EventAggregator;
 }
Example #26
0
 public void ShouldReturnInvalid_WhenInvalidCharacterIsUsed(string name)
 {
     Check.That(AccountName.TryCreate(name))
     .Equals(
         Validation.Invalid <AccountName>(
             new AccountName.IsInvalidCharacterError()));
 }
Example #27
0
 public void ShouldReturnInvalid_WhenLongerThan20Characters()
 {
     Check.That(AccountName.TryCreate("123456789012345678901234567890"))
     .Equals(
         Validation.Invalid <AccountName>(
             new AccountName.IsInvalidLengthError()));
 }
Example #28
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (AccountName != null)
         {
             hashCode = hashCode * 59 + AccountName.GetHashCode();
         }
         if (ContainerName != null)
         {
             hashCode = hashCode * 59 + ContainerName.GetHashCode();
         }
         if (AccessKey != null)
         {
             hashCode = hashCode * 59 + AccessKey.GetHashCode();
         }
         if (RootPath != null)
         {
             hashCode = hashCode * 59 + RootPath.GetHashCode();
         }
         if (ConnectionURL != null)
         {
             hashCode = hashCode * 59 + ConnectionURL.GetHashCode();
         }
         return(hashCode);
     }
 }
Example #29
0
 public void ShouldReturnInvalid_WhenIsEmpty(string name)
 {
     Check.That(AccountName.TryCreate(name))
     .Equals(
         Validation.Invalid <AccountName>(
             new AccountName.IsEmptyError()));
 }
Example #30
0
        public void GivenValidDownloadOption_WhenBuild_ShouldSucceed()
        {
            var args = new string[]
            {
                "DOWNLOAD",
                "PackageFile=c:\\zipfile2.mlPackage",
                "modelName=mymodel99",
                "VersionId=x1000",
                "Store:ContainerName=containerName",
                "Store:AccountName=accountName",
                "Store:AccountKey=dummyKey",
            };

            IOption option = new OptionBuilder()
                             .SetArgs(args)
                             .Build();

            option.Download.Should().BeTrue();
            option.PackageFile.Should().Be("c:\\zipfile2.mlPackage");
            option.ModelName.Should().Be("mymodel99");
            option.VersionId.Should().Be("x1000");

            option.Store.Should().NotBeNull();
            option.Store !.ContainerName.Should().Be("containerName");
            option.Store !.AccountName.Should().Be("accountName");
            option.Store !.AccountKey.Should().Be("dummyKey");
        }
		public static void SetIn(this IBus bus, AccountName accountName)
		{
			bus.CurrentMessageContext.Headers[ACCOUNTNAME_KEY] = accountName.Value;
		}
		public bool AccountMatches(AccountName accountName)
		{
			return (Accounts.Contains(accountName.Value.ToLower()) || Accounts.IsNullOrEmpty());
		}
		public bool Matches(MashupPlaceholder mashupPlaceHolderValue, AccountName accountName)
		{
			return PlaceholderMatches(mashupPlaceHolderValue) && AccountMatches(accountName);
		}
		public MashupConfig(string[] placeholders, AccountName[] accounts)
		{
			Placeholders = new List<string>(placeholders);
			Accounts = new List<AccountName>(accounts);
		}
		public static void SetOut(this IBus bus, AccountName account)
		{
			bus.OutgoingHeaders[ACCOUNTNAME_KEY] = account.Value;
		}
		public bool Matches(MashupPlaceholder mashupPlaceHolderValue, AccountName accountName)
		{
			return Placeholders.Any(x => x.Equals(mashupPlaceHolderValue.Value,StringComparison.InvariantCultureIgnoreCase)) &&
				   (Accounts.Contains(accountName.Value.ToLower()) || Accounts.IsNullOrEmpty());
		}
 public MashupConfig(string[] placeholders, AccountName[] accounts)
 {
     Placeholders = placeholders;
     Accounts = accounts;
 }