Example #1
0
 private void EditNotes(IAccount account)
 {
     ("Note: " + account.Notes).Message();
     account.Notes = "Input new note: "
         .ReadLine();
     "Note saved.".Message();
 }
Example #2
0
        public static void GetAccountFundSalesStep( IAccount account, out System.Collections.Generic.IList<Sage.Entity.Interfaces.IAccountFundSales> result)
        {
            //Get a list of all fund sales for this contact
            Sage.Platform.RepositoryHelper<Sage.Entity.Interfaces.IAccountFundSales> f = Sage.Platform.EntityFactory.GetRepositoryHelper<Sage.Entity.Interfaces.IAccountFundSales>();
            Sage.Platform.Repository.ICriteria crit = f.CreateCriteria();

            crit.Add(f.EF.Eq("AccountId", account.Id.ToString()));

            result = crit.List<Sage.Entity.Interfaces.IAccountFundSales>();

            //Get distinct values

            //Calculate the total values
            double totalSales = (Double)(from h in result
                                    select h.TotalSales).Distinct().Sum();

            double totalYTDGrossSales = (Double)(from h in result
                                                 select h.TotalYTDGrossSales).Distinct().Sum();

            double totalYTDNetSales = (Double)(from h in result
                                            select h.TotalYTDNetSales).Distinct().Sum();

            //Add the totals to the the result set
            Sage.Entity.Interfaces.IAccountFundSales totalItem = Sage.Platform.EntityFactory.Create<Sage.Entity.Interfaces.IAccountFundSales>();
            totalItem.RepName = "All";
            totalItem.Sales = totalSales;
            totalItem.YTDGrossSales = totalYTDGrossSales;
            totalItem.YTDNetSales = totalYTDNetSales;

            result.Add (totalItem);
        }
Example #3
0
        public void EditAccount(IAccount account)
        {
            "Do you want to edit (T)ags, (F)ields, (N)otes or (D)elete the account?"
                .Option("t", () => EditTags(account))
                .Option("f", () => EditFields(account))
                .Option("n", () => EditNotes(account))
                .Option("d", () => _parentSection.DeleteAccount(account))
                .Choose();

            if (!account.IsDirty) {
                return;
            }

            var saved =
            "The account has been edited, press (S) to save it: "
                .Option("s", () => {
                    // ToDo: Save account
                    "Account saved.".Message();
                })
                .Confirm();

            if (saved) {
                return;
            }

            "Press (R) to revert the changes: "
                .Option("r", () => {
                    //ToDo: Revert account
                    "Account reverted.".Message();
                })
                .Choose();
        }
        bool IGroupSync.RemoveAccount(IAccount account)
        {
            if (account == null)
            {
                throw new ArgumentNullException(nameof(account));
            }

            IGroupMembership foundMembership = null;
            foreach (var item in this.AsInterface.GetAccountMemberships().Synchronously())
            {
                if ((item as IInternalGroupMembership).AccountHref.Equals(account.Href, StringComparison.InvariantCultureIgnoreCase))
                {
                    foundMembership = item;
                }

                if (foundMembership != null)
                {
                    break;
                }
            }

            if (foundMembership == null)
            {
                throw new InvalidOperationException("The specified account does not belong to this group.");
            }

            return foundMembership.Delete();
        }
        async Task<bool> IGroup.RemoveAccountAsync(IAccount account, CancellationToken cancellationToken)
        {
            if (account == null)
            {
                throw new ArgumentNullException(nameof(account));
            }

            IGroupMembership foundMembership = null;
            await this.AsInterface.GetAccountMemberships().ForEachAsync(
                item =>
                {
                    if ((item as IInternalGroupMembership).AccountHref.Equals(account.Href, StringComparison.InvariantCultureIgnoreCase))
                    {
                        foundMembership = item;
                    }

                    return foundMembership != null;
                }, cancellationToken).ConfigureAwait(false);

            if (foundMembership == null)
            {
                throw new InvalidOperationException("The specified account does not belong to this group.");
            }

            return await foundMembership.DeleteAsync(cancellationToken).ConfigureAwait(false);
        }
