示例#1
0
 public void FireAccountUpdated(Account account)
 {
     if (AccountUpdatedHandler != null)
     {
         AccountUpdatedHandler.Invoke(account);
     }
 }
示例#2
0
        private  List<Account> GetAccountsDetails(IList<Credentials> credentials)
        {
            List<Account> result = new List<Account>();
            
            if(ServSettings.UseFakeAccountsDetails)
            {
                Account acc0 = new Account(credentials[0]);
                acc0.Pos = new Position(-2);
                result.Add(acc0);
                Account acc1 = new Account(credentials[1]);
                acc1.Pos = new Position(-1);
                result.Add(acc1);
            }
            else
            {
                using (BossaSpider spider = new BossaSpider())
                {
                    foreach (Credentials cred in credentials)
                    {
                        Account acc = new Account(cred);
                        spider.Login(acc);
                        acc.Pos = spider.GetCurrentPosition();
                        spider.Logout();
                        result.Add(acc);
                    }
                }
            }

            return result;
        }
示例#3
0
        public void Login(Account acc)
        {
            this.cred = acc.cred;
            this.acc = acc;
            CallTrace("Loging to " + cred.Login);

            Ie.GoTo(Navig.UrlLogin);
            Frame fra = Ie.Frame(Find.ByName("vibmain"));
            fra.TextField(Find.ByName("user")).TypeText(cred.Login);
            fra.TextField(Find.ByName("pin")).TypeText(cred.Pass);
            fra.Button(Find.ByName("ac")).Click();

            CallTrace("Loging successfull.");
        }
示例#4
0
        public void InitializeAccountsDetails(IList<Credentials> credentials)
        {
            List<Account> accountsList = GetAccountsDetails(credentials);

            int i = 0;
            foreach (Account acc in accountsList)
            {
                if (i == 0)
                {
                    Main = acc;
                    dispatcher.AddPosition(acc.Pos);
                }
                else
                    AccountsToSync.Add(acc);

                log.Info("Account " + acc.Id + " state: " + acc.Pos.Size + acc.Pos.Direct);
                i++;
            }
        }
示例#5
0
        private Position AdjustPosition4Account(Account acc, Position newPos)
        {
            Position p = new Position(newPos.Size, newPos.Direct, newPos.Price, newPos.Date);
            if(acc.Pos.Size == 0)
                return p;

            p.Size = p.Size*2;

            return p;
        }
示例#6
0
 void manager_AccountUpdatedHandler(Account account)
 {
     _client.UpdateUIAccount(account);
 }