示例#1
0
 public Bank()
 {
     BankAccounts = new AccountList();
     BankAccounts.Add(100, "Bob");
     BankAccounts.Add(200, "Mary");
     BankAccounts.Add(300, "Charlie");
 }
示例#2
0
        private void GetAccountList()
        {
            var ci = new CommandInfo("account list", "account");

            ci = CH.ExecuteCommand(ci);
            Assert.IsTrue(ci.Result);
            if (ci.InfoMsg.Count != 0)
            {
                foreach (var item in ci.InfoMsg)
                {
                    AccountList.Add(new AccountInfo(item));
                }
            }

            /*
             * var fileList = Directory.GetFiles(KeyStorePath, "*.ak");
             * foreach (var item in fileList)
             * {
             *  string[] fileInfo;
             *  if (item.Contains("/"))
             *      fileInfo = item.Split("/");
             *  else
             *      fileInfo = item.Split("\\");
             *  string account = fileInfo[fileInfo.Length - 1].Replace(".ak", "");
             *  AccountList.Add(new AccountInfo(account));
             * }
             */
        }
示例#3
0
        public void accountList <T>(AccountList <T> accountList)
        {
            //Build a query string
            string sql = string.Format("SELECT [userID],[userName],[password],[authLevel],[joinedDate],[isLoggedIn] FROM [OTF_Invoice].[dbo].[USERS]");

            //Get a dataset from the query
            DataSet dataSet = DataProvider.GetDataSet(sql);

            //Create variables for dataset
            DataTable rotiTable = dataSet.Tables[0];

            //Load roti list from the database
            accountItem nextAccount = null;

            foreach (DataRow parent in rotiTable.Rows)
            {
                nextAccount          = new accountItem();
                nextAccount.UserName = parent["userName"].ToString();
                nextAccount.PassWord = parent["password"].ToString();

                //Add the data item to the data list
                accountList.Add(nextAccount);
            }

            //Dispose of the dataset
            dataSet.Dispose();
        }
示例#4
0
        public void Refresh()
        {
            if (TargetObject == null)
            {
                return;
            }
            var o = TargetObject as IPortfolio;

            if (o == null)
            {
                return;
            }

            PositionList.Clear();
            AccountList.Clear();

            o.PositionList.ForEach(v =>
            {
                PositionList.Add(v);
            });

            o.AccountList.ForEach(v =>
            {
                AccountList.Add(v);
            });
        }
示例#5
0
        void LoadData(object obj)
        {
            if (obj == null)
            {
                return;
            }

            var p = obj as IPortfolio;

            if (p == null)
            {
                return;
            }

            PositionList.Clear();
            p.PositionList.ForEach(v =>
            {
                PositionList.Add(v.Clone() as IPosition);
            });
            p.AccountList.ForEach(v =>
            {
                AccountList.Add(v.Clone() as Account);
            });
            Name = p.Name;
            Memo = p.Memo;

            LastMarketDataTime = p.LastMarketDataTime;
            CurrentCurrency    = p.CurrentCurrency;
        }
示例#6
0
        public void AddAccount(string name, string dayOfMonthDue, string lastPaidDueDate, string link, string note, string statementEndDay)
        {
            XAttribute attribute;
            XElement   accountElement = new XElement("account");

            attribute = new XAttribute("name", name);
            accountElement.Add(attribute);
            attribute = new XAttribute("dayOfMonthDue", dayOfMonthDue);
            accountElement.Add(attribute);
            attribute = new XAttribute("lastPaidDueDate", lastPaidDueDate);
            accountElement.Add(attribute);
            attribute = new XAttribute("link", link);
            accountElement.Add(attribute);
            attribute = new XAttribute("statementEndDay", statementEndDay);
            accountElement.Add(attribute);


            mainElement.Add(accountElement);

            XmlHelper.SaveToXML(filePath, mainElement);
            //foo
            try
            {
                DateTime lastPaidDue = DateTime.Parse(lastPaidDueDate);
                Int32    day         = Convert.ToInt32(dayOfMonthDue);
                var      newAccount  = new Account(name, day, lastPaidDue, link, note, statementEndDay, DaysUntilTimeToPay);
                AccountList.Add(newAccount);
            }
            catch (Exception)
            {
                MessageBox.Show("Error invalid day of month or last paid due date or end day");
                return;
            }
        }
