internal async Task ProductIsNewAsync(AccountProductPair pair, bool isNew) { var sqlParams = CreateSqlParams(pair); sqlParams.Add(isNew.ToSql("isNew")); await ExecuteNonQueryAsync("[accounts].[pProductSetIsNewByAccountId]", sqlParams); }
private List <SqlParameter> CreateSqlParams(AccountProductPair pair) { return(new List <SqlParameter>() { pair.AccountProductId.ToSql("accountProductId"), pair.AccountId.ToSql("accountId") }); }
internal async Task <AllowedCountStatus> ProductAllowedSetAsync(AccountProductPair pair, int allowedCount) { var sqlParams = CreateSqlParams(pair); sqlParams.Add(allowedCount.ToSql("allowedCount")); var scalar = (int) await ExecuteScalarAsync("[accounts].[pProductSetAllowedCountByOwnerIDAccountProductId] ", sqlParams); return((AllowedCountStatus)scalar); }
internal async Task <AssignStatus> ProductAssignAsync(AccountProductPair pair, bool isIgnoreBillingCycle = false) { var sqlParams = CreateSqlParams(pair); sqlParams.Add(isIgnoreBillingCycle.ToSql("isIgnoreBillingCycle")); var scalar = (int) await ExecuteScalarAsync("[accounts].[pProductAssign]", sqlParams); return((AssignStatus)scalar); }
internal async Task ProductDeactivateAsync(AccountProductPair pair) { var sqlParams = new SqlParameter[] { pair.AccountProductId.ToSql("accountProductId"), 3.ToSql("activationReason") }; await ExecuteNonQueryAsync("[accounts].[pProductDeactivate]", sqlParams); }
public async Task <List <AccountSystem> > AccountSystemsGetAsync(AccountProductPair pair) { var sqlParams = new SqlParameter[] { pair.AccountId.ToSql("accountId"), pair.AccountProductId.ToSql("accountProductId") }; return(await ExecuteReaderCollectionAsync <AccountSystem>("[oauth].[pAccountSystemSelectByAccountIdProductId]", sqlParams)); }
internal async Task <ViewOwnerProduct> OwnerProductGetAsync(AccountProductPair pair) { var sqlParams = new SqlParameter[] { pair.AccountId.ToSql("accountId"), pair.AccountProductId.ToSql("accountProductId") }; return(await ExecuteReaderAsync <ViewOwnerProduct>("[accounts].[pProductGetByOwnerIDAccountProductId]", sqlParams)); }
internal async Task ProductEndDateSetAsync(AccountProductPair pair, DateTime endDate) { var sqlParams = new SqlParameter[] { pair.AccountId.ToSql("accountId"), pair.AccountProductId.ToSql("accountProductId"), endDate.ToSql("expiryDate") }; await ExecuteNonQueryAsync("[accounts].[pProductSetExpiryDateByAccountId]", sqlParams); }
internal async Task ProductNextRebillDateSetAsync(AccountProductPair pair, DateTime?nextRebillDate) { var sqlParams = new SqlParameter[] { pair.AccountId.ToSql("accountId"), pair.AccountProductId.ToSql("accountProductId"), nextRebillDate.ToSql("nextRebillDate") }; await ExecuteNonQueryAsync("[accounts].[pProductSetIsRenewalByAccountId]", sqlParams); }
internal async Task <ViewOwnerProduct> OwnerProductDetailsGetAsync(AccountProductPair pair) { var sqlParams = CreateSqlParams(pair).ToArray(); using (var cmd = Database.Connection.CreateCommand()) { cmd.CommandText = sqlParams.CommandText("[accounts].[pProductDetailGetByOwnerId]"); cmd.Parameters.AddRange(sqlParams); await Database.Connection.OpenAsync(); var reader = await cmd.ExecuteReaderAsync(); var product = ((IObjectContextAdapter)this).ObjectContext.Translate <ViewOwnerProduct>(reader).FirstOrDefault(); if (!object.Equals(product, null)) { reader.NextResult(); var accounts = ((IObjectContextAdapter)this).ObjectContext.Translate <ViewOwnerAccount>(reader).ToList(); reader.NextResult(); var accountSystems = ((IObjectContextAdapter)this).ObjectContext.Translate <ViewAccountSystem>(reader).ToList(); reader.NextResult(); var sessionTokens = ((IObjectContextAdapter)this).ObjectContext.Translate <ViewSessionToken>(reader).ToList(); Database.Connection.Close(); foreach (var account in accounts) { account.AccountSystems = accountSystems.Where(e => e.AccountId == account.AccountId).ToList(); account.SessionTokens = sessionTokens.Where(e => e.AccountId == account.AccountId).ToList(); } product.Accounts = accounts; } return(product); } }
public async Task <AssignStatus> ProductAssignAsync(AccountProductPair pair, bool isIgnoreBillingCycle = false) { return(await _context.ProductAssignAsync(pair, isIgnoreBillingCycle)); }
public async Task <ViewOwnerProduct> OwnerProductDetailsGetAsync(AccountProductPair pair) { return(await _context.OwnerProductDetailsGetAsync(pair)); }
public async Task ProductIsNewAsync(AccountProductPair pair, bool isNew) { await _context.ProductIsNewAsync(pair, isNew); }
public async Task ProductEndDateSetAsync(AccountProductPair pair, DateTime endDate) { await _context.ProductEndDateSetAsync(pair, endDate); }
public async Task ProductNextRebillDateSetAsync(AccountProductPair pair, DateTime?nextRebillDate) { await _context.ProductNextRebillDateSetAsync(pair, nextRebillDate); }
public async Task ProductDeactivateAsync(AccountProductPair pair) { await _context.ProductDeactivateAsync(pair); }
public async Task <AllowedCountStatus> ProductAllowedSetAsync(AccountProductPair pair, int allowedCount) { return(await _context.ProductAllowedSetAsync(pair, allowedCount)); }
public async Task <ViewUnassignProduct> ProductUnassignAsync(AccountProductPair pair) { return(await _context.ProductUnassignAsync(pair)); }
public async Task <List <AccountSystem> > AccountSystemsGetAsync(AccountProductPair pair) { return(await _context.AccountSystemsGetAsync(pair)); }
internal async Task <ViewUnassignProduct> ProductUnassignAsync(AccountProductPair pair) { var sqlParams = CreateSqlParams(pair); return(await ExecuteReaderAsync <ViewUnassignProduct>("[accounts].[pProductUnAssign]", sqlParams)); }