Example #6
0
        // ָ��Ϊǰһ�����ֵ���룬׬x%���
        public override ICollection<StockOper> GetOper(DateTime day, IAccount account)
        {
            IStockData prevStockProp = stockHistory.GetPrevDayStock(day);
            if (prevStockProp == null)
            {
                Debug.WriteLine("StrategyPercent -- GetPrevDayStock ERROR: Cur Day: " + day.ToLongDateString());
                return null;
            }

            ICollection<StockOper> opers = new List<StockOper>();
            int stockCount = Transaction.GetCanBuyStockCount(account.BankRoll,
                    prevStockProp.MinPrice);
            if (stockCount > 0)
            {
                StockOper oper = new StockOper(prevStockProp.MinPrice, stockCount, OperType.Buy);
                opers.Add(oper);
            }

            if (stockHolder.HasStock())
            {
                double unitCost = stockHolder.UnitPrice;
                if (unitCost > 0)
                {
                    StockOper oper2 = new StockOper(unitCost * (1 + winPercent), stockHolder.StockCount(), OperType.Sell);
                    opers.Add(oper2);
                }
            }

            return opers;
        }
 private void FinalizeUri()
 {
     _account = _account ?? _accountManager.DefaultAccount;
     IVoIPTransport transport = _account.Transport;
     _sb.AppendTransportSuffix(transport.TransportType);
     _call.SetAccount(_account.As<Account>());
 }
 public IMessageBuilder From(IAccount account)
 {
     _from = account ?? _accountManager.DefaultAccount;
     TransportType ttype = _from.Transport.TransportType;
     _builder.AppendTransportSuffix(ttype);
     return this;
 }
Example #9
0
 private bool Equals(IAccount other)
 {
     return string.Equals(Provider, other.Provider)
            && string.Equals(AccountId, other.AccountId)
            && string.Equals(DisplayName, other.DisplayName)
            && Equals(CurrentSession, other.CurrentSession);
 }
Example #10
0
        // Example of target method signature
        public static void MyConvertLeadToAccount(ILead lead, IAccount account)
        {
            //===============================================================
            // This code doesn't work.... added it directly to LeadsearchandConvert
            //==========================================================================

            //foreach (ILeadWebsite tmpWebsite in lead.LeadWebsites)
            //{
            //    // Create Account Additional Website Record
            //    Sage.Entity.Interfaces.IAccountWebsite Acctwebsite = Sage.Platform.EntityFactory.Create<Sage.Entity.Interfaces.IAccountWebsite >();
            //    Acctwebsite.Account = account;
            //    Acctwebsite.Notes  = tmpWebsite.Notes ;
            //    Acctwebsite.WebAddress  = tmpWebsite.WebAddress;

            //    try
            //    {
            //        Acctwebsite.Save();
            //    }
            //    catch (Exception)
            //    {

            //        //Exception But Continue
            //    }
            //}
        }
Example #11
0
 public Transaction(IAccount account, IPayment payout, string currency)
 {
     Account = account;
     Payment = payout;
     Currency = currency;
     CreatedAt = DateTime.Now;
 }
		private static IProfile GetProfile(IAccount account, PluginProfile legacyProfile)
		{
			var convertedProfileName = String.Format("{0} _re-converted_", legacyProfile.ProfileName);

			return account.Profiles.FirstOrDefault(x => x.Name == convertedProfileName) ??
			       account.Profiles.FirstOrDefault(x => x.Name == legacyProfile.ProfileName);
		}
Example #13
0
 public Account(int id, IAccount account)
 {
     Id = id;
     Email = account.Email;
     Password = account.Password;
     DomainName = account.DomainName;
 }
Example #14
0
        public void SetUp()
        {
            userCreds = new UserCredentials(Credentials.USERNAME, Credentials.API_KEY);
            connection = new Connection(userCreds);

            account = connection.Account;
        }
