internal accountType[] GetCustomerAccounts(string customerId)
    {
        CustomerAccountDataSet  dsAccounts = new CustomerAccountDataSet();
        AccountTableAdapter     ad1        = new AccountTableAdapter();
        AccountTypeTableAdapter ad2        = new AccountTypeTableAdapter();

        ad1.Fill(dsAccounts.Account, customerId);
        ad2.Fill(dsAccounts.AccountType);

        List <accountType> result = new List <accountType>();

        foreach (CustomerAccountDataSet.AccountRow rowAccount in dsAccounts.Account)
        {
            accountType account = new accountType();

            account.accountNumber = rowAccount.AccountNumber;
            account.balance       = rowAccount.Balance;
            account.customerId    = rowAccount.CustomerId;
            account.dateOpened    = rowAccount.DateOpened;

            account.lastTransactionAt = rowAccount.IsLastTransactionDateNull() ? DateTime.MinValue : rowAccount.LastTransactionDate;

            CustomerAccountDataSet.AccountTypeRow rowAccountType = rowAccount.AccountTypeRow;
            account.accountType1                       = new accountTypeType();
            account.accountType1.id                    = rowAccountType.AccountTypeId;
            account.accountType1.fees                  = rowAccountType.IsFeesNull() ? 0 : (float)rowAccountType.Fees;
            account.accountType1.interestRate          = rowAccountType.IsInterestRateNull() ? 0 : (float)rowAccountType.InterestRate;
            account.accountType1.maxMonthlyTransaction = rowAccountType.IsMaxMonthlyTransactionNull() ? 0 : rowAccountType.MaxMonthlyTransaction;
            account.accountType1.type                  = rowAccountType.AccountType;

            result.Add(account);
        }

        return(result.ToArray());
    }
Exemple #2
0
            ///////////////////////////////////////////////////////////////////////
            //   Overriden Functions
            ///////////////////////////////////////////////////////////////////////
            public override void EndInit()
            {
                base.EndInit();

                this.TableNewRow   += new DataTableNewRowEventHandler(AccountTypeDataTable_TableNewRow);
                this.ColumnChanged += new DataColumnChangeEventHandler(AccountTypeDataTable_ColumnChanged);

                this.ACTableAdapter = new AccountTypeTableAdapter();
                this.ACTableAdapter.ClearBeforeFill = true;

                this.newID   = 1;
                this.stayOut = false;
            }
        public void myInit()
        {
            // Initialize Table Adapters
            this.accountTypeTA = new AccountTypeTableAdapter();
            this.accountTA     = new AccountTableAdapter();
            this.envelopeTA    = new EnvelopeTableAdapter();
            this.lineTypeTA    = new LineTypeTableAdapter();
            this.lineItemTA    = new LineItemTableAdapter();
            this.eLineTA       = new EnvelopeLineTableAdapter();

            // Initialize Maps
            this.accountMap  = new Dictionary <string, int>();
            this.envelopeMap = new Dictionary <string, int>();

            // Fillup certain tables (Tables that can allow overlap of imported data)
            this.accountTypeTA.Fill(this.AccountType);
            this.lineTypeTA.Fill(this.LineType);

            // Setup ID Counters
            this.AccountID      = DBquery.getNewID("id", "Account");
            this.AccountTypeID  = DBquery.getNewID("id", "AccountType");
            this.EnvelopeID     = DBquery.getNewID("id", "Envelope");
            this.LineTypeID     = DBquery.getNewID("id", "LineType");
            this.LineItemID     = DBquery.getNewID("id", "LineItem");
            this.TransactionID  = DBquery.getNewID("transactionID", "LineItem");
            this.EnvelopeLineID = DBquery.getNewID("id", "EnvelopeLine");

            // Subscribe to table events
            this.Account.TableNewRow    += new System.Data.DataTableNewRowEventHandler(Account_TableNewRow);
            this.Account.ColumnChanging += new System.Data.DataColumnChangeEventHandler(ColumnChanging);

            this.AccountType.TableNewRow    += new System.Data.DataTableNewRowEventHandler(AccountType_TableNewRow);
            this.AccountType.ColumnChanging += new System.Data.DataColumnChangeEventHandler(ColumnChanging);

            this.Envelope.TableNewRow    += new System.Data.DataTableNewRowEventHandler(Envelope_TableNewRow);
            this.Envelope.ColumnChanging += new System.Data.DataColumnChangeEventHandler(ColumnChanging);

            this.EnvelopeLine.TableNewRow    += new System.Data.DataTableNewRowEventHandler(EnvelopeLine_TableNewRow);
            this.EnvelopeLine.ColumnChanging += new System.Data.DataColumnChangeEventHandler(ColumnChanging);

            this.LineItem.TableNewRow    += new System.Data.DataTableNewRowEventHandler(LineItem_TableNewRow);
            this.LineItem.ColumnChanging += new System.Data.DataColumnChangeEventHandler(ColumnChanging);

            this.LineType.TableNewRow    += new System.Data.DataTableNewRowEventHandler(LineType_TableNewRow);
            this.LineType.ColumnChanging += new System.Data.DataColumnChangeEventHandler(ColumnChanging);
        }