示例#7
0
        public override int run(AccountList accts)
        {
            /* validate the options. */
            Account acct = new Account();

            acct.name = _opts.name;
            if (string.IsNullOrWhiteSpace(acct.name))
            {
                Console.WriteLine("Account name can't be blank.");
                return(-1);
            }

            if (string.Compare(_opts.type, "local", true) == 0)
            {
                acct.svcName = typeof(BackupLib.LocalService).FullName;
                acct.connStr = _opts.directory;
            }
            if (string.Compare(_opts.type, "b2", true) == 0)
            {
                acct.svcName = typeof(CommB2.Connection).FullName;
                acct.connStr = string.Format("{0}:{1}", _opts.user, _opts.password);
            }

            if (string.IsNullOrWhiteSpace(acct.svcName))
            {
                Console.WriteLine("Account type unknown: valid types: local, b2");
                return(-1);
            }

            accts.Add(acct);
            BackupLib.AccountBuilder.Load(accts, acct);
            return(0);
        }
示例#8
0
    private void AddAccountToListAndSave(object obj)
    {
        var account = new Accounts();

        account.AccountName = AccountnName;
        AccountList.Add(account);
        SaveListToXml();
    }
示例#9
0
        protected void lnkEditPersonalInformation_OnCommand(object sender, CommandEventArgs e)
        {
            AccountList al = new AccountList();

            al.Add(AccountManager.GetAccountByID(_accountSearched.AccountID));

            fview_EditPersonalInformation.DataSource = al;
            fview_EditPersonalInformation.DataBind();

            this.mPopupEdit_PersonalInformation.Show();
        }
示例#10
0
 private void NewAccounts(int count)
 {
     for (int i = 0; i < count; i++)
     {
         var ci = new CommandInfo("account new", "account");
         ci.Parameter = "123";
         ci           = CH.ExecuteCommand(ci);
         Assert.IsTrue(ci.Result);
         AccountList.Add(new AccountInfo(ci.InfoMsg?[0].Replace("Account address:", "").Trim()));
     }
 }
示例#11
0
        private void AddAccountButton_Click(object sender, EventArgs e)
        {
            AddAccountForm form = new AddAccountForm();

            if (form.ShowDialog() == DialogResult.OK)
            {
                AccountList.Add(form.AccountName + ";" + form.Password);
                statusLabel.Text = "Un compte a été ajouté au domaine \"" + ((Domain)DomainListbox.SelectedValue).Name + "\"";
                EnableAccountButtons();
                UnsavedModifications = true;
            }
        }
示例#12
0
        /// <summary>
        /// 新增命令
        /// </summary>
        /// <returns></returns>
        public override void ExecuteAdd()
        {
            Sys_Accounts account = new Sys_Accounts();

            account.ID = new UserInfoBLL().GetMaxAccountID() + 1;
            FrmAccountSettingEdit edit = new FrmAccountSettingEdit(account);

            edit.SaveEvent += (r) =>
            {
                AccountList.Add(r);
            };
            edit.ShowDialog();
        }
示例#13
0
        /// <summary>
        /// Open a saving account
        /// </summary>
        /// <param name="customerName">Customer name</param>
        /// <param name="openDate">The date of the transaction</param>
        /// <returns>Opened account</returns>
        public IAccount OpenSavingsAccount(string customerName, DateTimeOffset openDate)
        {
            if (!ValidateCustomerName(customerName) || LimitReached(SAVINGS_ACCOUNT_PREFIX))
            {
                return(null);
            }

            String  accountNumber = SAVINGS_ACCOUNT_PREFIX + _savingsAccountCounter.ToString("D6");
            Account account       = new Account(accountNumber, customerName, openDate);

            AccountList.Add(account);
            _savingsAccountCounter++;

            return(account);
        }
 private void OnRefresh()
 {
     try
     {
         AccountList.Clear();
         foreach (var account in Dal.GetAccounts())
         {
             AccountList.Add(account);
         }
         OnPropertyChanged(nameof(AccountList));
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Assets", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
示例#15
0
 //принятие изменений (сохранение в основной список)
 private void AcceptButton_Click(object sender, EventArgs e)
 {
     if (LoginBox.Text == "" || PasswordBox.Text == "")
     {
         MessageBox.Show("Проверьте заполненность полей");
         return;
     }
     if (edit)
     {
         List[Index] = new Account(LoginBox.Text, PasswordBox.Text, AdminCheckBox.Checked);
     }
     else
     {
         List.Add(new Account(LoginBox.Text, PasswordBox.Text, AdminCheckBox.Checked));
     }
     Close();
 }
示例#16
0
        private void bRegister_Click(object sender, EventArgs e)
        {
            ValidateRegistration();
            Owner       owner   = new Owner(tbName.Text, dt.Value);
            BankAccount account =
                BankAccount.GetBankAccount(cbType.SelectedIndex, owner, cbSMS.Checked, cbinternetBanking.Checked);

            if (account == null)//TODO:(validation)
            {
                MessageBox.Show("You must select account type");
                return;
            }
            AccountList accountList = AccountList.GetAccountList();

            accountList.Add(account);
            MessageBox.Show("Account with name: " + tbName.Text + " has been registered", "Registration");
            ClearAfterRegistration();
        }
        public void OpenFile(object value = null)
        {
            ActivatedAccountsFilter_VM vm = new ActivatedAccountsFilter_VM(dialogService = new DialogService());

            dialogService.OpenFileDialog();
            tableData = new DataTable(dialogService);
            List <Account> acc = tableData.ReturnAccountList();

            foreach (Account account in acc)
            {
                login  = account.login;
                header = account.header;
                AccountList.Add(new ActivatedAccountsFilter_VM(login, header));
            }

            //vm.login = tableData.ID2; как разберусь - убрать

            //MessageBox.Show(vm.login);
        }
示例#18
0
 private void ShowAddedAccount(Account account)
 {
     AccountList.Add(new Account
     {
         AccountId          = account.AccountId,
         CompanyName        = account.CompanyName,
         CompanyPhoneNumber = account.CompanyPhoneNumber,
         CompanyEmail       = account.CompanyEmail,
         Address            = account.Address,
         Description        = account.Description,
         CreatedDate        = account.CreatedDate,
         UpdatedDate        = account.UpdatedDate,
         ContactId          = account.ContactId,
         ContactName        = account.ContactName,
         Department         = account.Department,
         Position           = account.Position,
         ContactPhoneNumber = account.ContactPhoneNumber
     });
 }
示例#19
0
        public static AccountList GetAccountsByCustomer(int Id)
        {
            AccountList list = new AccountList();

            SqlParamsColl paramList = new SqlParamsColl();
            paramList.Add("@CustomerId", SqlDbType.Int, Id);

            SqlTools.ExecuteReader("dbo.Accounts_RetrieveByCustomer", paramList, reader =>
                {
                    while (reader.Read())
                    {
                        Account acc = new Account();
                        PopulateObjectFromReader(reader, acc);
                        list.Add(acc);
                    }
                });

            return list;
        }
示例#20
0
    private void ReadAllAccountsFromXml()
    {
        XmlTextReader reader = new XmlTextReader("Accounts.xml");

        //  Loop over the XML file
        while (reader.Read())
        {
            //  Here we check the type of the node, in this case we are looking for element
            if (reader.NodeType == XmlNodeType.Element)
            {
                //  If the element is "accounts"
                if (reader.Name == "Accounts")
                {
                    var account = new Accounts()
                                  account.AccountName = reader.Value;
                    AccountList.Add(account)
                }
            }
        }
        reader.Close();
    }
示例#21
0
        public override void Save()
        {
            if (IsNotSaved())
            {
                AccountList accountList = AccountList.getInstance();

                if (accountList.Exists(Number))
                {
                    throw new Exception("Счёт с таким номером уже существует");
                }

                ExecQuery();
                accountList.Add(this);
            }

            DeleteFile(File);

            File = WorkWithFiles.fileCopy(File, "Accounts", ID.ToString());

            ExecQuery();
        }
        /// <summary>
        /// Fetch AccountList.
        /// </summary>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public AccountList Fetch(AccountCriteria criteria)
        {
            AccountList item = (AccountList)Activator.CreateInstance(typeof(AccountList), true);

            bool cancel = false;

            OnFetching(criteria, ref cancel);
            if (cancel)
            {
                return(item);
            }

            // Fetch Child objects.
            using (var connection = new SqlConnection(ADOHelper.ConnectionString))
            {
                connection.Open();
                using (var command = new SqlCommand("[dbo].[CSLA_Account_Select]", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag));
                    command.Parameters.AddWithValue("@p_Address2HasValue", criteria.Address2HasValue);
                    command.Parameters.AddWithValue("@p_PhoneHasValue", criteria.PhoneHasValue);
                    using (var reader = new SafeDataReader(command.ExecuteReader()))
                    {
                        if (reader.Read())
                        {
                            do
                            {
                                item.Add(new AccountFactory().Map(reader));
                            } while(reader.Read());
                        }
                    }
                }
            }

            MarkOld(item);
            MarkAsChild(item);
            OnFetched();
            return(item);
        }
        /// <summary>
        /// Fetch AccountList.
        /// </summary>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public AccountList Fetch(AccountCriteria criteria)
        {
            AccountList item = (AccountList)Activator.CreateInstance(typeof(AccountList), true);

            bool cancel = false;

            OnFetching(criteria, ref cancel);
            if (cancel)
            {
                return(item);
            }

            // Fetch Child objects.
            string commandText = String.Format("SELECT [AccountId], [UniqueID], [Email], [FirstName], [LastName], [Address1], [Address2], [City], [State], [Zip], [Country], [Phone] FROM [dbo].[Account] {0}", ADOHelper.BuildWhereStatement(criteria.StateBag));

            using (var connection = new SqlConnection(ADOHelper.ConnectionString))
            {
                connection.Open();
                using (var command = new SqlCommand(commandText, connection))
                {
                    command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag));
                    using (var reader = new SafeDataReader(command.ExecuteReader()))
                    {
                        if (reader.Read())
                        {
                            do
                            {
                                item.Add(new AccountFactory().Map(reader));
                            } while(reader.Read());
                        }
                    }
                }
            }

            MarkOld(item);
            MarkAsChild(item);
            OnFetched();
            return(item);
        }