Example #15
0
		protected async override void SelectAccount(IAccount account)
        {
			var githubAccount = (BitbucketAccount) account;

			if (githubAccount.DontRemember)
			{
				ShowViewModel<AddAccountViewModel>(new AddAccountViewModel.NavObject { AttemptedAccountId = githubAccount.Id });
				return;
			}

			try
			{
				IsLoggingIn = true;
				var client = await _loginService.LoginAccount(githubAccount);
				_applicationService.ActivateUser(githubAccount, client);
			}
			catch (Exception e)
			{
                DisplayAlert("Unable to login: " + e.Message);
				ShowViewModel<AddAccountViewModel>(new AddAccountViewModel.NavObject() { AttemptedAccountId = githubAccount.Id });
			}
			finally
			{
				IsLoggingIn = false;
			}
        }
Example #16
0
 /// <summary>
 /// Attempts to try and add an account to the database.
 /// </summary>
 /// <param name="newAccount">Account to add</param>
 public void AddAccount(IAccount newAccount)
 {
     if (accounts.Select(x => x).Any(x => x.Username == newAccount.Username))
         throw new Exception();
     newAccount.TableID = tableID++;
     accounts.Add(newAccount);
 }
 public void PopulatedAccount(IAccount account, int days)
 {
     PopulateTweetsForLastTwoWeeks(account, days);
     account.TotalTweets = calculateTweetAggregates.CalculateTotalTweets(account);
     account.TotalNumberofTimesAnotherUserWasMentioned =
         calculateTweetAggregates.CalculateTotalNumberofTimesAnotherUserWasMentioned(account);
 }
Example #18
0
        public FlistService(IAccount model, IEventAggregator eventagg, IBrowseThings browser,
            IGetTickets ticketService, IFriendRequestService requestService)
        {
            this.browser = browser;
            this.ticketService = ticketService;
            this.requestService = requestService;

            try
            {
                this.model = model.ThrowIfNull("model");
                events = eventagg.ThrowIfNull("eventagg");

                events.GetEvent<LoginEvent>().Subscribe(GetTicket, ThreadOption.BackgroundThread);
                events.GetEvent<UserCommandEvent>().Subscribe(HandleCommand, ThreadOption.BackgroundThread);
                events.GetEvent<CharacterSelectedLoginEvent>().Subscribe(args => selectedCharacter = args);

                // fix problem with SSL not being trusted on some machines
                ServicePointManager.ServerCertificateValidationCallback =
                    (sender, certificate, chain, sslPolicyErrors) => true;
            }
            catch (Exception ex)
            {
                Exceptions.HandleException(ex);
            }
        }
        public void Initialise_Test()
        {
            _transactionRepository = new Mock<ITransactionRepository>();
            _statementPrinter = new Mock<IStatementPrinter>();

            _account = new Account(_transactionRepository.Object, _statementPrinter.Object);
        }
Example #20
0
 public void TransferFunds(IAccount fromAccnt, IAccount toAccnt, double amount)
 {
     //customer can use the transfer service which implement the ITransferFunds Interface
     //Future:this is good place to check for Authorization of customer for $ transfer before method call
     CustomerTransferFunds initiateTransfer = new CustomerTransferFunds();
     initiateTransfer.Account_To_Account_Transfer(this, fromAccnt, toAccnt, amount);
 }
 public PrivateRepositoryQuotaExceededUserError(IAccount account, string errorMessage, string errorCauseOrResolution = null)
     : base(errorMessage, errorCauseOrResolution)
 {
     UserErrorIcon = StockUserErrorIcon.Error;
     UsedPrivateSlots = account.OwnedPrivateRepos;
     AvaliblePrivateSlots = account.PrivateReposInPlan;
 }
Example #22
0
		public IAccount GetDefaultAccount()
		{
			if (defaultAccount == null || accounts1.ContainsKey(defaultAccount.Id) == false)
			{
				defaultAccount = accounts1.First((a) => true);

				if (defaultAccount != null)
				{
					accounts1.ForEach(
						(other) =>
						{
							if (other.Id < defaultAccount.Id)
								defaultAccount = other;
						});
				}
				else
				{
					int id = AddAccount(new Account()
					{
						DomainName = @"officesip.local",
					});

					defaultAccount = accounts1.GetValue(id);
				}
			}

			return defaultAccount;
		}
		private static IProfile GetProfile(IAccount account, PluginProfile legacyProfile)
		{
			var convertedProfileName = String.Concat(legacyProfile.ProfileName, "_converted");

			return account.Profiles.FirstOrDefault(x => x.Name == convertedProfileName) ??
						 account.Profiles.FirstOrDefault(x => x.Name == legacyProfile.ProfileName);
		}
        public static IObservable<RecoveryOptionResult> Throw(IAccount account)
        {
            var errorMessage = string.Format(CultureInfo.InvariantCulture, 
                "You are using {0} out of {1} private repositories.", account.OwnedPrivateRepos, account.PrivateReposInPlan);

            return Throw(new PrivateRepositoryQuotaExceededUserError(account, errorMessage));
        }
Example #25
0
		private DirectorySearchResponse Search(ServiceSoap1 service, DirectorySearchRequest request, IAccount account)
		{
			var count = service.MaxResults > request.MaxResults ? request.MaxResults : service.MaxResults;

			string givenName, givenEmail;
			if (request.SearchTerms.TryGetValue(@"givenName", out givenName) == false)
				givenName = string.Empty;
			if (request.SearchTerms.TryGetValue(@"givenEmail", out givenEmail) == false)
				givenEmail = string.Empty;

			var result = new List<DirectorySearchItem>(count);
			var moreAvailable = false;

			for (int i = 0; i < userz.Count; i++)
			{
				if (Search(account, userz[i], givenName, givenEmail, count, result))
				{
					moreAvailable = true;
					break;
				}
			}

			return new DirectorySearchResponse()
			{
				Items = result,
				MoreAvailable = moreAvailable,
			};
		}
Example #26
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="FchatService" /> class.
        ///     Chat connection is used to communicate with F-Chat using websockets.
        /// </summary>
        /// <param name="user">
        ///     The user.
        /// </param>
        /// <param name="eventagg">
        ///     The eventagg.
        /// </param>
        /// <param name="socket"></param>
        /// <param name="provider"></param>
        public FchatService(IAccount user, IEventAggregator eventagg, WebSocket socket, ITicketProvider provider)
        {
            this.socket = socket;
            this.provider = provider;
            Account = user.ThrowIfNull("user");
            events = eventagg.ThrowIfNull("eventagg");

            events.GetEvent<CharacterSelectedLoginEvent>()
                .Subscribe(ConnectToChat, ThreadOption.BackgroundThread, true);

            errsThatDisconnect = new[]
                {
                    Constants.Errors.NoLoginSlots,
                    Constants.Errors.NoServerSlots,
                    Constants.Errors.KickedFromServer,
                    Constants.Errors.SimultaneousLoginKick,
                    Constants.Errors.BannedFromServer,
                    Constants.Errors.BadLoginInfo,
                    Constants.Errors.TooManyConnections,
                    Constants.Errors.UnknownLoginMethod
                };

            InitializeLog();

            autoPingTimer.Elapsed += (s, e) => TrySend(Constants.ClientCommands.SystemPing);
            autoPingTimer.Start();

            staggerTimer = new Timer(GetNextConnectDelay()); // first reconnect is 5 seconds
            staggerTimer.Elapsed += (s, e) => DoReconnect();
        }
Example #27
0
        // ��򵥵��㷨��ָ��Ϊǰһ�����ֵ���룬���ֵ���
        public override ICollection<StockOper> GetOper(DateTime day, IAccount account)
        {
            IStockData prevStock = stockHistory.GetPrevDayStock(day);
            if (prevStock == null)
            {
                Debug.WriteLine("StrategyMinMax -- GetPrevDayStock ERROR: Cur Day: " + day.ToLongDateString());
                //Debug.Assert(false);
                return null;
            }

            ICollection<StockOper> opers = new List<StockOper>();
            int stockCount = Transaction.GetCanBuyStockCount(account.BankRoll,
                    prevStock.MinPrice);
            if (stockCount > 0)
            {
                StockOper oper = new StockOper(prevStock.MinPrice, stockCount, OperType.Buy);
                opers.Add(oper);
            }

            if (stockHolder.HasStock())
            {
                StockOper oper2 = new StockOper(prevStock.MaxPrice, stockHolder.StockCount(), OperType.Sell);
                opers.Add(oper2);
            }

            return opers;
        }
Example #28
0
 public Transfer(float amount, IAccount from, IAccount to)
 {
     From = from;
     To = to;
     Amount = amount;
     History = new List<IOperationHistory>();
 }
Example #29
0
 public Account(IAccount other)
 {
     Id = other.Id;
     Email = other.Email;
     Password = other.Password;
     DomainName = other.DomainName;
 }
Example #30
0
        static void Main(string[] args)
        {
            IAccount  [] accounts = new IAccount[MAX_CUST];
            accounts[0] = new CustomerAccount("Phuong");
            accounts[0].payInFunds(100);
            Console.WriteLine("Balance "+ accounts[0].Balance);

            accounts[1] = new BabyAccount("KKY","Nanterre");
            accounts[1].payInFunds(20);
            accounts[1].withdrawFunds(9);
            accounts[1].Name = "KKYPhuong";
            Console.WriteLine(accounts[0].printWarning());
            Console.WriteLine(accounts[0].ToString());
            Console.WriteLine(accounts[1].ToString());
            Console.WriteLine(accounts[0].Equals(accounts[1]));
            Console.WriteLine(accounts[1].Equals(accounts[0]));

            //Delegate
            CalculateFee calc; //declare an instance of delegate
            calc = new CalculateFee(RipOffFee); // map/call the ripofffee method
            calc(-1);     //execute the method

            calc = new CalculateFee(FriendlyFee);
            calc(-1);

            //Bank

            SGBank myBank = new SGBank();
            myBank.storeAccount(accounts[0]);
            myBank.storeAccount(accounts[1]);
            IAccount found = myBank.findAccount("Phuong");
            Console.WriteLine(found.ToString());
            string d = Console.ReadLine();
        }
Example #31
0
 public Web3Geth(IAccount account, string url = @"http://localhost:8545/", ILog log = null, AuthenticationHeaderValue authenticationHeader = null) : base(account, url, log, authenticationHeader)
 {
 }
Example #32
0
 public Web3Geth(IAccount account, IClient client) : base(account, client)
 {
 }
        /// <summary>
        /// deposit the given account into the account named
        /// </summary>
        /// <param name="accountName"></param>
        /// <param name="amount"></param>
        public void Deposit(string accountName, decimal amount)
        {
            IAccount acc = FindAccount(accountName);

            acc.AddTransaction(amount);
        }
        /// <summary>
        /// find the reward points of the given account
        /// </summary>
        /// <param name="accountName"></param>
        /// <returns></returns>
        public int GetRewardPoints(string accountName)
        {
            IAccount acc = FindAccount(accountName);

            return(acc.RewardPoints);
        }
        /// <summary>
        /// find the balance of the given account
        /// </summary>
        /// <param name="accountName"></param>
        /// <returns></returns>
        public decimal GetAccountBalance(string accountName)
        {
            IAccount acc = FindAccount(accountName);

            return(acc.Balance);
        }
        /// <summary>
        /// create a new account
        /// </summary>
        /// <param name="accountName"></param>
        /// <param name="accountType"></param>
        public void CreateAccount(string accountName, AccountType accountType)
        {
            IAccount newAccount = AccountFactory.CreateAccount(accountType);

            accountsDictionary.Add(accountName, newAccount);
        }
Example #37
0
 public void TransferTo(IAccount account, double amount)
 {
     Withdraw(amount);
     account.Deposit(amount);
     Commit();
 }
Example #38
0
    // TODO: refactor (see ActivityDetails)
    private void SetTacoDefaults()
    {
        // check to see if TACO values are passed in the querystring first - this takes precedence
        SetLeadDivVisible(false);
        if (GetParam("aid") != null)
        {
            Activity.AccountId = GetParam("aid");

            if (GetParam("cid") != null)
            {
                Activity.ContactId = GetParam("cid");
            }

            if (GetParam("oid") != null)
            {
                Activity.OpportunityId = GetParam("oid");
            }

            if (GetParam("tid") != null)
            {
                Activity.TicketId = GetParam("tid");
            }
            if (GetParam("lid") != null)
            {
                SetLeadDivVisible(true);
                Activity.LeadId = GetParam("lid");
                ILead lead = EntityFactory.GetById <ILead>(Activity.LeadId);
                if (lead != null)
                {
                    Activity.AccountName = lead.Company;
                    Activity.LeadName    = lead.LeadNameLastFirst;
                    Activity.ContactName = lead.LeadNameLastFirst;
                }
            }
        }
        else
        {
            bool found = false;
            foreach (Sage.Platform.Application.EntityHistory hist in EntityContext.EntityHistory)
            {
                string entityType = hist.EntityType.Name;
                switch (entityType)
                {
                case "IAccount":
                    found = true;
                    IAccount account = EntityFactory.GetById <IAccount>(hist.EntityId.ToString());
                    Activity.AccountId   = account.Id.ToString();
                    Activity.AccountName = account.AccountName;
                    foreach (Sage.Entity.Interfaces.IContact accountContact in account.Contacts)
                    {
                        if ((bool)accountContact.IsPrimary)
                        {
                            Activity.ContactId   = accountContact.Id.ToString();
                            Activity.ContactName = accountContact.LastName + ", " + accountContact.FirstName;
                            break;
                        }
                    }
                    break;

                case "IContact":
                    found = true;
                    IContact contact = EntityFactory.GetById <IContact>(hist.EntityId.ToString());
                    Activity.ContactId   = contact.Id.ToString();
                    Activity.ContactName = contact.LastName + ", " + contact.FirstName;
                    Activity.AccountId   = contact.Account.Id.ToString();
                    Activity.AccountName = contact.Account.AccountName;
                    break;

                case "IOpportunity":
                    found = true;
                    IOpportunity opportunity = EntityFactory.GetById <IOpportunity>(hist.EntityId.ToString());
                    Activity.OpportunityId   = opportunity.Id.ToString();
                    Activity.OpportunityName = opportunity.Description;
                    Activity.AccountId       = opportunity.Account.Id.ToString();
                    Activity.AccountName     = opportunity.Account.AccountName;
                    foreach (Sage.Entity.Interfaces.IOpportunityContact oppContact in opportunity.Contacts)
                    {
                        if ((bool)oppContact.IsPrimary)
                        {
                            Activity.ContactId   = oppContact.Contact.Id.ToString();
                            Activity.ContactName = oppContact.Contact.LastName + ", " +
                                                   oppContact.Contact.FirstName;
                            break;
                        }
                    }
                    break;

                case "ITicket":
                    found = true;
                    ITicket ticket = EntityFactory.GetById <ITicket>(hist.EntityId.ToString());
                    Activity.TicketId     = ticket.Id.ToString();
                    Activity.TicketNumber = ticket.AlternateKeyPrefix + "-" + ticket.AlternateKeySuffix;
                    Activity.AccountId    = ticket.Account.Id.ToString();
                    Activity.AccountName  = ticket.Account.AccountName;
                    Activity.ContactId    = ticket.Contact.Id.ToString();
                    Activity.ContactName  = ticket.Contact.LastName + ", " + ticket.Contact.FirstName;
                    break;

                case "ILead":
                    found = true;
                    ILead lead = EntityFactory.GetById <ILead>(hist.EntityId.ToString());
                    if (lead != null)
                    {
                        Activity.LeadId      = hist.EntityId.ToString();
                        Activity.LeadName    = lead.LeadNameLastFirst;
                        Activity.ContactName = lead.LeadNameLastFirst;
                        Activity.AccountName = lead.Company;
                    }
                    SetLeadDivVisible(true);
                    break;
                }
                if (found)
                {
                    break;
                }
            }
        }
    }
Example #39
0
 private static void DisplaySignedInAccount(IAccount account)
 {
     Console.ForegroundColor = ConsoleColor.Green;
     Console.WriteLine($"{account.Username} successfully signed-in");
 }
