예제 #1
0
        public async Task <Account> GetAccountAsync(int id, DateTimeOffset startDate, DateTimeOffset endDate)
        {
            Account account;
            IEnumerable <dto.Tags>      tags           = new dto.Tags[0];
            IEnumerable <AccountLedger> accountLedgers = new AccountLedger[0];

            using (var transactionHelper = this._repositoryService.GetTransactionHelper())
            {
                var tagsRepository = this._repositoryService.GetTagsRepository(transactionHelper);
                tags = (await tagsRepository.GetTagsForAccountAsync(id)).ToList();
            }
            using (var transactionHelper = this._repositoryService.GetTransactionHelper())
            {
                var accountRepository = this._repositoryService.GetAccountRepository(transactionHelper);
                account = new model.Account(await accountRepository.GetAccountAsync(id));
            }
            using (var transactionHelper = this._repositoryService.GetTransactionHelper())
            {
                var accountLedgerRepository = this._repositoryService.GetAccountLedgerRepository(transactionHelper);
                accountLedgers = (await accountLedgerRepository.GetEntriesBetweenDatesAsync(id, startDate, endDate)).Select(e => new AccountLedger(e, id)).ToList();
            }
            account.Tags          = tags;
            account.LedgerEntries = accountLedgers;
            return(account);
        }
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     model.Account account = data.findMemberByID(int.Parse(ID.Content.ToString()));
     if (account != null)
     {
         account.status = model.enums.AccountStatus.ACTIVE;
         updateMember();
         this.Close();
         ToggleForm();
     }
 }
예제 #3
0
        /*
         * - Lấy thông tin tài khoản nhân viên và thêm tài khoản nhân viên bằng class AccountDao
         */
        public bool addAccount()
        {
            model.Account account = new model.Account();

            user_name = tb_userName_quanLyNhanVienControl.Text;

            account.user_name = tb_userName_quanLyNhanVienControl.Text;
            account.password  = tb_password_quanLyNhanVienControl.Text;

            return(account_dao.addAccount(account));
        }
예제 #4
0
        //add Account
        public bool addAccount(model.Account account)
        {
            String sql = "insert into ACCOUNT values(@userName, @password)";

            DbParameter param1 = df.createParam("@userName", account.user_name);
            DbParameter param2 = df.createParam("@password", account.password);

            DbParameter[] parameters = { param1, param2 };

            int rows = account_helper.insertUpdateDelete(sql, parameters);

            return(rows == 1);
        }
예제 #5
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            model.Account account = data.findMemberByID(int.Parse(ID.Content.ToString()));
            if (account != null)
            {
                foreach (var bookItem in account.getLendingBookItems())
                {
                    bookItem.lendingStatus = model.enums.LendingStatus.LOST;
                    data.updateBookItem(bookItem);
                }
                while (account.getReservedBookItem().Count > 0)
                {
                    account.removeBookToReserveBookList(account.getReservedBookItem()[0], "CANCELED");
                }


                data.deleteMember(account);
                updateMember();
                this.Close();
                ToggleForm();
            }
        }
 private void UserScanerBoardViewModel_updateLedingBookList(model.Account account)
 {
     DataContext         = new RenewBookViewModel(account);
     SelectAll.IsChecked = false;
 }