示例#24
0
        public static void LoadAccounts(string patch)
        {
            if (!File.Exists(patch))
            {
                return;
            }

            List <string> lines = File.ReadAllLines(patch).ToList();

            SiteDetecter.TypeSite[] list = Enum.GetValues(typeof(SiteDetecter.TypeSite)).Cast <SiteDetecter.TypeSite>().ToArray();
            foreach (string line in lines)
            {
                if (string.IsNullOrWhiteSpace(line))
                {
                    break;
                }

                string[] arr = line.Split(':');

                if (arr.Length != 3)
                {
                    break;
                }

                foreach (SiteDetecter.TypeSite tup in list)
                {
                    string m = arr[2];
                    if (m.ToLower() == tup.ToString().ToLower() || tup.ToString().ToLower().Contains(m.ToLower()))
                    {
                        AccountList.Add(new UserAccount {
                            account = new Account {
                                Username = arr[0], Password = arr[1]
                            }, TypeSite = tup
                        });
                        break;
                    }
                }
            }
        }
示例#25
0
        public IAccount OpenSavingsAccount(string customerName, DateTimeOffset openDate)
        {
            SavingsAccountNumber++;
            var accountBalance = 0;
            var accountNumber  = SavingsAccountNumber.ToString();

            switch (accountNumber.Length)
            {
            case 1:
                accountNumber = "00000" + accountNumber;
                break;

            case 2:
                accountNumber = "0000" + accountNumber;
                break;

            case 3:
                accountNumber = "000" + accountNumber;
                break;

            case 4:
                accountNumber = "00" + accountNumber;
                break;

            case 5:
                accountNumber = "0" + accountNumber;
                break;

            default:
                break;
            }
            accountNumber = "SV-" + accountNumber;
            IAccount account = new Account(accountNumber, accountBalance, customerName, openDate);

            AccountList.Add(account);
            TransactionLog.Add(new StatementRow(account, account.Balance, account.Balance, account.OpenedDate, "Account opened"));
            return(account);
        }