Example #40
0
 public static void InitializeAccount(IAccount account)
 {
     //account.SetCapital(20); // умова, що задовільняє об’єкти обох класів
     account.SetCapital(200);  // умова, що не задовільняє об’єкт класу MicroAccount
     Console.WriteLine(account.Capital);
 }
 public AuthResult(string accessToken, bool isExtendedLifeTimeToken, string uniqueId, DateTimeOffset expiresOn, DateTimeOffset extendedExpiresOn, string tenantId, IAccount account, string idToken, IEnumerable <string> scopes, Guid correlationId)
     : base(accessToken, isExtendedLifeTimeToken, uniqueId, expiresOn, extendedExpiresOn, tenantId, account, idToken, scopes, correlationId)
 {
 }
Example #42
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CloseAccountOutput"/> class.
 /// </summary>
 /// <param name="account">IAccount object.</param>
 public CloseAccountOutput(IAccount account)
 {
     this.AccountId = account.Id;
 }
Example #43
0
 public User(string username, IAccount account)
 {
     this.Username = username;
     this.account  = account;
 }
Example #44
0
 public OpenUserWindowCommand(IAccount account)
 {
     this._account = account;
 }
        public IOAuth2Request CreateRequest(string method, string accessTokenParameterName, Uri url, IDictionary <string, string> parameters, IAccount account)
        {
            var request = new CustomOAuth2Request(method, url, parameters, new Account(account.Username, account.Properties, account.Cookies));

            request.AccessTokenParameterName = accessTokenParameterName;
            return(new PlatformOAuth2Request(request));
        }
Example #46
0
 public override void GetAccountChanges(IAccount acnt)
 {
     throw new NotImplementedException();
 }
Example #47
0
        /// <summary>
        /// Tells if the account is a consumer account
        /// </summary>
        /// <param name="account">Account</param>
        /// <returns><c>true</c> if the application supports MSA+AAD and the home tenant id of the account is the MSA tenant. <c>false</c>
        /// otherwise (in particular if the app is a single-tenant app, returning <c>false</c> enables MSA accounts which are guest
        /// of a directory</returns>
        private static bool IsConsumerAccount(IAccount account)
        {
            const string msaTenantId = "9188040d-6c67-4c5b-b112-36a304b66dad";

            return((Tenant == "common" || Tenant == "consumers") && account?.HomeAccountId.TenantId == msaTenantId);
        }
 public Debit(IAccount account, PositiveMoney amountToWithdraw, DateTime transactionDate)
 {
     AccountId       = account.Id;
     Amount          = amountToWithdraw;
     TransactionDate = transactionDate;
 }
Example #49
0
 public static Task <IAccount> CreateAccountAsync(IInternalAsyncDataStore dataStore, string accountsHref, IAccount account, CancellationToken cancellationToken)
 => dataStore.CreateAsync(accountsHref, account, cancellationToken);
Example #50
0
 public static IAccount CreateAccount(IInternalSyncDataStore dataStoreSync, string accountsHref, IAccount account)
 => dataStoreSync.Create(accountsHref, account);
Example #51
0
        public static Task <IAccount> CreateAccountAsync(IInternalAsyncDataStore dataStore, string accountsHref, IAccount account, Action <AccountCreationOptionsBuilder> creationOptionsAction, CancellationToken cancellationToken)
        {
            var builder = new AccountCreationOptionsBuilder();

            creationOptionsAction(builder);
            var options = builder.Build();

            return(dataStore.CreateAsync(accountsHref, account, options, cancellationToken));
        }
