public async Task <IActionResult> GetDailyBalances(int?accountId = null, AccountType?accountType = null, DateTime?from = null, DateTime?to = null) { var balances = _accountService.GetDailyBalances(accountId, accountType, from, to); var viewmodel = _mapper.MapAll <DailyBalanceList>(balances); return(Ok(viewmodel)); }
public async Task <bool> ExistsAsync(string address, AccountType?type = null) { if (string.IsNullOrEmpty(address)) { return(false); } if (!CachedByAddress.TryGetValue(address, out var account)) { account = type switch { AccountType.User => await Db.Users.FirstOrDefaultAsync(x => x.Address == address), AccountType.Delegate => await Db.Delegates.FirstOrDefaultAsync(x => x.Address == address), AccountType.Contract => await Db.Contracts.FirstOrDefaultAsync(x => x.Address == address), _ => await Db.Accounts.FirstOrDefaultAsync(x => x.Address == address) }; if (account != null) { Add(account); } } return(account != null && (account.Type == type || type == null)); }
/// <summary> /// Initializes a new instance of the StorageAccountUpdateParameters /// class. /// </summary> /// <param name="tags">Resource tags</param> /// <param name="accountType">Gets or sets the account type. Note that /// StandardZRS and PremiumLRS accounts cannot be changed to other /// account types, and other account types cannot be changed to /// StandardZRS or PremiumLRS. Possible values include: 'Standard_LRS', /// 'Standard_ZRS', 'Standard_GRS', 'Standard_RAGRS', /// 'Premium_LRS'</param> /// <param name="customDomain">User domain assigned to the storage /// account. Name is the CNAME source. Only one custom domain is /// supported per storage account at this time. To clear the existing /// custom domain, use an empty string for the custom domain name /// property.</param> public StorageAccountUpdateParameters(IDictionary <string, string> tags = default(IDictionary <string, string>), AccountType?accountType = default(AccountType?), CustomDomain customDomain = default(CustomDomain)) { Tags = tags; AccountType = accountType; CustomDomain = customDomain; CustomInit(); }
public IQueryable <Account> Search(string key, bool?leavesOnly = false, AccountType?accountType = null) { var accounts = NativeGetAllNoTracking(); if (leavesOnly.HasValue && leavesOnly.Value) { accounts = accounts.Where(e => e.Accounts.LongCount() == 0); } if (accountType.HasValue) { accounts = accounts.Where(a => a.AccountType == accountType); } if (!string.IsNullOrEmpty(key)) { accounts = accounts.Where( e => e.Code.Contains(key) || e.Name.Contains(key) || e.Code.Contains(key) || (e.Code + " " + e.Name).Contains(key) || (e.Code + "-" + e.Name).Contains(key)); } accounts = accounts.OrderBy(e => e.Code).ThenBy(e => e.Name); accounts = accounts.Skip(0).Take(25); return(accounts); }
public Task <Account[]> FindAsync(Bank?bank = null, AccountType?type = null, int?customerId = null) { var conditionsBuilder = new StringBuilder(); var parameters = new List <SqlParameter>(); if (bank.HasValue) { conditionsBuilder.And($"{nameof(Account.Bank)} = {BankParameter}"); parameters.Add(new SqlParameter(BankParameter, bank.Value)); } if (type.HasValue) { conditionsBuilder.And($"{nameof(Account.Type)} = {TypeParameter}"); parameters.Add(new SqlParameter(TypeParameter, type.Value)); } if (customerId.HasValue) { conditionsBuilder.And($"{nameof(Account.CustomerId)} = {CustomerIdParameter}"); parameters.Add(new SqlParameter(CustomerIdParameter, customerId.Value)); } return(FindByQueryAsync(conditionsBuilder, parameters)); }
public async Task <IActionResult> GetAll(AccountType?accountType = null) { var accounts = await _accountService.GetAll(accountType); var model = _mapper.MapAll <AccountViewmodel>(accounts); return(Ok(model)); }
/// <inheritdoc /> public TAccountListFilter(XmlNode node) { if (node != null) { NameMask = Extensions.GetNodeInnerText(node.GetSingleNode(ClassHelper.GetMemberName(() => NameMask))); TypeMask = (AccountType)Extensions.GetNodeInnerTextAsInt(node.GetSingleNode(ClassHelper.GetMemberName(() => TypeMask))); } }
public void AddClientSession(int?clientId = null, int?accountId = null, string username = null, AccountType?accountType = null) { PutInt(KeyClientId, clientId); AddAccountSession(accountId, username, accountType); }
public virtual ActionResult Choose(AccountType?type) { var accounts = (IEnumerable <Account>)Accounts.All(); if (type.HasValue) { accounts = accounts.Where(x => x.Type == type.Value); } return(View(accounts)); }
/// <summary> /// Fetch the list of accounts /// </summary> /// <param name="id">Item Id</param> /// <returns>Account results list</returns> public async Task <PageResults <Account> > FetchAccounts(Guid id, AccountType?type = null) { var queryStrings = new Dictionary <string, string> { { "itemId", id.ToString() }, { "type", type.ToString() } }; return(await httpService.GetAsync <PageResults <Account> >(URL_ACCOUNTS, null, queryStrings)); }
public async Task <long> GetCountAsync( Guid?userId = null, AccountType?accountType = null, bool?isDefault = null, string filter = null, CancellationToken cancellationToken = default ) { var query = await GetListQuery(userId, accountType, isDefault, filter); return(await query .LongCountAsync(cancellationToken)); }
private static bool CanShow(HtmlHelper htmlHelper, AuthorizationAccountType authAccountType) { IIdentity userIdentity = htmlHelper.ViewContext.HttpContext.User.Identity; if (userIdentity.IsAuthenticated) { QueryServiceClient queryService = new QueryServiceClient(); AccountType? accountType = queryService.GetAccountType(userIdentity.Name); queryService.Close(); if (accountType != null) { bool canShow = false; switch (accountType.Value) { case AccountType.Admin: if ((authAccountType & AuthorizationAccountType.Admin) == AuthorizationAccountType.Admin) { canShow = true; } else { canShow = false; } break; case AccountType.User: if ((authAccountType & AuthorizationAccountType.User) == AuthorizationAccountType.User) { canShow = true; } else { canShow = false; } break; default: break; } return(canShow); } else { return(false); } } else { return(false); } }
/// <summary> /// Initializes a new instance of the StorageAccountProperties class. /// </summary> /// <param name="provisioningState">Gets the status of the storage /// account at the time the operation was called. Possible values /// include: 'Creating', 'ResolvingDNS', 'Succeeded'</param> /// <param name="accountType">Gets the type of the storage account. /// Possible values include: 'Standard_LRS', 'Standard_ZRS', /// 'Standard_GRS', 'Standard_RAGRS', 'Premium_LRS'</param> /// <param name="primaryEndpoints">Gets the URLs that are used to /// perform a retrieval of a public blob, queue or table object.Note /// that StandardZRS and PremiumLRS accounts only return the blob /// endpoint.</param> /// <param name="primaryLocation">Gets the location of the primary for /// the storage account.</param> /// <param name="statusOfPrimary">Gets the status indicating whether /// the primary location of the storage account is available or /// unavailable. Possible values include: 'Available', /// 'Unavailable'</param> /// <param name="lastGeoFailoverTime">Gets the timestamp of the most /// recent instance of a failover to the secondary location. Only the /// most recent timestamp is retained. This element is not returned if /// there has never been a failover instance. Only available if the /// accountType is StandardGRS or StandardRAGRS.</param> /// <param name="secondaryLocation">Gets the location of the geo /// replicated secondary for the storage account. Only available if the /// accountType is StandardGRS or StandardRAGRS.</param> /// <param name="statusOfSecondary">Gets the status indicating whether /// the secondary location of the storage account is available or /// unavailable. Only available if the accountType is StandardGRS or /// StandardRAGRS. Possible values include: 'Available', /// 'Unavailable'</param> /// <param name="creationTime">Gets the creation date and time of the /// storage account in UTC.</param> /// <param name="customDomain">Gets the user assigned custom domain /// assigned to this storage account.</param> /// <param name="secondaryEndpoints">Gets the URLs that are used to /// perform a retrieval of a public blob, queue or table object from /// the secondary location of the storage account. Only available if /// the accountType is StandardRAGRS.</param> public StorageAccountProperties(ProvisioningState?provisioningState = default(ProvisioningState?), AccountType?accountType = default(AccountType?), Endpoints primaryEndpoints = default(Endpoints), string primaryLocation = default(string), AccountStatus?statusOfPrimary = default(AccountStatus?), System.DateTime?lastGeoFailoverTime = default(System.DateTime?), string secondaryLocation = default(string), AccountStatus?statusOfSecondary = default(AccountStatus?), System.DateTime?creationTime = default(System.DateTime?), CustomDomain customDomain = default(CustomDomain), Endpoints secondaryEndpoints = default(Endpoints)) { ProvisioningState = provisioningState; AccountType = accountType; PrimaryEndpoints = primaryEndpoints; PrimaryLocation = primaryLocation; StatusOfPrimary = statusOfPrimary; LastGeoFailoverTime = lastGeoFailoverTime; SecondaryLocation = secondaryLocation; StatusOfSecondary = statusOfSecondary; CreationTime = creationTime; CustomDomain = customDomain; SecondaryEndpoints = secondaryEndpoints; }
/// <summary> /// Initializes a new instance of the StorageAccountCreateParameters /// class with required arguments. /// </summary> public StorageAccountCreateParameters(AccountType?accountType, string location) : this() { if (accountType == null) { throw new ArgumentNullException("accountType"); } if (location == null) { throw new ArgumentNullException("location"); } this.AccountType = accountType; this.Location = location; }
public List <Wallet> Search(string keyword, EntityType entityType, AccountType?type, int pageindex, int pagesize, out int total) { var wallet = from w in _dbContext.Wallet where w.EntityType == entityType select w; if (!string.IsNullOrEmpty(keyword)) { if (entityType == EntityType.Account) { var list_account = from a in _dbContext.Account where (a.Name.Contains(keyword) || a.Email.Contains(keyword)) && (type.Value == AccountType.All || a.Type == type.Value) select a; wallet = from w in wallet where list_account.Select(a => a.Id).Contains(w.EntityId) select w; } else if (entityType == EntityType.Agency) { var list_agency = from a in _dbContext.Agency where a.Name.Contains(keyword) || a.Email.Contains(keyword) || a.TaxIdNumber.Contains(keyword) select a; wallet = from w in wallet where list_agency.Select(a => a.Id).Contains(w.EntityId) select w; } } else { if (entityType == EntityType.Account) { var list_account = from a in _dbContext.Account where (type.Value == AccountType.All || a.Type == type.Value) select a; wallet = from w in wallet where list_account.Select(a => a.Id).Contains(w.EntityId) select w; } } total = wallet.Count(); return(wallet.Skip((pageindex - 1) * pagesize).Take(pagesize).ToList()); }
public void AddAccountSession(int?accountId = null, string username = null, AccountType?accountType = null) { // pag hindi null, saka natin ilalagay sa editor // para pag kinuha ung key, tas walang value, null naman sya PutInt(KeyAccountId, accountId); PutString(KeyUsername, username); PutInt(KeyAccountType, (int?)accountType); Editor.Commit(); IsSet = true; }
/// <summary> /// Initializes a new instance of the StorageAccount class. /// </summary> /// <param name="id">Resource Id</param> /// <param name="name">Resource name</param> /// <param name="type">Resource type</param> /// <param name="location">Resource location</param> /// <param name="tags">Resource tags</param> /// <param name="provisioningState">Gets the status of the storage /// account at the time the operation was called. Possible values /// include: 'Creating', 'ResolvingDNS', 'Succeeded'</param> /// <param name="accountType">Gets the type of the storage account. /// Possible values include: 'Standard_LRS', 'Standard_ZRS', /// 'Standard_GRS', 'Standard_RAGRS', 'Premium_LRS'</param> /// <param name="primaryEndpoints">Gets the URLs that are used to /// perform a retrieval of a public blob, queue or table object.Note /// that StandardZRS and PremiumLRS accounts only return the blob /// endpoint.</param> /// <param name="primaryLocation">Gets the location of the primary for /// the storage account.</param> /// <param name="statusOfPrimary">Gets the status indicating whether /// the primary location of the storage account is available or /// unavailable. Possible values include: 'Available', /// 'Unavailable'</param> /// <param name="lastGeoFailoverTime">Gets the timestamp of the most /// recent instance of a failover to the secondary location. Only the /// most recent timestamp is retained. This element is not returned if /// there has never been a failover instance. Only available if the /// accountType is StandardGRS or StandardRAGRS.</param> /// <param name="secondaryLocation">Gets the location of the geo /// replicated secondary for the storage account. Only available if the /// accountType is StandardGRS or StandardRAGRS.</param> /// <param name="statusOfSecondary">Gets the status indicating whether /// the secondary location of the storage account is available or /// unavailable. Only available if the accountType is StandardGRS or /// StandardRAGRS. Possible values include: 'Available', /// 'Unavailable'</param> /// <param name="creationTime">Gets the creation date and time of the /// storage account in UTC.</param> /// <param name="customDomain">Gets the user assigned custom domain /// assigned to this storage account.</param> /// <param name="secondaryEndpoints">Gets the URLs that are used to /// perform a retrieval of a public blob, queue or table object from /// the secondary location of the storage account. Only available if /// the accountType is StandardRAGRS.</param> public StorageAccount(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary <string, string> tags = default(IDictionary <string, string>), ProvisioningState?provisioningState = default(ProvisioningState?), AccountType?accountType = default(AccountType?), Endpoints primaryEndpoints = default(Endpoints), string primaryLocation = default(string), AccountStatus?statusOfPrimary = default(AccountStatus?), System.DateTime?lastGeoFailoverTime = default(System.DateTime?), string secondaryLocation = default(string), AccountStatus?statusOfSecondary = default(AccountStatus?), System.DateTime?creationTime = default(System.DateTime?), CustomDomain customDomain = default(CustomDomain), Endpoints secondaryEndpoints = default(Endpoints)) : base(id, name, type, location, tags) { ProvisioningState = provisioningState; AccountType = accountType; PrimaryEndpoints = primaryEndpoints; PrimaryLocation = primaryLocation; StatusOfPrimary = statusOfPrimary; LastGeoFailoverTime = lastGeoFailoverTime; SecondaryLocation = secondaryLocation; StatusOfSecondary = statusOfSecondary; CreationTime = creationTime; CustomDomain = customDomain; SecondaryEndpoints = secondaryEndpoints; CustomInit(); }
public async void PerformLogin(string username, string password) { // check if username exists // f = show invalid // t => get salt and hash of username // use encryption to check // f = show invalid // Empty if (username == "" || password == "") { view.DisplayLoginError(true); return; } // TODO Kung sakali, strip ung special // dapat malaman kung anong klaseng account AccountType?type = await accService.GetAccountType(username); if (type == null) { view.DisplayLoginError(true); return; } // username exists, check na natin kung tama ung password view.DisplayLoginError(false); Password userPassword = await passService.GetPasswordByUsername(username); bool validPass = hashService.VerifyPasswordHash(password, userPassword); if (!validPass) { view.DisplayLoginError(true); return; } // kailangan malaman kung anong type ng user sya pala // user exists and valid na ung password na binigay so login na // TODO Create dito ung Login Session view.UserLoginSuccess(); //loginSession = SessionFactory.CreateSession <LoginSession> (SessionKeys.LoginKey); // loginSession.Login(username, type); }
public static BaseAccount CreateAccount(double?interest = null, double?limit = null, int?fee = null, int?day = null, Client client = null) { if (client == null) { Console.WriteLine("Fail"); //throw exception } AccountType?accountType = null; if (day.HasValue && interest.HasValue) { accountType = AccountType.DepositAccount; } else if (interest.HasValue) { accountType = AccountType.StandartAccount; } else if (fee.HasValue && limit.HasValue) { accountType = AccountType.CreditAccount; } if (!accountType.HasValue) { Console.WriteLine("Fail"); //throw exception } switch (accountType) { case AccountType.DepositAccount: return(new DepositAccount(day.Value, interest.Value, client)); case AccountType.StandartAccount: return(new StandardAccount(interest.Value, client)); case AccountType.CreditAccount: return(new CreditAccount(limit.Value, fee.Value, client)); default: Console.WriteLine("Fail"); throw new Exception("Fail"); } }
public async Task <List <WithdrawAccount> > GetListAsync( string sorting = null, int maxResultCount = 10, int skipCount = 0, Guid?userId = null, AccountType?accountType = null, bool?isDefault = null, string filter = null, CancellationToken cancellationToken = default ) { var query = await GetListQuery(userId, accountType, isDefault, filter); return(await query .OrderBy(sorting ?? "creationTime DESC") .PageBy(skipCount, maxResultCount) .ToListAsync(cancellationToken)); }
public Account(string user, string pass, AccountType? type, string firstName, string lastName, int grade) { Username = user; Password = pass; AType = type; if (firstName != "") { FirstName = firstName; } if (lastName != "") { LastName = lastName; } if (grade >= 9 && grade <= 12) { GradeLevel = grade; } }
protected async Task <IQueryable <WithdrawAccount> > GetListQuery( Guid?userId = null, AccountType?accountType = null, bool?isDefault = null, string filter = null ) { var dbSet = await GetDbSetAsync(); return(dbSet .AsNoTracking() .WhereIf(userId.HasValue, e => e.CreatorId == userId) .WhereIf(accountType.HasValue, e => e.AccountType == accountType) .WhereIf(isDefault.HasValue, e => e.IsDefault == isDefault) .WhereIf(!string.IsNullOrEmpty(filter), e => false || e.Description.Contains(filter) )); }
public async Task <IEnumerable <Account> > GetAll(AccountType?accountType = null) { using (var context = _factory.CreateDbContext()) { var dataAccounts = context.Accounts .Include(a => a.Expenses) .Include(a => a.Incomes) .Include(a => a.TransfersFrom) .Include(a => a.TransfersTo) .Where(a => a.UserId == _userId); if (accountType.HasValue) { var dataType = _mapper.Map <Data.Enums.AccountType>(accountType.Value); dataAccounts = dataAccounts.Where(a => a.AccountType == dataType); } return(_mapper.MapAll <Account>(await dataAccounts.ToListAsync())); } }
/// <summary> /// Get account balance /// </summary> /// <param name="symbol">Symbol of currency</param> /// <param name="type">Account type</param> /// <returns>Balance collection</returns> public async Task <List <Balance> > GetBalances(string symbol, AccountType?type) { var endpoint = "/api/v1/accounts"; var parms = new SortedDictionary <string, object>(); if (!string.IsNullOrEmpty(symbol)) { parms.Add("currency", symbol); } if (type != null) { parms.Add("type", type.ToString().ToLower()); } var queryString = parms.Count > 0 ? $"?{_helper.SortedDictionaryToString(parms)}" : string.Empty; endpoint = endpoint + queryString; return(await Get <List <Balance> >(endpoint, true)); }
public static string GetEndpointUrl(Application application, BestBankEndpoint endpoint, AccountType?accountType = null, string optionalParameter = null) { var url = new StringBuilder(); url.Append(application.ServerUrl); url.Append(GetEndpointURL(endpoint)); url.Append("/"); string accountTypeParam = null; if (accountType.HasValue && accountType.Value == AccountType.BankAccount) { accountTypeParam = "Account"; } else if (accountType.HasValue && accountType.Value == AccountType.CreditCard) { accountTypeParam = "CreditCard"; } else { accountTypeParam = String.Empty; } url.Append(accountTypeParam); url.Append("/"); url.Append(optionalParameter); return(url.ToString()); }
public async Task <IActionResult> Search(string key = "", bool?leavesOnly = false, AccountType?accountType = null) { var accounts = await _accountRepo.Search(key, leavesOnly, accountType).ToListAsync(); var viewModels = AutoMapper.Mapper.Map <IEnumerable <SearchViewModel> >(accounts); return(Ok(viewModels)); }
public async Task <string> SubTransfer(string currency, decimal amount, TransactionDirection direction, string subUserId, AccountType?accountType = null, AccountType?subAccountType = null, string clientOid = null) { if (clientOid == null) { clientOid = Guid.NewGuid().ToString("d"); } var dict = new Dictionary <string, object>(); dict.Add("clientOid", clientOid); dict.Add("currency", currency); dict.Add("amount", amount.ToString()); dict.Add("direction", direction == TransactionDirection.In ? "IN" : "OUT"); dict.Add("subUserId", subUserId); if (accountType is AccountType a1) { dict.Add("accountType", a1.AccountName.ToUpper()); } if (subAccountType is AccountType a2) { dict.Add("subAccountType", a2.AccountName.ToUpper()); } var jobj = await MakeRequest(HttpMethod.Post, "/api/v1/accounts/sub-transfer", reqParams : dict); return(jobj["orderId"].ToObject <string>()); }
public async Task <IActionResult> GetAccounts(AccountType?type, string kw, int pageindex = 1, int pagesize = 8) { var model = await _accountService.GetAccounts(type ?? AccountType.All, kw, string.Empty, pageindex, pagesize); return(PartialView(model)); }
/// <summary> /// Initializes a new instance of the /// StorageAccountPropertiesUpdateParameters class. /// </summary> public StorageAccountPropertiesUpdateParameters(AccountType?accountType = default(AccountType?), CustomDomain customDomain = default(CustomDomain)) { AccountType = accountType; CustomDomain = customDomain; }
public BankAccount(AccountType? type, decimal openingBalance) { this.Type = type; this.Balance = openingBalance; this.Number = nextAccountNumber++; }
internal static string ToSerializedValue(this AccountType?value) { return(value == null ? null : ((AccountType)value).ToSerializedValue()); }
/// <summary> /// Updates the account type or tags for a storage account. It can also be used /// to add a custom domain (note that custom domains cannot be added via the /// Create operation). Only one custom domain is supported per storage account. /// In order to replace a custom domain, the old value must be cleared before a /// new value may be set. To clear a custom domain, simply update the custom /// domain with empty string. Then call update again with the new cutsom domain /// name. The update API can only be used to update one of tags, accountType, /// or customDomain per call. To update multiple of these properties, call the /// API multiple times with one change per call. This call does not change the /// storage keys for the account. If you want to change storage account keys, /// use the RegenerateKey operation. The location and name of the storage /// account cannot be changed after creation. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group within the user's subscription. /// </param> /// <param name='accountName'> /// The name of the storage account within the specified resource group. /// Storage account names must be between 3 and 24 characters in length and use /// numbers and lower-case letters only. /// </param> /// <param name='tags'> /// Resource tags /// </param> /// <param name='accountType'> /// Gets or sets the account type. Note that StandardZRS and PremiumLRS /// accounts cannot be changed to other account types, and other account types /// cannot be changed to StandardZRS or PremiumLRS. Possible values include: /// 'Standard_LRS', 'Standard_ZRS', 'Standard_GRS', 'Standard_RAGRS', /// 'Premium_LRS' /// </param> /// <param name='customDomain'> /// User domain assigned to the storage account. Name is the CNAME source. Only /// one custom domain is supported per storage account at this time. To clear /// the existing custom domain, use an empty string for the custom domain name /// property. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <StorageAccount> UpdateAsync(this IStorageAccountsOperations operations, string resourceGroupName, string accountName, IDictionary <string, string> tags = default(IDictionary <string, string>), AccountType?accountType = default(AccountType?), CustomDomain customDomain = default(CustomDomain), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, accountName, tags, accountType, customDomain, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }