Exemplo n.º 1
0
        public DTOAccount GetAccountById(int idaccount)
        {
            string     query = string.Format("SELECT idaccount,nameaccount,password,status,idstaff FROM TableAccount WHERE idaccount={0}", idaccount);
            DataTable  dt    = DataProvider.Instance.ExecuteQuery(query);
            DTOAccount gv    = new DTOAccount(dt.Rows[0]);

            return(gv);
        }
Exemplo n.º 2
0
 public static DbAccount UpdateDbAccount(DTOAccount dtoAccount, DbAccount account, DbHolder holder)
 {
     account.AccountType = dtoAccount.AccountType;
     account.Balance     = dtoAccount.Balance;
     account.Bonus       = dtoAccount.Bonus;
     account.Holder      = holder;
     account.IsEnabled   = dtoAccount.IsEnabled;
     return(account);
 }
Exemplo n.º 3
0
        public List <DTOAccount> GetListAccount()
        {
            List <DTOAccount> list  = new List <DTOAccount>();
            string            query = string.Format("SELECT * FROM TableAccount ");
            DataTable         dt    = DataProvider.Instance.ExecuteQuery(query);

            foreach (DataRow item in dt.Rows)
            {
                DTOAccount account = new DTOAccount(item);
                list.Add(account);
            }
            return(list);
        }
Exemplo n.º 4
0
        public static Account ToORMAccount(this DTOAccount dtoAccount)
        {
            var account = new Account
            {
                Id             = dtoAccount.Id,
                Account_number = dtoAccount.Number,
                AccountType    = dtoAccount.AccountType.ToString(),
                Amount         = dtoAccount.Amount,
                Person         = dtoAccount.Person.ToORMPerson(),
                IsClosed       = dtoAccount.IsClosed
            };

            return(account);
        }
        public static Account ToAccount(this DTOAccount dtoAccount)
        {
            var account = new Account
            {
                Id          = dtoAccount.Id,
                Balance     = dtoAccount.Balance,
                Holder      = dtoAccount.Holder.ToHolder(),
                AccountType = dtoAccount.AccountType.ToAccountType(),
                Bonus       = dtoAccount.Bonus.ToBonus(),
                IsEnabled   = dtoAccount.IsEnabled
            };

            account.OnTransaction += account.AccountType.AccountEvent;
            return(account);
        }
Exemplo n.º 6
0
        public static DTOAccount ToDTOAccount(this Account account)
        {
            var dtoAccount = new DTOAccount
            {
                Id     = account.Id,
                Number = account.Account_number,
                ///////ATTENTION////////////////
                AccountType = BLL.Interface.Entities.AccountType.Base,
                ///////////////////////////////
                Amount   = account.Amount,
                Person   = account.Person.ToDTOPerson(),
                IsClosed = account.IsClosed
            };

            return(dtoAccount);
        }
Exemplo n.º 7
0
        public static Account ConvertToAccount(this DTOAccount dtoAccount)
        {
            switch (dtoAccount.AccountType)
            {
            case (int)AccountType.Base:
                return(new BaseAccount(dtoAccount.Id, dtoAccount.Name, dtoAccount.Balance, dtoAccount.Bonus));

            case (int)AccountType.Silver:
                return(new BaseAccount(dtoAccount.Id, dtoAccount.Name, dtoAccount.Balance, dtoAccount.Bonus));

            case (int)AccountType.Gold:
                return(new BaseAccount(dtoAccount.Id, dtoAccount.Name, dtoAccount.Balance, dtoAccount.Bonus));

            case (int)AccountType.Platinum:
                return(new BaseAccount(dtoAccount.Id, dtoAccount.Name, dtoAccount.Balance, dtoAccount.Bonus));

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Exemplo n.º 8
0
 public static Account ToBLLAccount(this DTOAccount dtoAccount)
 {
     return(AccountFactory.Create(dtoAccount.AccountType, dtoAccount.Person.ToBllPerson(), dtoAccount.Number, dtoAccount.Amount, dtoAccount.IsClosed));
 }