Exemple #4
0
        /////////////////////////
        //   Functions Public
        public void myInit()
        {
            this.AccountTA = new AccountTableAdapter();
            this.AccountTA.ClearBeforeFill = true;

            this.AccountTypeTA = new AccountTypeTableAdapter();
            this.AccountTypeTA.ClearBeforeFill = true;

            this.AccountCatagoryList = new List <AccountCatagory>();
            this.AccountCatagoryList.Add(new AccountCatagory(SpclAccountCat.INCOME, "Income"));
            this.AccountCatagoryList.Add(new AccountCatagory(SpclAccountCat.ACCOUNT, "Account"));
            this.AccountCatagoryList.Add(new AccountCatagory(SpclAccountCat.EXPENSE, "Expense"));

            this.AccountNormalList = new List <AccountNormal>();
            this.AccountNormalList.Add(new AccountNormal(LineCD.CREDIT, "Credit"));
            this.AccountNormalList.Add(new AccountNormal(LineCD.DEBIT, "Debit"));
        }
        public List<Person> GetAllAccount()
        {
            UserDataTableAdapter adapter = new UserDataTableAdapter();
            List<Person> accountList = new List<Person>();
            var accountTable = adapter.GetAllAccounts();
            string id = "";
            string name = "";
            int typeId = 0;
            string type = "";
            foreach (var row in accountTable)
            {
                id = Convert.ToString(row.Id);
                name = Convert.ToString(row.Username);
                typeId = Convert.ToInt16(row.Type);
                AccountTypeTableAdapter acadapter = new AccountTypeTableAdapter();
                type = Convert.ToString(acadapter.GetTypeNameById(typeId)[0].TypeName);
                accountList.Add(new Person(id, name, type));

            }
            return accountList;
        }
 public Person loginToSystem(string username, string password)
 {
     UserDataTableAdapter udAdapter = new UserDataTableAdapter();
     try
     {
         var details = udAdapter.GetUserDataWithLogin(username, password)[0];
         string name = details.Username;
         int id = details.Id;
         AccountTypeTableAdapter acTypeAdapter = new AccountTypeTableAdapter();
         string type = acTypeAdapter.GetTypeNameById(details.Type)[0].TypeName;
         return new Person(Convert.ToString(id), name, type);
     }
     catch {
         return null;
     }
 }
Exemple #7
0
        public void stressFillDataBase()
        {
            stressDS = new StressDataSet();
            rnd      = new Random();

            accountTypeTA = new AccountTypeTableAdapter();
            lineTypeTA    = new LineTypeTableAdapter();
            envGroupTA    = new EnvelopeGroupTableAdapter();
            accountTA     = new AccountTableAdapter();
            envelopeTA    = new EnvelopeTableAdapter();
            lineTA        = new LineItemTableAdapter();
            envLineTA     = new EnvelopeLineTableAdapter();

            // Reset the database
            DBquery.dropTables();
            DBquery.buildTables();

            // Fill the data tables
            accountTypeTA.Fill(stressDS.AccountType);
            lineTypeTA.Fill(stressDS.LineType);
            envGroupTA.Fill(stressDS.EnvelopeGroup);
            accountTA.Fill(stressDS.Account);
            envelopeTA.Fill(stressDS.Envelope);
            lineTA.Fill(stressDS.LineItem);
            envLineTA.Fill(stressDS.EnvelopeLine);

            accountID  = DBquery.getNewID("id", "Account");
            aTypeID    = DBquery.getNewID("id", "AccountType");
            envelopeID = DBquery.getNewID("id", "Envelope");
            eGroupID   = DBquery.getNewID("id", "EnvelopeGroup");
            eLineID    = DBquery.getNewID("id", "EnvelopeLine");
            lTypeID    = DBquery.getNewID("id", "LineType");

            lineID  = DBquery.getNewID("id", "LineItem");
            transID = DBquery.getNewID("transactionID", "LineItem");
            date    = DateTime.Now.AddMonths(-12 * 100).Date;

            addAccount();
            addAccount();
            addAccount();
            addAccount();
            addAccount();
            addAccount();
            addAccount();
            addAccount();
            addAccount();
            addAccount();
            addAccount();
            addAccount();
            addAccount();
            addAccount();
            addAccount();
            addAccount();
            addAccount();
            addAccount();
            addAccount();
            addAccount();
            addAccount();
            addAccount();
            addAccount();
            addAccount();
            addAccount();

            addEnvelope();
            addEnvelope();
            addEnvelope();
            addEnvelope();
            addEnvelope();
            addEnvelope();
            addEnvelope();
            addEnvelope();
            addEnvelope();
            addEnvelope();
            addEnvelope();
            addEnvelope();
            addEnvelope();
            addEnvelope();
            addEnvelope();
            addEnvelope();
            addEnvelope();
            addEnvelope();
            addEnvelope();
            addEnvelope();
            addEnvelope();
            addEnvelope();
            addEnvelope();
            addEnvelope();
            addEnvelope();
            addEnvelope();

            int num;

            // Make alot of entries
            while (date < DateTime.Now.AddMonths(3).Date)
            {
                num = rnd.Next(0, 10000);

                if (num == 0)
                {
                    addAccountType();
                }
                else if (num == 1)
                {
                    addLineType();
                }
                else if (num == 2)
                {
                    addEnvelopeGroup();
                }

                if (10 < num && num < 15)
                {
                    addAccount();
                }

                if (30 < num && num < 34)
                {
                    addEnvelope();
                }


                if (100 < num && num < 200)
                {
                    complexTrans();
                }
                else
                {
                    simpleTrans();
                }
            }

            // Save the data
            accountTypeTA.Update(stressDS.AccountType);
            lineTypeTA.Update(stressDS.LineType);
            envGroupTA.Update(stressDS.EnvelopeGroup);
            accountTA.Update(stressDS.Account);
            envelopeTA.Update(stressDS.Envelope);
            lineTA.Update(stressDS.LineItem);
            envLineTA.Update(stressDS.EnvelopeLine);
        }