示例#26
0
        static public void SearchAccount(ComboBox box, TextBox search, HairSpaContext context)
        {
            IQueryable <Account> list = null;

            AccountList.Clear();

            switch (box.SelectedItem)
            {
            case "Id":
                list = context.Accounts.Where(ac => ac.Id.ToString().Contains(search.Text));
                break;

            case "Username":
                list = context.Accounts.Where(ac => ac.Username.Contains(search.Text));
                break;

            default:
                break;
            }

            try
            {
                if (list.ToList().Count <= 0)
                {
                    MessageBox.Show("No records were found", "No Results");
                    return;
                }
                else
                {
                    list.ToList().ForEach(ac => AccountList.Add(ac));
                }
            }
            catch (Exception)
            {
                MessageBox.Show("No records were found", "No Results");
                return;
            }
        }
示例#27
0
        public bool ProcessMoney(Money money)
        {
            var m = AccountList.FirstOrDefault(v => v.CurrentCurrency == money.FxCode);

            if (m == null)
            {
                m = new Account()
                {
                    CurrentCurrency = money.FxCode, Quantity = money.Number
                };

                AccountList.Add(m);
            }
            else
            {
                if (!m.IsValidModify(money))
                {
                    return(false);
                }
                m.ObtainMoney(money);
            }
            return(true);
        }
示例#28
0
        public static AccountList GetList()
        {
            AccountList    aList  = null;
            MyDBConnection myConn = new MyDBConnection();
            SqlConnection  conn   = new SqlConnection();
            SqlDataReader  dr;
            SqlCommand     cmd = null;
            string         sql = "Select * from AquaOne.dbo.Account";

            try
            {
                // Open the connection
                conn = myConn.OpenDB();
                cmd  = new SqlCommand(sql, conn);

                dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);

                if (dr.HasRows)
                {
                    aList = new AccountList();
                    while (dr.Read())
                    {
                        aList.Add(FillDataRecord(dr));
                    }
                }

                cmd.Dispose();
                dr.Close();
            }
            finally
            {
                myConn.CloseDB(conn);
            }

            return(aList);
        }
示例#29
0
        private void OnSearchComplete(object sender, UploadDataCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                JsonNerbyuser resusers = new JsonNerbyuser();
                var           str      = Encoding.UTF8.GetString(e.Result);    //转byte为字符串
                resusers = JsonConvert.DeserializeObject <JsonNerbyuser>(str); //反序列化
                if (resusers.resultCode == 1)
                {
                    List <DownLoadFile> files = new List <DownLoadFile>();
                    if (resusers.data.Count > 0)
                    {
                        for (int i = 0; i < resusers.data.Count; i++)
                        {
                            AccountList.Add(resusers.data[i]);

                            //这里需要把特殊账号 排除出来。
                            string localpath = Applicate.LocalConfigData.GetDisplayAvatorPath(resusers.data[i].userId);
                            if (!File.Exists(localpath))//添加需要下载的头像
                            {
                                files.Add(new DownLoadFile
                                {
                                    Jid   = resusers.data[i].userId,
                                    Name  = resusers.data[i].nickname,
                                    Token = resusers.data[i].userId,
                                    ShouldDeleteWhileFileExists = true,
                                    LocalUrl = localpath,
                                    Type     = DownLoadFileType.Image
                                });
                            }
                        }
                        HttpDownloader.Download(files, (item) =>
                        {
                            switch (item.State)
                            {
                            case DownloadState.Successed:
                                var tmp = AccountList.FirstOrDefault(a => a.userId == item.Jid);
                                if (tmp != null)
                                {
                                    App.Current.Dispatcher.Invoke(() =>
                                    {
                                        tmp.userId = item.Jid;    //下载完成后刷新头像
                                    });
                                }
                                break;

                            case DownloadState.Error:
                                break;

                            default:
                                break;
                            }
                        });
                    }
                    else
                    {
                        pageNum--;
                    }
                }
            }
            else
            {
                SnackBar.Enqueue("错误:" + e.Error.Message);
            }
            ShowLoadingProgressBar(false);//禁用按钮并显示
        }
 public AddAccount(object obj)
 {
     AccountList.Add(AccountName);
     //Call you Model function To Save you lIst to DB or XML or Where you Like
     SaveAccountList()
 }
示例#31
0
 //Account Methods
 static public void GetAllAccounts(HairSpaContext context)
 {
     //Clear account list, then add customer table records to the list.
     AccountList.ToList().ForEach(ac => AccountList.Remove(ac));
     context.Accounts.ToList().ForEach(ac => AccountList.Add(ac));
 }