Example #52
0
        public static IAccount CreateAccount(IInternalSyncDataStore dataStoreSync, string accountsHref, IAccount account, Action <AccountCreationOptionsBuilder> creationOptionsAction)
        {
            var builder = new AccountCreationOptionsBuilder();

            creationOptionsAction(builder);
            var options = builder.Build();

            return(dataStoreSync.Create(accountsHref, account, options));
        }
 public async Task Update(IAccount account, ICredit credit)
 {
     await _context.Credits.AddAsync((EntityFrameworkDataAccess.Credit) credit);
 }
        public virtual async ValueTask <AuthenticationResult> AcquireTokenSilentAsync(string[] scopes, IAccount account, bool async, CancellationToken cancellationToken)
        {
            IPublicClientApplication client = await GetClientAsync(async, cancellationToken).ConfigureAwait(false);

            return(await client.AcquireTokenSilent(scopes, account).ExecuteAsync(async, cancellationToken).ConfigureAwait(false));
        }
 /// <summary>
 /// Sets the account for which the token will be retrieved. This method is mutually exclusive
 /// with <see cref="WithLoginHint(string)"/>. If both are used, an exception will be thrown
 /// </summary>
 /// <param name="account">Account to use for the interactive token acquisition. See <see cref="IAccount"/> for ways to get an account</param>
 /// <returns>The builder to chain the .With methods</returns>
 public AcquireTokenInteractiveParameterBuilder WithAccount(IAccount account)
 {
     CommonParameters.AddApiTelemetryFeature(ApiTelemetryFeature.WithAccount);
     Parameters.Account = account;
     return(this);
 }
 public async Task Update(IAccount account, IDebit debit)
 {
     await _context.Debits.AddAsync((EntityFrameworkDataAccess.Debit) debit);
 }
Example #57
0
 private void AddAccount(string accountId, IAccount account)
 {
     Accounts.Add(account);
     accountsByName.Add(accountId, account);
 }
Example #58
0
 /// <summary>
 /// 设置当前操作员账号。
 /// </summary>
 /// <param name="account"></param>
 public void SetAccount(IAccount account)
 {
     this.m_Account = account;
 }
Example #59
0
 internal AccountViewModel(IAccount account)
 {
     _account = account;
 }
Example #60
0
    /// <summary>
    /// Loads the marketing.
    /// </summary>
    private void LoadResponses()
    {
        try
        {
            ISession session = SessionFactoryHolder.HolderInstance.CreateSession();
            try
            {
                if (EntityContext != null && EntityContext.EntityType == typeof(IAccount))
                {
                    IAccount      account = EntityFactory.GetRepository <IAccount>().Get(EntityContext.EntityID);
                    StringBuilder qry     = new StringBuilder();
                    qry.Append("Select contact, response.ResponseDate, response.Interest, response.Status, response.InterestLevel, ");
                    qry.Append("response.LeadSource, campaign.CampaignName, response.Id ");
                    qry.Append("From TargetResponse as response ");
                    qry.Append("Join response.Contact as contact ");
                    qry.Append("Left Join response.Campaign as campaign ");
                    qry.Append("Where contact.Account.Id = :accountId");
                    if (grdResponses.AllowSorting)
                    {
                        qry.Append(GetOrderByClause());
                    }
                    IQuery q = session.CreateQuery(qry.ToString());

                    q.SetAnsiString("accountId", account.Id.ToString());

                    IList result;
                    using (new SparseQueryScope())
                    {
                        result = q.List();
                    }
                    System.Data.DataTable dt = new DataTable();
                    dt.Columns.Add("ContactId");
                    dt.Columns.Add("Contact");
                    System.Data.DataColumn col = new DataColumn("ResponseDate", typeof(DateTime));
                    dt.Columns.Add(col);
                    dt.Columns.Add("Interest");
                    dt.Columns.Add("Status");
                    dt.Columns.Add("InterestLevel");
                    dt.Columns.Add("LeadSource");
                    dt.Columns.Add("Campaign");
                    dt.Columns.Add("ResponseId");
                    if (result != null)
                    {
                        foreach (object[] data in result)
                        {
                            dt.Rows.Add(((IContact)data[0]).Id, data[0], ConvertData(data[1]), data[2], data[3], data[4], data[5], data[6], data[7]);
                        }
                    }
                    grdResponses.DataSource = dt;
                    grdResponses.DataBind();
                }
            }
            finally
            {
                SessionFactoryHolder.HolderInstance.ReleaseSession(session);
            }
        }
        catch (Exception ex)
        {
            log.Error(ex.Message);
            throw;
        }
    }